diff --git a/android/src/main/kotlin/com/ionic/plugin/android/core/utils/ContinuationHelpers.kt b/android/src/main/kotlin/com/ionic/plugin/android/core/utils/ContinuationHelpers.kt index 008c426..f09c870 100644 --- a/android/src/main/kotlin/com/ionic/plugin/android/core/utils/ContinuationHelpers.kt +++ b/android/src/main/kotlin/com/ionic/plugin/android/core/utils/ContinuationHelpers.kt @@ -5,7 +5,7 @@ import android.content.BroadcastReceiver import android.content.Context import android.content.Intent import android.content.IntentFilter -import com.ionic.plugin.core.utils.wrapSafely +import com.ionic.plugin.core.utils.resumeSafely import kotlin.coroutines.Continuation import kotlin.coroutines.suspendCoroutine @@ -21,9 +21,7 @@ fun registerContinuationActivityResult( activityResultObserver.add(object : IActivityResult { override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?): Boolean { if (!test(requestCode, resultCode, data)) return false - it.wrapSafely { - return@wrapSafely block(requestCode, resultCode, data) - } + it.resumeSafely { block(requestCode, resultCode, data) } activityResultObserver.remove(this) return true } @@ -59,6 +57,6 @@ fun registerContinuationReceiver( block: (intent: Intent) -> T, ) { registerReceiver(activity, action) { intent -> - it.wrapSafely { block(intent) } + it.resumeSafely { block(intent) } } } diff --git a/build.gradle.kts b/build.gradle.kts index 88b5c9a..f4822bd 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -25,5 +25,5 @@ extra.apply { set("kotlinxAtomicfuVersion", "0.23.2") set("androidxAppcompatVersion", "1.6.1") set("mavenGroup", "com.github.SpryRocks.ionic-plugin-core") - set("mavenVersion", "0.1.14-alpha.3") + set("mavenVersion", "0.1.14-alpha.4") } diff --git a/core/src/commonMain/kotlin/com/ionic/plugin/core/utils/ContinuationHelpers.kt b/core/src/commonMain/kotlin/com/ionic/plugin/core/utils/ContinuationHelpers.kt index 80d24f0..9f4b9b8 100644 --- a/core/src/commonMain/kotlin/com/ionic/plugin/core/utils/ContinuationHelpers.kt +++ b/core/src/commonMain/kotlin/com/ionic/plugin/core/utils/ContinuationHelpers.kt @@ -24,7 +24,7 @@ class ContinuationCallback { } } -fun Continuation.wrapSafely(block: () -> T) { +fun Continuation.resumeSafely(block: () -> T) { try { if (this.context.isActive) { resume(block())