mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-30 11:12:38 -05:00
Update deprecated coroutines code
This commit is contained in:
parent
ccd360687e
commit
5362f62078
2 changed files with 8 additions and 8 deletions
|
@ -7,6 +7,9 @@ import android.content.IntentFilter
|
||||||
import eu.kanade.tachiyomi.extension.model.Extension
|
import eu.kanade.tachiyomi.extension.model.Extension
|
||||||
import eu.kanade.tachiyomi.extension.model.LoadResult
|
import eu.kanade.tachiyomi.extension.model.LoadResult
|
||||||
import eu.kanade.tachiyomi.util.launchNow
|
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
|
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 {
|
private suspend fun getExtensionFromIntent(context: Context, intent: Intent?): LoadResult {
|
||||||
val pkgName = getPackageNameFromIntent(intent) ?:
|
val pkgName = getPackageNameFromIntent(intent) ?:
|
||||||
return LoadResult.Error("Package name not found")
|
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()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
package eu.kanade.tachiyomi.util
|
package eu.kanade.tachiyomi.util
|
||||||
|
|
||||||
import kotlinx.coroutines.experimental.CoroutineScope
|
import kotlinx.coroutines.experimental.*
|
||||||
import kotlinx.coroutines.experimental.CoroutineStart
|
import kotlinx.coroutines.experimental.android.Main
|
||||||
import kotlinx.coroutines.experimental.Job
|
|
||||||
import kotlinx.coroutines.experimental.android.UI
|
|
||||||
import kotlinx.coroutines.experimental.launch
|
|
||||||
|
|
||||||
fun launchUI(block: suspend CoroutineScope.() -> Unit): Job =
|
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 =
|
fun launchNow(block: suspend CoroutineScope.() -> Unit): Job =
|
||||||
launch(UI, CoroutineStart.UNDISPATCHED, null, null, block)
|
GlobalScope.launch(Dispatchers.Main, CoroutineStart.UNDISPATCHED, null, block)
|
||||||
|
|
Loading…
Reference in a new issue