Enable secure screen when incognito mode is enabled (#5339)
* Enable secure screen when incognito mode is enabled * Fix incognito banner not showing up after configuration changes
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
package eu.kanade.tachiyomi.ui.security
|
||||
|
||||
import android.content.Intent
|
||||
import android.view.WindowManager
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.util.system.AuthenticatorUtil
|
||||
import eu.kanade.tachiyomi.util.view.setSecureScreen
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
@@ -17,13 +17,7 @@ class SecureActivityDelegate(private val activity: FragmentActivity) {
|
||||
|
||||
fun onCreate() {
|
||||
preferences.secureScreen().asFlow()
|
||||
.onEach {
|
||||
if (it) {
|
||||
activity.window.setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE)
|
||||
} else {
|
||||
activity.window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE)
|
||||
}
|
||||
}
|
||||
.onEach { activity.window.setSecureScreen(it || preferences.incognitoMode().get()) }
|
||||
.launchIn(activity.lifecycleScope)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user