fix: Biometric error #2081

This commit is contained in:
J-Jamet
2025-07-24 19:41:28 +02:00
parent 809e1929e5
commit ac9bb9b666
2 changed files with 10 additions and 13 deletions

View File

@@ -20,14 +20,18 @@
package com.kunzisoft.keepass.biometric package com.kunzisoft.keepass.biometric
import android.app.Activity import android.app.Activity
import android.content.Context
import android.content.Intent import android.content.Intent
import android.net.Uri import android.net.Uri
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.provider.Settings import android.provider.Settings
import android.util.Log import android.util.Log
import android.view.* import android.view.LayoutInflater
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.result.contract.ActivityResultContracts
import androidx.annotation.RequiresApi import androidx.annotation.RequiresApi
import androidx.biometric.BiometricManager import androidx.biometric.BiometricManager
@@ -117,13 +121,6 @@ class AdvancedUnlockFragment: Fragment(), AdvancedUnlockManager.AdvancedUnlockCa
} }
} }
override fun onAttach(context: Context) {
super.onAttach(context)
mAdvancedUnlockEnabled = PreferencesUtil.isAdvancedUnlockEnable(context)
mAutoOpenPromptEnabled = PreferencesUtil.isAdvancedUnlockPromptAutoOpenEnable(context)
}
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)

View File

@@ -13,8 +13,8 @@ class AdvancedUnlockViewModel : ViewModel() {
var allowAutoOpenBiometricPrompt : Boolean = true var allowAutoOpenBiometricPrompt : Boolean = true
var deviceCredentialAuthSucceeded: Boolean? = null var deviceCredentialAuthSucceeded: Boolean? = null
private val _uiState = MutableStateFlow(DeviceUnlockUiStates()) private val _uiState = MutableStateFlow(DeviceUnlockState())
val uiState: StateFlow<DeviceUnlockUiStates> = _uiState val uiState: StateFlow<DeviceUnlockState> = _uiState
fun checkUnlockAvailability(conditionToStoreCredentialVerified: Boolean? = null) { fun checkUnlockAvailability(conditionToStoreCredentialVerified: Boolean? = null) {
_uiState.update { currentState -> _uiState.update { currentState ->
@@ -110,7 +110,7 @@ class AdvancedUnlockViewModel : ViewModel() {
} }
} }
data class DeviceUnlockUiStates( data class DeviceUnlockState(
val initAdvancedUnlockMode: Boolean = false, val initAdvancedUnlockMode: Boolean = false,
val databaseFileLoaded: Uri? = null, val databaseFileLoaded: Uri? = null,
val isCredentialRequired: Boolean = false, val isCredentialRequired: Boolean = false,
@@ -124,7 +124,7 @@ data class DeviceUnlockUiStates(
if (this === other) return true if (this === other) return true
if (javaClass != other?.javaClass) return false if (javaClass != other?.javaClass) return false
other as DeviceUnlockUiStates other as DeviceUnlockState
if (initAdvancedUnlockMode != other.initAdvancedUnlockMode) return false if (initAdvancedUnlockMode != other.initAdvancedUnlockMode) return false
if (isCredentialRequired != other.isCredentialRequired) return false if (isCredentialRequired != other.isCredentialRequired) return false