Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ plugins {
}

android {
namespace = "com.jpcexample.simpletorrent"
namespace = "com.jpcottin.simpletorrent"
compileSdk = 36
ndkVersion = "28.2.13676358"
defaultConfig {
applicationId = "com.jpcexample.simpletorrent"
applicationId = "com.jpcottin.simpletorrent"
minSdk = 24
targetSdk = 36
versionCode = 1
Expand Down
2 changes: 1 addition & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Keep TorrentManager native (JNI) methods so R8 doesn't rename them
-keep class com.jpcexample.simpletorrent.data.TorrentManager {
-keep class com.jpcottin.simpletorrent.data.TorrentManager {
native <methods>;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.jpcexample.simpletorrent.ui.main
package com.jpcottin.simpletorrent.ui.main

import androidx.activity.ComponentActivity
import androidx.compose.ui.test.assertIsDisplayed
Expand All @@ -9,10 +9,10 @@ import androidx.compose.ui.test.onNodeWithContentDescription
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performClick
import androidx.compose.ui.test.performTextInput
import com.jpcexample.simpletorrent.data.CreateTorrentResult
import com.jpcexample.simpletorrent.data.DataRepository
import com.jpcexample.simpletorrent.data.PeerInfo
import com.jpcexample.simpletorrent.data.TorrentInfo
import com.jpcottin.simpletorrent.data.CreateTorrentResult
import com.jpcottin.simpletorrent.data.DataRepository
import com.jpcottin.simpletorrent.data.PeerInfo
import com.jpcottin.simpletorrent.data.TorrentInfo
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flowOf
import org.junit.Rule
Expand Down
24 changes: 12 additions & 12 deletions app/src/main/cpp/torrent_jni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ static void save_all_resume_data() {
extern "C" {

JNIEXPORT void JNICALL
Java_com_jpcexample_simpletorrent_data_TorrentManager_nativeInit(
Java_com_jpcottin_simpletorrent_data_TorrentManager_nativeInit(
JNIEnv* env, jobject /*thiz*/, jstring savePath, jstring statePath) {
std::lock_guard<std::mutex> lock(g_mutex);
if (g_session) return;
Expand Down Expand Up @@ -188,7 +188,7 @@ Java_com_jpcexample_simpletorrent_data_TorrentManager_nativeInit(
}

JNIEXPORT void JNICALL
Java_com_jpcexample_simpletorrent_data_TorrentManager_nativeRelease(
Java_com_jpcottin_simpletorrent_data_TorrentManager_nativeRelease(
JNIEnv* /*env*/, jobject /*thiz*/) {
std::lock_guard<std::mutex> lock(g_mutex);
if (!g_session) return;
Expand All @@ -200,14 +200,14 @@ Java_com_jpcexample_simpletorrent_data_TorrentManager_nativeRelease(

// Save resume data without destroying the session (safe to call from onStop)
JNIEXPORT void JNICALL
Java_com_jpcexample_simpletorrent_data_TorrentManager_nativeSaveResumeData(
Java_com_jpcottin_simpletorrent_data_TorrentManager_nativeSaveResumeData(
JNIEnv* /*env*/, jobject /*thiz*/) {
std::lock_guard<std::mutex> lock(g_mutex);
save_all_resume_data();
}

JNIEXPORT jstring JNICALL
Java_com_jpcexample_simpletorrent_data_TorrentManager_addMagnet(
Java_com_jpcottin_simpletorrent_data_TorrentManager_addMagnet(
JNIEnv* env, jobject /*thiz*/, jstring magnetUri) {
std::lock_guard<std::mutex> lock(g_mutex);
if (!g_session) return env->NewStringUTF("error: session not initialized");
Expand All @@ -229,7 +229,7 @@ Java_com_jpcexample_simpletorrent_data_TorrentManager_addMagnet(
}

JNIEXPORT void JNICALL
Java_com_jpcexample_simpletorrent_data_TorrentManager_pauseTorrent(
Java_com_jpcottin_simpletorrent_data_TorrentManager_pauseTorrent(
JNIEnv* env, jobject /*thiz*/, jstring infoHash) {
std::lock_guard<std::mutex> lock(g_mutex);
const char* raw = env->GetStringUTFChars(infoHash, nullptr);
Expand All @@ -239,7 +239,7 @@ Java_com_jpcexample_simpletorrent_data_TorrentManager_pauseTorrent(
}

JNIEXPORT void JNICALL
Java_com_jpcexample_simpletorrent_data_TorrentManager_resumeTorrent(
Java_com_jpcottin_simpletorrent_data_TorrentManager_resumeTorrent(
JNIEnv* env, jobject /*thiz*/, jstring infoHash) {
std::lock_guard<std::mutex> lock(g_mutex);
const char* raw = env->GetStringUTFChars(infoHash, nullptr);
Expand All @@ -249,7 +249,7 @@ Java_com_jpcexample_simpletorrent_data_TorrentManager_resumeTorrent(
}

JNIEXPORT void JNICALL
Java_com_jpcexample_simpletorrent_data_TorrentManager_removeTorrent(
Java_com_jpcottin_simpletorrent_data_TorrentManager_removeTorrent(
JNIEnv* env, jobject /*thiz*/, jstring infoHash, jboolean deleteFiles) {
std::lock_guard<std::mutex> lock(g_mutex);
const char* raw = env->GetStringUTFChars(infoHash, nullptr);
Expand All @@ -267,7 +267,7 @@ Java_com_jpcexample_simpletorrent_data_TorrentManager_removeTorrent(
}

JNIEXPORT jstring JNICALL
Java_com_jpcexample_simpletorrent_data_TorrentManager_getTorrentsJson(
Java_com_jpcottin_simpletorrent_data_TorrentManager_getTorrentsJson(
JNIEnv* env, jobject /*thiz*/) {
std::lock_guard<std::mutex> lock(g_mutex);
if (!g_session) return env->NewStringUTF("[]");
Expand Down Expand Up @@ -353,7 +353,7 @@ Java_com_jpcexample_simpletorrent_data_TorrentManager_getTorrentsJson(
// Add a torrent from a .torrent file on disk.
// Returns "ok:<infohash>" or "error:<message>".
JNIEXPORT jstring JNICALL
Java_com_jpcexample_simpletorrent_data_TorrentManager_addTorrentFile(
Java_com_jpcottin_simpletorrent_data_TorrentManager_addTorrentFile(
JNIEnv* env, jobject /*thiz*/, jstring torrentPath) {
std::lock_guard<std::mutex> lock(g_mutex);
if (!g_session) return env->NewStringUTF("error: session not initialized");
Expand Down Expand Up @@ -383,7 +383,7 @@ Java_com_jpcexample_simpletorrent_data_TorrentManager_addTorrentFile(
// Create a .torrent from a file or folder and seed it.
// Returns JSON: {"name":"...","torrentFile":"...","magnetUri":"..."} or {"error":"..."}
JNIEXPORT jstring JNICALL
Java_com_jpcexample_simpletorrent_data_TorrentManager_createTorrent(
Java_com_jpcottin_simpletorrent_data_TorrentManager_createTorrent(
JNIEnv* env, jobject /*thiz*/, jstring sourcePath, jstring outputDir) {
const char* src_c = env->GetStringUTFChars(sourcePath, nullptr);
const char* out_c = env->GetStringUTFChars(outputDir, nullptr);
Expand Down Expand Up @@ -463,7 +463,7 @@ Java_com_jpcexample_simpletorrent_data_TorrentManager_createTorrent(

// Return the magnet URI for an existing torrent by info-hash, or "" if not found.
JNIEXPORT jstring JNICALL
Java_com_jpcexample_simpletorrent_data_TorrentManager_getMagnetUri(
Java_com_jpcottin_simpletorrent_data_TorrentManager_getMagnetUri(
JNIEnv* env, jobject /*thiz*/, jstring infoHash) {
std::lock_guard<std::mutex> lock(g_mutex);
const char* raw = env->GetStringUTFChars(infoHash, nullptr);
Expand All @@ -476,7 +476,7 @@ Java_com_jpcexample_simpletorrent_data_TorrentManager_getMagnetUri(
// Write a .torrent file for the given info-hash into outputDir.
// Returns the absolute path to the written file, or "" on failure (e.g. metadata not yet fetched).
JNIEXPORT jstring JNICALL
Java_com_jpcexample_simpletorrent_data_TorrentManager_saveTorrentFile(
Java_com_jpcottin_simpletorrent_data_TorrentManager_saveTorrentFile(
JNIEnv* env, jobject /*thiz*/, jstring infoHash, jstring outputDir) {
std::lock_guard<std::mutex> lock(g_mutex);
const char* hash_c = env->GetStringUTFChars(infoHash, nullptr);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.jpcexample.simpletorrent
package com.jpcottin.simpletorrent

import android.content.Intent
import android.net.Uri
Expand All @@ -18,8 +18,8 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.ui.Modifier
import com.jpcexample.simpletorrent.data.TorrentManager
import com.jpcexample.simpletorrent.theme.SimpleTorrentTheme
import com.jpcottin.simpletorrent.data.TorrentManager
import com.jpcottin.simpletorrent.theme.SimpleTorrentTheme

class MainActivity : ComponentActivity() {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.jpcexample.simpletorrent
package com.jpcottin.simpletorrent

import androidx.compose.runtime.Composable
import androidx.navigation3.runtime.entryProvider
import androidx.navigation3.runtime.rememberNavBackStack
import androidx.navigation3.ui.NavDisplay
import com.jpcexample.simpletorrent.ui.main.MainScreen
import com.jpcottin.simpletorrent.ui.main.MainScreen

@Composable
fun MainNavigation() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.jpcexample.simpletorrent
package com.jpcottin.simpletorrent

import androidx.navigation3.runtime.NavKey
import kotlinx.serialization.Serializable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.jpcexample.simpletorrent.data
package com.jpcottin.simpletorrent.data

import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.Flow
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.jpcexample.simpletorrent.data
package com.jpcottin.simpletorrent.data

import android.content.Context
import android.os.Build
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.jpcexample.simpletorrent.theme
package com.jpcottin.simpletorrent.theme

import androidx.compose.ui.graphics.Color

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.jpcexample.simpletorrent.theme
package com.jpcottin.simpletorrent.theme

import android.os.Build
import androidx.compose.foundation.isSystemInDarkTheme
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.jpcexample.simpletorrent.theme
package com.jpcottin.simpletorrent.theme

import androidx.compose.material3.Typography
import androidx.compose.ui.text.TextStyle
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.jpcexample.simpletorrent.ui.main
package com.jpcottin.simpletorrent.ui.main

import android.app.DownloadManager
import android.content.ClipData
Expand Down Expand Up @@ -70,11 +70,11 @@ import androidx.core.content.FileProvider
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation3.runtime.NavKey
import com.jpcexample.simpletorrent.data.DefaultDataRepository
import com.jpcexample.simpletorrent.data.PeerInfo
import com.jpcexample.simpletorrent.data.TorrentInfo
import com.jpcexample.simpletorrent.data.TorrentManager
import com.jpcexample.simpletorrent.theme.SimpleTorrentTheme
import com.jpcottin.simpletorrent.data.DefaultDataRepository
import com.jpcottin.simpletorrent.data.PeerInfo
import com.jpcottin.simpletorrent.data.TorrentInfo
import com.jpcottin.simpletorrent.data.TorrentManager
import com.jpcottin.simpletorrent.theme.SimpleTorrentTheme
import java.io.File
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.jpcexample.simpletorrent.ui.main
package com.jpcottin.simpletorrent.ui.main

import android.content.ContentResolver
import android.net.Uri
import android.provider.OpenableColumns
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.jpcexample.simpletorrent.data.CreateTorrentResult
import com.jpcexample.simpletorrent.data.DataRepository
import com.jpcexample.simpletorrent.data.TorrentInfo
import com.jpcottin.simpletorrent.data.CreateTorrentResult
import com.jpcottin.simpletorrent.data.DataRepository
import com.jpcottin.simpletorrent.data.TorrentInfo
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableStateFlow
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.jpcexample.simpletorrent.ui.main
package com.jpcottin.simpletorrent.ui.main

import com.jpcexample.simpletorrent.data.CreateTorrentResult
import com.jpcexample.simpletorrent.data.DataRepository
import com.jpcexample.simpletorrent.data.TorrentInfo
import com.jpcottin.simpletorrent.data.CreateTorrentResult
import com.jpcottin.simpletorrent.data.DataRepository
import com.jpcottin.simpletorrent.data.TorrentInfo
import junit.framework.TestCase.assertEquals
import junit.framework.TestCase.assertTrue
import kotlinx.coroutines.Dispatchers
Expand Down
Loading