mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-29 05:33:21 -05:00
Fix always-on app lock on cold start (#8018)
This commit is contained in:
parent
4ea512f6c2
commit
ec30026333
2 changed files with 13 additions and 0 deletions
|
@ -172,6 +172,10 @@ class App : Application(), DefaultLifecycleObserver, ImageLoaderFactory {
|
||||||
}.build()
|
}.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onCreate(owner: LifecycleOwner) {
|
||||||
|
SecureActivityDelegate.onApplicationCreated()
|
||||||
|
}
|
||||||
|
|
||||||
override fun onStop(owner: LifecycleOwner) {
|
override fun onStop(owner: LifecycleOwner) {
|
||||||
SecureActivityDelegate.onApplicationStopped()
|
SecureActivityDelegate.onApplicationStopped()
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,15 @@ interface SecureActivityDelegate {
|
||||||
fun registerSecureActivity(activity: AppCompatActivity)
|
fun registerSecureActivity(activity: AppCompatActivity)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
fun onApplicationCreated() {
|
||||||
|
val lockDelay = Injekt.get<PreferencesHelper>().lockAppAfter().get()
|
||||||
|
if (lockDelay == 0) {
|
||||||
|
// Restore always active app lock
|
||||||
|
// Delayed lock will be restored later on activity resume
|
||||||
|
lockState = LockState.ACTIVE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun onApplicationStopped() {
|
fun onApplicationStopped() {
|
||||||
val preferences = Injekt.get<PreferencesHelper>()
|
val preferences = Injekt.get<PreferencesHelper>()
|
||||||
if (!preferences.useAuthenticator().get()) return
|
if (!preferences.useAuthenticator().get()) return
|
||||||
|
|
Loading…
Reference in a new issue