mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Merge branch 'release/4.1.5'
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
KeePassDX(4.1.4)
|
||||
* Fix auto prompt #2111
|
||||
|
||||
KeePassDX(4.1.4)
|
||||
* Fix UnlockManager #2098 #2101
|
||||
* Auto device unlock prompt #2105
|
||||
|
||||
@@ -11,8 +11,8 @@ android {
|
||||
applicationId "com.kunzisoft.keepass"
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 34
|
||||
versionCode = 136
|
||||
versionName = "4.1.4"
|
||||
versionCode = 137
|
||||
versionName = "4.1.5"
|
||||
multiDexEnabled true
|
||||
|
||||
testApplicationId = "com.kunzisoft.keepass.tests"
|
||||
|
||||
@@ -51,7 +51,6 @@ import com.kunzisoft.keepass.activities.dialogs.DuplicateUuidDialog
|
||||
import com.kunzisoft.keepass.activities.helpers.EntrySelectionHelper
|
||||
import com.kunzisoft.keepass.activities.helpers.ExternalFileHelper
|
||||
import com.kunzisoft.keepass.activities.helpers.SpecialMode
|
||||
import com.kunzisoft.keepass.activities.legacy.DatabaseLockActivity.Companion.UI_VISIBLE_DURING_LOCK
|
||||
import com.kunzisoft.keepass.activities.legacy.DatabaseModeActivity
|
||||
import com.kunzisoft.keepass.autofill.AutofillComponent
|
||||
import com.kunzisoft.keepass.autofill.AutofillHelper
|
||||
@@ -87,7 +86,6 @@ import com.kunzisoft.keepass.view.MainCredentialView
|
||||
import com.kunzisoft.keepass.view.asError
|
||||
import com.kunzisoft.keepass.view.showActionErrorIfNeeded
|
||||
import com.kunzisoft.keepass.viewmodels.DatabaseFileViewModel
|
||||
import com.kunzisoft.keepass.viewmodels.DeviceUnlockState
|
||||
import com.kunzisoft.keepass.viewmodels.DeviceUnlockViewModel
|
||||
import kotlinx.coroutines.launch
|
||||
import java.io.FileNotFoundException
|
||||
@@ -416,7 +414,6 @@ class MainCredentialActivity : DatabaseModeActivity() {
|
||||
private fun launchGroupActivityIfLoaded(database: ContextualDatabase) {
|
||||
// Check if database really loaded
|
||||
if (database.loaded) {
|
||||
mDeviceUnlockViewModel.allowAutoOpenBiometricPrompt = true
|
||||
clearCredentialsViews(clearKeyFile = true, clearHardwareKey = true)
|
||||
GroupActivity.launch(this,
|
||||
database,
|
||||
@@ -537,12 +534,6 @@ class MainCredentialActivity : DatabaseModeActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
// Reinit locking activity UI variable
|
||||
UI_VISIBLE_DURING_LOCK = false
|
||||
super.onPause()
|
||||
}
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
outState.putBoolean(KEY_READ_ONLY, mReadOnly)
|
||||
super.onSaveInstanceState(outState)
|
||||
|
||||
@@ -53,6 +53,7 @@ import com.kunzisoft.keepass.utils.closeDatabase
|
||||
import com.kunzisoft.keepass.utils.registerLockReceiver
|
||||
import com.kunzisoft.keepass.utils.unregisterLockReceiver
|
||||
import com.kunzisoft.keepass.view.showActionErrorIfNeeded
|
||||
import com.kunzisoft.keepass.viewmodels.DeviceUnlockViewModel.Companion.isAutoOpenBiometricPromptAllowed
|
||||
import com.kunzisoft.keepass.viewmodels.NodesViewModel
|
||||
import java.util.UUID
|
||||
|
||||
@@ -70,6 +71,8 @@ abstract class DatabaseLockActivity : DatabaseModeActivity(),
|
||||
protected var mMergeDataAllowed: Boolean = false
|
||||
private var mAutoSaveEnable: Boolean = true
|
||||
|
||||
private var isDatabaseUiVisible: Boolean = false
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
@@ -188,7 +191,8 @@ abstract class DatabaseLockActivity : DatabaseModeActivity(),
|
||||
mLockReceiver = LockReceiver {
|
||||
mDatabase = null
|
||||
closeDatabase(database)
|
||||
UI_VISIBLE_DURING_LOCK = UI_VISIBLE
|
||||
// Don't allow auto open prompt if lock become when UI visible
|
||||
isAutoOpenBiometricPromptAllowed = !isDatabaseUiVisible
|
||||
mExitLock = true
|
||||
closeOptionsMenu()
|
||||
finish()
|
||||
@@ -417,7 +421,7 @@ abstract class DatabaseLockActivity : DatabaseModeActivity(),
|
||||
|
||||
invalidateOptionsMenu()
|
||||
|
||||
UI_VISIBLE = true
|
||||
isDatabaseUiVisible = true
|
||||
}
|
||||
|
||||
protected fun checkTimeAndLockIfTimeoutOrResetTimeout(action: (() -> Unit)? = null) {
|
||||
@@ -432,7 +436,7 @@ abstract class DatabaseLockActivity : DatabaseModeActivity(),
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
UI_VISIBLE = false
|
||||
isDatabaseUiVisible = false
|
||||
|
||||
super.onPause()
|
||||
|
||||
@@ -483,9 +487,6 @@ abstract class DatabaseLockActivity : DatabaseModeActivity(),
|
||||
|
||||
const val TIMEOUT_ENABLE_KEY = "TIMEOUT_ENABLE_KEY"
|
||||
const val TIMEOUT_ENABLE_KEY_DEFAULT = true
|
||||
|
||||
var UI_VISIBLE: Boolean = false
|
||||
var UI_VISIBLE_DURING_LOCK: Boolean = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@ import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.lifecycle.repeatOnLifecycle
|
||||
import com.kunzisoft.keepass.R
|
||||
import com.kunzisoft.keepass.activities.legacy.DatabaseLockActivity.Companion.UI_VISIBLE_DURING_LOCK
|
||||
import com.kunzisoft.keepass.view.DeviceUnlockView
|
||||
import com.kunzisoft.keepass.view.hideByFading
|
||||
import com.kunzisoft.keepass.view.showByFading
|
||||
@@ -71,7 +70,7 @@ class DeviceUnlockFragment: Fragment() {
|
||||
ActivityResultContracts.StartActivityForResult()
|
||||
) { result ->
|
||||
if (result.resultCode == Activity.RESULT_OK) {
|
||||
mDeviceUnlockViewModel.onAuthenticationSucceeded(result)
|
||||
mDeviceUnlockViewModel.onAuthenticationSucceeded()
|
||||
} else {
|
||||
setAuthenticationFailed()
|
||||
}
|
||||
@@ -146,12 +145,6 @@ class DeviceUnlockFragment: Fragment() {
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
|
||||
// Don't allow auto open prompt if lock become when UI visible
|
||||
if (UI_VISIBLE_DURING_LOCK) {
|
||||
mDeviceUnlockViewModel.allowAutoOpenBiometricPrompt = false
|
||||
}
|
||||
|
||||
mDeviceUnlockViewModel.checkUnlockAvailability()
|
||||
}
|
||||
|
||||
@@ -305,10 +298,8 @@ class DeviceUnlockFragment: Fragment() {
|
||||
lifecycleScope.launch(Dispatchers.Main) {
|
||||
showViews(true)
|
||||
setAdvancedUnlockedTitleView(R.string.unlock_and_link_biometric)
|
||||
context?.let { context ->
|
||||
mDeviceUnlockView?.setDeviceUnlockButtonViewClickListener { view ->
|
||||
mDeviceUnlockViewModel.showPrompt()
|
||||
}
|
||||
mDeviceUnlockView?.setDeviceUnlockButtonViewClickListener { _ ->
|
||||
mDeviceUnlockViewModel.showPrompt()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -317,10 +308,8 @@ class DeviceUnlockFragment: Fragment() {
|
||||
lifecycleScope.launch(Dispatchers.Main) {
|
||||
showViews(true)
|
||||
setAdvancedUnlockedTitleView(R.string.unlock)
|
||||
context?.let { context ->
|
||||
mDeviceUnlockView?.setDeviceUnlockButtonViewClickListener { view ->
|
||||
mDeviceUnlockViewModel.showPrompt()
|
||||
}
|
||||
mDeviceUnlockView?.setDeviceUnlockButtonViewClickListener { _ ->
|
||||
mDeviceUnlockViewModel.showPrompt()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,9 +24,6 @@ import kotlinx.coroutines.flow.update
|
||||
import javax.crypto.Cipher
|
||||
|
||||
class DeviceUnlockViewModel(application: Application): AndroidViewModel(application) {
|
||||
|
||||
var allowAutoOpenBiometricPrompt : Boolean = true
|
||||
|
||||
private var cipherDatabaseListener: CipherDatabaseAction.CipherDatabaseListener? = null
|
||||
|
||||
private var isConditionToStoreCredentialVerified: Boolean = false
|
||||
@@ -155,9 +152,7 @@ class DeviceUnlockViewModel(application: Application): AndroidViewModel(applicat
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
fun onAuthenticationSucceeded(
|
||||
activityResult: ActivityResult
|
||||
) {
|
||||
fun onAuthenticationSucceeded() {
|
||||
cryptoPrompt?.let { prompt ->
|
||||
when (prompt.type) {
|
||||
DeviceUnlockCryptoPromptType.CREDENTIAL_ENCRYPTION ->
|
||||
@@ -306,7 +301,7 @@ class DeviceUnlockViewModel(application: Application): AndroidViewModel(applicat
|
||||
}
|
||||
|
||||
fun promptShown() {
|
||||
allowAutoOpenBiometricPrompt = false
|
||||
isAutoOpenBiometricPromptAllowed = false
|
||||
_uiState.update { currentState ->
|
||||
currentState.copy(
|
||||
cryptoPromptState = DeviceUnlockPromptMode.IDLE
|
||||
@@ -348,7 +343,10 @@ class DeviceUnlockViewModel(application: Application): AndroidViewModel(applicat
|
||||
cipherDatabase?.let {
|
||||
try {
|
||||
deviceUnlockManager?.initDecryptData(cipherDatabase.specParameters) { cryptoPrompt ->
|
||||
onPromptRequested(cryptoPrompt, autoOpen = allowAutoOpenBiometricPrompt)
|
||||
onPromptRequested(
|
||||
cryptoPrompt,
|
||||
autoOpen = isAutoOpenBiometricPromptAllowed
|
||||
)
|
||||
} ?: setException(Exception("AdvancedUnlockManager not initialized"))
|
||||
} catch (e: Exception) {
|
||||
setException(e)
|
||||
@@ -417,6 +415,10 @@ class DeviceUnlockViewModel(application: Application): AndroidViewModel(applicat
|
||||
deviceUnlockManager = null
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
var isAutoOpenBiometricPromptAllowed = true
|
||||
}
|
||||
}
|
||||
|
||||
enum class DeviceUnlockPromptMode {
|
||||
|
||||
1
fastlane/metadata/android/en-US/changelogs/137.txt
Normal file
1
fastlane/metadata/android/en-US/changelogs/137.txt
Normal file
@@ -0,0 +1 @@
|
||||
* Fix auto prompt #2111
|
||||
1
fastlane/metadata/android/fr-FR/changelogs/137.txt
Normal file
1
fastlane/metadata/android/fr-FR/changelogs/137.txt
Normal file
@@ -0,0 +1 @@
|
||||
* Correction invite de commande auto #2111
|
||||
Reference in New Issue
Block a user