From 9588a582ce916b418a08bad114b7a2fe6b805c2b Mon Sep 17 00:00:00 2001 From: arkon Date: Sun, 2 Feb 2020 17:06:51 -0500 Subject: [PATCH] Use coroutines for async loading of modules --- .../main/java/eu/kanade/tachiyomi/AppModule.kt | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/AppModule.kt b/app/src/main/java/eu/kanade/tachiyomi/AppModule.kt index 114f231b6..4c0621a1a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/AppModule.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/AppModule.kt @@ -11,8 +11,8 @@ import eu.kanade.tachiyomi.data.track.TrackManager import eu.kanade.tachiyomi.extension.ExtensionManager import eu.kanade.tachiyomi.network.NetworkHelper import eu.kanade.tachiyomi.source.SourceManager -import rx.Observable -import rx.schedulers.Schedulers +import kotlinx.coroutines.GlobalScope +import kotlinx.coroutines.launch import uy.kohesive.injekt.api.* class AppModule(val app: Application) : InjektModule { @@ -43,20 +43,16 @@ class AppModule(val app: Application) : InjektModule { // Asynchronously init expensive components for a faster cold start - rxAsync { get() } + GlobalScope.launch { get() } - rxAsync { get() } + GlobalScope.launch { get() } - rxAsync { get() } + GlobalScope.launch { get() } - rxAsync { get() } + GlobalScope.launch { get() } - rxAsync { get() } + GlobalScope.launch { get() } } - private fun rxAsync(block: () -> Unit) { - Observable.fromCallable { block() }.subscribeOn(Schedulers.computation()).subscribe() - } - }