mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-31 14:27:57 +01:00 
			
		
		
		
	Fix always-on app lock on cold start (#8018)
This commit is contained in:
		| @@ -172,6 +172,10 @@ class App : Application(), DefaultLifecycleObserver, ImageLoaderFactory { | ||||
|         }.build() | ||||
|     } | ||||
|  | ||||
|     override fun onCreate(owner: LifecycleOwner) { | ||||
|         SecureActivityDelegate.onApplicationCreated() | ||||
|     } | ||||
|  | ||||
|     override fun onStop(owner: LifecycleOwner) { | ||||
|         SecureActivityDelegate.onApplicationStopped() | ||||
|     } | ||||
|   | ||||
| @@ -23,6 +23,15 @@ interface SecureActivityDelegate { | ||||
|     fun registerSecureActivity(activity: AppCompatActivity) | ||||
|  | ||||
|     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() { | ||||
|             val preferences = Injekt.get<PreferencesHelper>() | ||||
|             if (!preferences.useAuthenticator().get()) return | ||||
|   | ||||
		Reference in New Issue
	
	Block a user