Skip to content

Commit 41eae92

Browse files
feat. ported most of the sftp functions to new capacitor sftp plugin
1 parent 99b5365 commit 41eae92

File tree

4 files changed

+468
-62
lines changed

4 files changed

+468
-62
lines changed

android/app/capacitor.build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ dependencies {
2020
implementation "androidx.documentfile:documentfile:1.0.1"
2121
implementation "androidx.core:core:1.6.0"
2222
implementation "androidx.core:core-google-shortcuts:1.0.0"
23-
implementation 'androidx.core:core-ktx:1.16.0'
2423
}
2524
apply from: "../../node_modules/cordova-plugin-buildinfo/src/android/BuildInfo.gradle"
2625

android/app/src/main/java/com/foxdebug/acode/plugins/PluginUtils.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
package com.foxdebug.acode.plugins
22

3+
import com.foxdebug.acode.MainActivity
34
import com.getcapacitor.PluginCall
5+
import kotlinx.coroutines.CoroutineDispatcher
6+
import kotlinx.coroutines.CoroutineScope
7+
import kotlinx.coroutines.CoroutineStart
8+
import kotlinx.coroutines.Dispatchers
9+
import kotlinx.coroutines.launch
10+
import kotlin.coroutines.CoroutineContext
11+
import kotlin.coroutines.EmptyCoroutineContext
412

513
inline fun PluginCall.autoRejectOnError(onFailure:(Throwable?)-> Unit, invoke:()-> Unit){
614
runCatching {
@@ -26,4 +34,10 @@ inline fun PluginCall.existsNot(key: String,onFailure:(()-> Unit) = {}){
2634
reject("$key is not set")
2735
onFailure.invoke()
2836
}
37+
}
38+
39+
fun async(context: CoroutineContext = Dispatchers.IO,
40+
start: CoroutineStart = CoroutineStart.DEFAULT,
41+
block: suspend CoroutineScope.() -> Unit){
42+
MainActivity.lifeCycleScope.launch(context,start,block)
2943
}

0 commit comments

Comments
 (0)