Extension function instead of redefining uiScope everywhere
This commit is contained in:
@@ -5,10 +5,8 @@ import android.view.WindowManager
|
||||
import androidx.biometric.BiometricManager
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.util.lang.launchInUI
|
||||
import java.util.Date
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
@@ -16,8 +14,6 @@ class SecureActivityDelegate(private val activity: FragmentActivity) {
|
||||
|
||||
private val preferences by injectLazy<PreferencesHelper>()
|
||||
|
||||
private val uiScope = CoroutineScope(Dispatchers.Main)
|
||||
|
||||
fun onCreate() {
|
||||
preferences.secureScreen().asFlow()
|
||||
.onEach {
|
||||
@@ -27,7 +23,7 @@ class SecureActivityDelegate(private val activity: FragmentActivity) {
|
||||
activity.window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE)
|
||||
}
|
||||
}
|
||||
.launchIn(uiScope)
|
||||
.launchInUI()
|
||||
}
|
||||
|
||||
fun onResume() {
|
||||
|
||||
Reference in New Issue
Block a user