From e9e9e108054f5b90ae9cc1ad623fc587a4d203d7 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 114f231b6a..4c0621a1a8 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() - } - }