mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
fix: refresh when activate setting
This commit is contained in:
@@ -172,6 +172,7 @@ class DeviceUnlockFragment: Fragment() {
|
|||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
|
mDeviceUnlockViewModel.checkUnlockAvailability()
|
||||||
keepConnection = false
|
keepConnection = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,12 +45,11 @@ class DeviceUnlockViewModel(application: Application): AndroidViewModel(applicat
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check unlock availability and change the current mode depending of device's state
|
* Check unlock availability by verifying device settings and database mode
|
||||||
*/
|
*/
|
||||||
fun checkUnlockAvailability(databaseFileUri: Uri?) {
|
fun checkUnlockAvailability() {
|
||||||
databaseUri = databaseFileUri
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
cipherDatabaseAction.containsCipherDatabase(databaseFileUri) { containsCipherDatabase ->
|
cipherDatabaseAction.containsCipherDatabase(databaseUri) { containsCipherDatabase ->
|
||||||
if (PreferencesUtil.isBiometricUnlockEnable(getApplication())) {
|
if (PreferencesUtil.isBiometricUnlockEnable(getApplication())) {
|
||||||
// biometric not supported (by API level or hardware) so keep option hidden
|
// biometric not supported (by API level or hardware) so keep option hidden
|
||||||
// or manually disable
|
// or manually disable
|
||||||
@@ -80,6 +79,14 @@ class DeviceUnlockViewModel(application: Application): AndroidViewModel(applicat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check unlock availability and change the current mode depending of device's state
|
||||||
|
*/
|
||||||
|
fun checkUnlockAvailability(databaseFileUri: Uri?) {
|
||||||
|
databaseUri = databaseFileUri
|
||||||
|
checkUnlockAvailability()
|
||||||
|
}
|
||||||
|
|
||||||
private fun isModeChanging(newMode: DeviceUnlockMode): Boolean {
|
private fun isModeChanging(newMode: DeviceUnlockMode): Boolean {
|
||||||
return _uiState.value.deviceUnlockMode != newMode
|
return _uiState.value.deviceUnlockMode != newMode
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user