mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
fix: Multiple Passkey selection #2253
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
KeePassDX(4.2.3)
|
||||
* Fix multiple Passkey selection #2253
|
||||
|
||||
KeePassDX(4.2.2)
|
||||
* Fix database merge algorithm #2223
|
||||
* Fix save search info #2243
|
||||
|
||||
@@ -11,8 +11,8 @@ android {
|
||||
applicationId "com.kunzisoft.keepass"
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 35
|
||||
versionCode = 147
|
||||
versionName = "4.2.2"
|
||||
versionCode = 148
|
||||
versionName = "4.2.3"
|
||||
multiDexEnabled true
|
||||
|
||||
testApplicationId = "com.kunzisoft.keepass.tests"
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.kunzisoft.keepass.activities.legacy
|
||||
|
||||
import android.Manifest
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import androidx.activity.result.ActivityResultLauncher
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.activity.viewModels
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
@@ -16,6 +18,7 @@ import com.kunzisoft.keepass.R
|
||||
import com.kunzisoft.keepass.activities.dialogs.DatabaseChangedDialogFragment
|
||||
import com.kunzisoft.keepass.activities.dialogs.DatabaseChangedDialogFragment.Companion.DATABASE_CHANGED_DIALOG_TAG
|
||||
import com.kunzisoft.keepass.activities.stylish.StylishActivity
|
||||
import com.kunzisoft.keepass.credentialprovider.EntrySelectionHelper.setActivityResult
|
||||
import com.kunzisoft.keepass.database.ContextualDatabase
|
||||
import com.kunzisoft.keepass.database.DatabaseTaskProvider.Companion.startDatabaseService
|
||||
import com.kunzisoft.keepass.model.SnapFileDatabaseInfo
|
||||
@@ -54,18 +57,45 @@ abstract class DatabaseActivity : StylishActivity(), DatabaseRetrieval {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Useful to only waiting for the activity result and prevent any parallel action
|
||||
*/
|
||||
protected var mAllowViewModelAction = true
|
||||
|
||||
/**
|
||||
* Utility activity result launcher,
|
||||
* Used recursively, close each activity with return data
|
||||
*/
|
||||
protected open var mCredentialActivityResultLauncher: ActivityResultLauncher<Intent>? =
|
||||
registerForActivityResult(
|
||||
ActivityResultContracts.StartActivityForResult()
|
||||
) {
|
||||
setActivityResult(
|
||||
lockDatabase = false,
|
||||
resultCode = it.resultCode,
|
||||
data = it.data
|
||||
)
|
||||
}
|
||||
get() {
|
||||
// Prevent parallel action
|
||||
mAllowViewModelAction = false
|
||||
return field
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
lifecycleScope.launch {
|
||||
repeatOnLifecycle(Lifecycle.State.STARTED) {
|
||||
mDatabaseViewModel.actionState.collect { uiState ->
|
||||
if (mAllowViewModelAction) {
|
||||
when (uiState) {
|
||||
is DatabaseViewModel.ActionState.Loading -> {}
|
||||
is DatabaseViewModel.ActionState.Wait -> {}
|
||||
is DatabaseViewModel.ActionState.OnDatabaseReloaded -> {
|
||||
if (finishActivityIfReloadRequested()) {
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
is DatabaseViewModel.ActionState.OnDatabaseInfoChanged -> {
|
||||
if (manageDatabaseInfo()) {
|
||||
showDatabaseChangedDialog(
|
||||
@@ -75,21 +105,26 @@ abstract class DatabaseActivity : StylishActivity(), DatabaseRetrieval {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
is DatabaseViewModel.ActionState.OnDatabaseActionRequested -> {
|
||||
startDatabasePermissionService(
|
||||
uiState.bundle,
|
||||
uiState.actionTask
|
||||
)
|
||||
}
|
||||
|
||||
is DatabaseViewModel.ActionState.OnDatabaseActionStarted -> {
|
||||
progressTaskViewModel.start(uiState.progressMessage)
|
||||
}
|
||||
|
||||
is DatabaseViewModel.ActionState.OnDatabaseActionUpdated -> {
|
||||
progressTaskViewModel.update(uiState.progressMessage)
|
||||
}
|
||||
|
||||
is DatabaseViewModel.ActionState.OnDatabaseActionStopped -> {
|
||||
progressTaskViewModel.stop()
|
||||
}
|
||||
|
||||
is DatabaseViewModel.ActionState.OnDatabaseActionFinished -> {
|
||||
onDatabaseActionFinished(
|
||||
uiState.database,
|
||||
@@ -102,6 +137,7 @@ abstract class DatabaseActivity : StylishActivity(), DatabaseRetrieval {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
lifecycleScope.launch {
|
||||
repeatOnLifecycle(Lifecycle.State.RESUMED) {
|
||||
progressTaskViewModel.progressTaskState.collect { state ->
|
||||
@@ -117,6 +153,7 @@ abstract class DatabaseActivity : StylishActivity(), DatabaseRetrieval {
|
||||
lifecycleScope.launch {
|
||||
repeatOnLifecycle(Lifecycle.State.RESUMED) {
|
||||
mDatabaseViewModel.databaseState.collect { database ->
|
||||
if (mAllowViewModelAction) {
|
||||
// Nullable function
|
||||
onUnknownDatabaseRetrieved(database)
|
||||
database?.let {
|
||||
@@ -126,6 +163,7 @@ abstract class DatabaseActivity : StylishActivity(), DatabaseRetrieval {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Nullable function to retrieve a database
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
package com.kunzisoft.keepass.activities.legacy
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.Toast
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.activity.result.ActivityResultLauncher
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import com.kunzisoft.keepass.R
|
||||
import com.kunzisoft.keepass.credentialprovider.EntrySelectionHelper.isIntentSenderMode
|
||||
import com.kunzisoft.keepass.credentialprovider.EntrySelectionHelper.removeInfo
|
||||
@@ -15,7 +12,6 @@ import com.kunzisoft.keepass.credentialprovider.EntrySelectionHelper.retrieveReg
|
||||
import com.kunzisoft.keepass.credentialprovider.EntrySelectionHelper.retrieveSearchInfo
|
||||
import com.kunzisoft.keepass.credentialprovider.EntrySelectionHelper.retrieveSpecialMode
|
||||
import com.kunzisoft.keepass.credentialprovider.EntrySelectionHelper.retrieveTypeMode
|
||||
import com.kunzisoft.keepass.credentialprovider.EntrySelectionHelper.setActivityResult
|
||||
import com.kunzisoft.keepass.credentialprovider.SpecialMode
|
||||
import com.kunzisoft.keepass.credentialprovider.TypeMode
|
||||
import com.kunzisoft.keepass.model.RegisterInfo
|
||||
@@ -34,21 +30,6 @@ abstract class DatabaseModeActivity : DatabaseActivity() {
|
||||
|
||||
private var mToolbarSpecial: ToolbarSpecial? = null
|
||||
|
||||
/**
|
||||
* Utility activity result launcher,
|
||||
* Used recursively, close each activity with return data
|
||||
*/
|
||||
protected open var mCredentialActivityResultLauncher: ActivityResultLauncher<Intent>? =
|
||||
registerForActivityResult(
|
||||
ActivityResultContracts.StartActivityForResult()
|
||||
) {
|
||||
setActivityResult(
|
||||
lockDatabase = false,
|
||||
resultCode = it.resultCode,
|
||||
data = it.data
|
||||
)
|
||||
}
|
||||
|
||||
open fun onDatabaseBackPressed() {
|
||||
if (mSpecialMode != SpecialMode.DEFAULT)
|
||||
onCancelSpecialMode()
|
||||
|
||||
@@ -32,7 +32,7 @@ class DatabaseViewModel(application: Application): AndroidViewModel(application)
|
||||
val database: ContextualDatabase?
|
||||
get() = databaseState.value
|
||||
|
||||
private val mActionState = MutableStateFlow<ActionState>(ActionState.Loading)
|
||||
private val mActionState = MutableStateFlow<ActionState>(ActionState.Wait)
|
||||
val actionState: StateFlow<ActionState> = mActionState
|
||||
|
||||
private var mDatabaseTaskProvider: DatabaseTaskProvider = DatabaseTaskProvider(
|
||||
@@ -469,7 +469,7 @@ class DatabaseViewModel(application: Application): AndroidViewModel(application)
|
||||
}
|
||||
|
||||
sealed class ActionState {
|
||||
object Loading: ActionState()
|
||||
object Wait: ActionState()
|
||||
object OnDatabaseReloaded: ActionState()
|
||||
data class OnDatabaseActionRequested(
|
||||
val bundle: Bundle? = null,
|
||||
|
||||
1
fastlane/metadata/android/en-US/changelogs/148.txt
Normal file
1
fastlane/metadata/android/en-US/changelogs/148.txt
Normal file
@@ -0,0 +1 @@
|
||||
* Fix multiple Passkey selection #2253
|
||||
1
fastlane/metadata/android/fr-FR/changelogs/148.txt
Normal file
1
fastlane/metadata/android/fr-FR/changelogs/148.txt
Normal file
@@ -0,0 +1 @@
|
||||
* Correction de la selection multiple des Passkeys #2253
|
||||
Reference in New Issue
Block a user