diff --git a/app/build.gradle b/app/build.gradle index d0ab72278..302c1a543 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -133,8 +133,9 @@ dependencies { implementation 'androidx.biometric:biometric:1.0.1' final lifecycle_version = '2.2.0' - implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version" + implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version" + implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version" // UI library implementation 'com.google.android.material:material:1.1.0' diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index 8e4130ae3..34273af92 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -5,6 +5,7 @@ import android.content.Intent import android.os.Bundle import android.view.ViewGroup import android.widget.Toast +import androidx.lifecycle.lifecycleScope import com.bluelinelabs.conductor.Conductor import com.bluelinelabs.conductor.Controller import com.bluelinelabs.conductor.ControllerChangeHandler @@ -30,7 +31,6 @@ import eu.kanade.tachiyomi.ui.recent.history.HistoryController import eu.kanade.tachiyomi.ui.recent.updates.UpdatesController import eu.kanade.tachiyomi.ui.source.SourceController import eu.kanade.tachiyomi.ui.source.global_search.GlobalSearchController -import eu.kanade.tachiyomi.util.lang.launchInUI import eu.kanade.tachiyomi.util.lang.launchUI import eu.kanade.tachiyomi.util.system.WebViewUtil import eu.kanade.tachiyomi.util.system.toast @@ -39,6 +39,7 @@ import java.util.concurrent.TimeUnit import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.delay +import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.launch import timber.log.Timber @@ -156,7 +157,7 @@ class MainActivity : BaseActivity() { setExtensionsBadge() preferences.extensionUpdatesCount().asFlow() .onEach { setExtensionsBadge() } - .launchInUI() + .launchIn(lifecycleScope) } override fun onNewIntent(intent: Intent) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/security/SecureActivityDelegate.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/security/SecureActivityDelegate.kt index 89b5c9c6a..ffd7c1384 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/security/SecureActivityDelegate.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/security/SecureActivityDelegate.kt @@ -4,9 +4,10 @@ import android.content.Intent import android.view.WindowManager import androidx.biometric.BiometricManager import androidx.fragment.app.FragmentActivity +import androidx.lifecycle.lifecycleScope import eu.kanade.tachiyomi.data.preference.PreferencesHelper -import eu.kanade.tachiyomi.util.lang.launchInUI import java.util.Date +import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import uy.kohesive.injekt.injectLazy @@ -23,7 +24,7 @@ class SecureActivityDelegate(private val activity: FragmentActivity) { activity.window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE) } } - .launchInUI() + .launchIn(activity.lifecycleScope) } fun onResume() {