diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallReceiver.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallReceiver.kt index 5067aa936..12df620f1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallReceiver.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallReceiver.kt @@ -7,6 +7,9 @@ import android.content.IntentFilter import eu.kanade.tachiyomi.extension.model.Extension import eu.kanade.tachiyomi.extension.model.LoadResult import eu.kanade.tachiyomi.util.launchNow +import kotlinx.coroutines.experimental.CoroutineStart +import kotlinx.coroutines.experimental.Dispatchers +import kotlinx.coroutines.experimental.GlobalScope import kotlinx.coroutines.experimental.async /** @@ -91,7 +94,7 @@ internal class ExtensionInstallReceiver(private val listener: Listener) : private suspend fun getExtensionFromIntent(context: Context, intent: Intent?): LoadResult { val pkgName = getPackageNameFromIntent(intent) ?: return LoadResult.Error("Package name not found") - return async { ExtensionLoader.loadExtensionFromPkgName(context, pkgName) }.await() + return GlobalScope.async(Dispatchers.Default, CoroutineStart.DEFAULT, null, { ExtensionLoader.loadExtensionFromPkgName(context, pkgName) }).await() } /** diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/CoroutinesExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/CoroutinesExtensions.kt index 04d55ecdb..dda2051c1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/CoroutinesExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/CoroutinesExtensions.kt @@ -1,13 +1,10 @@ package eu.kanade.tachiyomi.util -import kotlinx.coroutines.experimental.CoroutineScope -import kotlinx.coroutines.experimental.CoroutineStart -import kotlinx.coroutines.experimental.Job -import kotlinx.coroutines.experimental.android.UI -import kotlinx.coroutines.experimental.launch +import kotlinx.coroutines.experimental.* +import kotlinx.coroutines.experimental.android.Main fun launchUI(block: suspend CoroutineScope.() -> Unit): Job = - launch(UI, CoroutineStart.DEFAULT, null, null, block) + GlobalScope.launch(Dispatchers.Main, CoroutineStart.DEFAULT, null, block) fun launchNow(block: suspend CoroutineScope.() -> Unit): Job = - launch(UI, CoroutineStart.UNDISPATCHED, null, null, block) + GlobalScope.launch(Dispatchers.Main, CoroutineStart.UNDISPATCHED, null, block)