Added Android torrent server lib
This commit is contained in:
parent
b9ac63e1bf
commit
5e84c8e8f8
3 changed files with 34 additions and 0 deletions
|
|
@ -73,6 +73,11 @@ android {
|
|||
signingConfig signingConfigs.release
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
flatDir {
|
||||
dirs 'libs'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flutter {
|
||||
|
|
@ -81,4 +86,5 @@ flutter {
|
|||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
implementation(name: 'libmtorrentserver', ext: 'aar')
|
||||
}
|
||||
BIN
android/app/libs/libmtorrentserver.aar
Normal file
BIN
android/app/libs/libmtorrentserver.aar
Normal file
Binary file not shown.
|
|
@ -1,6 +1,34 @@
|
|||
package com.kodjodevf.mangayomi
|
||||
|
||||
import androidx.annotation.NonNull
|
||||
import libmtorrentserver.Libmtorrentserver
|
||||
import io.flutter.embedding.engine.FlutterEngine
|
||||
import io.flutter.plugin.common.MethodChannel
|
||||
import io.flutter.plugin.common.StandardMethodCodec
|
||||
import io.flutter.embedding.android.FlutterActivity
|
||||
|
||||
class MainActivity: FlutterActivity() {
|
||||
|
||||
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
|
||||
super.configureFlutterEngine(flutterEngine)
|
||||
val taskQueue =
|
||||
flutterEngine.dartExecutor.binaryMessenger.makeBackgroundTaskQueue()
|
||||
MethodChannel(
|
||||
flutterEngine.dartExecutor.binaryMessenger,
|
||||
"com.kodjodevf.mangayomi.libmtorrentserver",
|
||||
StandardMethodCodec.INSTANCE,
|
||||
taskQueue
|
||||
).setMethodCallHandler { call, result ->
|
||||
when (call.method) {
|
||||
"start" -> {
|
||||
val path = call.argument<String>("path")
|
||||
Libmtorrentserver.start(path)
|
||||
result.success("ok")
|
||||
}
|
||||
else -> {
|
||||
result.notImplemented()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue