mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
fix: Multiple validation
This commit is contained in:
@@ -6,7 +6,7 @@ KeePassDX(4.2.0)
|
|||||||
* Change Passkey Backup Eligibility & Backup State #2135 #2150
|
* Change Passkey Backup Eligibility & Backup State #2135 #2150
|
||||||
* Search settings #2112 #2181 #2187
|
* Search settings #2112 #2181 #2187
|
||||||
* Autofill refactoring #765 #2196
|
* Autofill refactoring #765 #2196
|
||||||
* Small fixes #2157 #2164 #2171 #2122 #2180
|
* Small fixes #2157 #2164 #2171 #2122 #2180 #2209
|
||||||
|
|
||||||
KeePassDX(4.1.9)
|
KeePassDX(4.1.9)
|
||||||
* Fix landscape UI #2198 #2200 (@chenxiaolong)
|
* Fix landscape UI #2198 #2200 (@chenxiaolong)
|
||||||
|
|||||||
@@ -461,6 +461,7 @@ class EntryEditActivity : DatabaseLockActivity(),
|
|||||||
result: ActionRunnable.Result
|
result: ActionRunnable.Result
|
||||||
) {
|
) {
|
||||||
super.onDatabaseActionFinished(database, actionTask, result)
|
super.onDatabaseActionFinished(database, actionTask, result)
|
||||||
|
mEntryEditViewModel.unlockAction()
|
||||||
when (actionTask) {
|
when (actionTask) {
|
||||||
ACTION_DATABASE_CREATE_ENTRY_TASK,
|
ACTION_DATABASE_CREATE_ENTRY_TASK,
|
||||||
ACTION_DATABASE_UPDATE_ENTRY_TASK -> {
|
ACTION_DATABASE_UPDATE_ENTRY_TASK -> {
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ class EntryEditViewModel: NodeEditViewModel() {
|
|||||||
var backPressedAlreadyApproved = false
|
var backPressedAlreadyApproved = false
|
||||||
var warningOverwriteDataAlreadyApproved = false
|
var warningOverwriteDataAlreadyApproved = false
|
||||||
|
|
||||||
|
// Useful to not relaunch a current action
|
||||||
|
private var actionLocked: Boolean = false
|
||||||
|
|
||||||
val templatesEntry : LiveData<TemplatesEntry?> get() = _templatesEntry
|
val templatesEntry : LiveData<TemplatesEntry?> get() = _templatesEntry
|
||||||
private val _templatesEntry = MutableLiveData<TemplatesEntry?>()
|
private val _templatesEntry = MutableLiveData<TemplatesEntry?>()
|
||||||
|
|
||||||
@@ -213,45 +216,52 @@ class EntryEditViewModel: NodeEditViewModel() {
|
|||||||
_requestEntryInfoUpdate.value = EntryUpdate(database, mEntry, mParent)
|
_requestEntryInfoUpdate.value = EntryUpdate(database, mEntry, mParent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun unlockAction() {
|
||||||
|
actionLocked = false
|
||||||
|
}
|
||||||
|
|
||||||
fun saveEntryInfo(database: ContextualDatabase?, entry: Entry?, parent: Group?, entryInfo: EntryInfo) {
|
fun saveEntryInfo(database: ContextualDatabase?, entry: Entry?, parent: Group?, entryInfo: EntryInfo) {
|
||||||
IOActionTask(
|
if (actionLocked.not()) {
|
||||||
scope = viewModelScope,
|
actionLocked = true
|
||||||
action = {
|
IOActionTask(
|
||||||
removeTempAttachmentsNotCompleted(entryInfo)
|
scope = viewModelScope,
|
||||||
entry?.let { oldEntry ->
|
action = {
|
||||||
// Create a clone
|
removeTempAttachmentsNotCompleted(entryInfo)
|
||||||
var newEntry = Entry(oldEntry)
|
entry?.let { oldEntry ->
|
||||||
|
// Create a clone
|
||||||
|
var newEntry = Entry(oldEntry)
|
||||||
|
|
||||||
// Build info
|
// Build info
|
||||||
newEntry.setEntryInfo(database, entryInfo)
|
newEntry.setEntryInfo(database, entryInfo)
|
||||||
|
|
||||||
// Encode entry properties for template
|
// Encode entry properties for template
|
||||||
_onTemplateChanged.value?.let { template ->
|
_onTemplateChanged.value?.let { template ->
|
||||||
newEntry =
|
newEntry =
|
||||||
database?.encodeEntryWithTemplateConfiguration(newEntry, template)
|
database?.encodeEntryWithTemplateConfiguration(newEntry, template)
|
||||||
?: newEntry
|
?: newEntry
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete temp attachment if not used
|
// Delete temp attachment if not used
|
||||||
mTempAttachments.forEach { tempAttachmentState ->
|
mTempAttachments.forEach { tempAttachmentState ->
|
||||||
val tempAttachment = tempAttachmentState.attachment
|
val tempAttachment = tempAttachmentState.attachment
|
||||||
database?.attachmentPool?.let { binaryPool ->
|
database?.attachmentPool?.let { binaryPool ->
|
||||||
if (!newEntry.getAttachments(binaryPool).contains(tempAttachment)) {
|
if (!newEntry.getAttachments(binaryPool).contains(tempAttachment)) {
|
||||||
database.removeAttachmentIfNotUsed(tempAttachment)
|
database.removeAttachmentIfNotUsed(tempAttachment)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Return entry to save
|
// Return entry to save
|
||||||
EntrySave(oldEntry, newEntry, parent)
|
EntrySave(oldEntry, newEntry, parent)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onActionComplete = { entrySave ->
|
||||||
|
entrySave?.let {
|
||||||
|
_onEntrySaved.value = it
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
).execute()
|
||||||
onActionComplete = { entrySave ->
|
}
|
||||||
entrySave?.let {
|
|
||||||
_onEntrySaved.value = it
|
|
||||||
}
|
|
||||||
}
|
|
||||||
).execute()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun removeTempAttachmentsNotCompleted(entryInfo: EntryInfo) {
|
private fun removeTempAttachmentsNotCompleted(entryInfo: EntryInfo) {
|
||||||
|
|||||||
@@ -3,4 +3,4 @@
|
|||||||
* Setting to close database after a Passkey selection #2187
|
* Setting to close database after a Passkey selection #2187
|
||||||
* Warning when overwriting existing Passkey #2124
|
* Warning when overwriting existing Passkey #2124
|
||||||
* Autofill refactoring #765 #2196
|
* Autofill refactoring #765 #2196
|
||||||
* Small fixes #2171 #2150 #2159 #2122 #2180
|
* Small fixes #2171 #2150 #2159 #2122 #2180 #2209
|
||||||
@@ -3,4 +3,4 @@
|
|||||||
* Paramètre de fermeture de la base après une sélection de Passkey #2187
|
* Paramètre de fermeture de la base après une sélection de Passkey #2187
|
||||||
* Mise en garde lors de l'écrasement d'un Passkey existant #21124
|
* Mise en garde lors de l'écrasement d'un Passkey existant #21124
|
||||||
* Refonte du remplissage automatique #765 #2196
|
* Refonte du remplissage automatique #765 #2196
|
||||||
* Petites corrections #2171 #2150 #2159 #2122 #2180
|
* Petites corrections #2171 #2150 #2159 #2122 #2180 #2209
|
||||||
Reference in New Issue
Block a user