mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Fix autotype #997
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
KeePassDX(2.10.2)
|
KeePassDX(2.10.2)
|
||||||
* Fix search fields references #987
|
* Fix search fields references #987
|
||||||
|
* Fix Auto-Types with same key #997
|
||||||
|
|
||||||
KeePassDX(2.10.1)
|
KeePassDX(2.10.1)
|
||||||
* Fix parcelable with custom data #986
|
* Fix parcelable with custom data #986
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ android {
|
|||||||
applicationId "com.kunzisoft.keepass"
|
applicationId "com.kunzisoft.keepass"
|
||||||
minSdkVersion 15
|
minSdkVersion 15
|
||||||
targetSdkVersion 30
|
targetSdkVersion 30
|
||||||
versionCode = 79
|
versionCode = 80
|
||||||
versionName = "2.10.2"
|
versionName = "2.10.2"
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,6 @@ package com.kunzisoft.keepass.database.element.entry
|
|||||||
|
|
||||||
import android.os.Parcel
|
import android.os.Parcel
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
|
|
||||||
import com.kunzisoft.keepass.utils.ParcelableUtil
|
|
||||||
import com.kunzisoft.keepass.utils.UnsignedInt
|
import com.kunzisoft.keepass.utils.UnsignedInt
|
||||||
|
|
||||||
class AutoType : Parcelable {
|
class AutoType : Parcelable {
|
||||||
@@ -30,7 +28,7 @@ class AutoType : Parcelable {
|
|||||||
var enabled = true
|
var enabled = true
|
||||||
var obfuscationOptions = OBF_OPT_NONE
|
var obfuscationOptions = OBF_OPT_NONE
|
||||||
var defaultSequence = ""
|
var defaultSequence = ""
|
||||||
private var windowSeqPairs = LinkedHashMap<String, String>()
|
private var windowSeqPairs = ArrayList<AutoTypeItem>()
|
||||||
|
|
||||||
constructor()
|
constructor()
|
||||||
|
|
||||||
@@ -38,16 +36,15 @@ class AutoType : Parcelable {
|
|||||||
this.enabled = autoType.enabled
|
this.enabled = autoType.enabled
|
||||||
this.obfuscationOptions = autoType.obfuscationOptions
|
this.obfuscationOptions = autoType.obfuscationOptions
|
||||||
this.defaultSequence = autoType.defaultSequence
|
this.defaultSequence = autoType.defaultSequence
|
||||||
for ((key, value) in autoType.windowSeqPairs) {
|
this.windowSeqPairs.clear()
|
||||||
this.windowSeqPairs[key] = value
|
this.windowSeqPairs.addAll(autoType.windowSeqPairs)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(parcel: Parcel) {
|
constructor(parcel: Parcel) {
|
||||||
this.enabled = parcel.readByte().toInt() != 0
|
this.enabled = parcel.readByte().toInt() != 0
|
||||||
this.obfuscationOptions = UnsignedInt(parcel.readInt())
|
this.obfuscationOptions = UnsignedInt(parcel.readInt())
|
||||||
this.defaultSequence = parcel.readString() ?: defaultSequence
|
this.defaultSequence = parcel.readString() ?: defaultSequence
|
||||||
this.windowSeqPairs = ParcelableUtil.readStringParcelableMap(parcel)
|
parcel.readTypedList(this.windowSeqPairs, AutoTypeItem.CREATOR)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun describeContents(): Int {
|
override fun describeContents(): Int {
|
||||||
@@ -58,15 +55,43 @@ class AutoType : Parcelable {
|
|||||||
dest.writeByte((if (enabled) 1 else 0).toByte())
|
dest.writeByte((if (enabled) 1 else 0).toByte())
|
||||||
dest.writeInt(obfuscationOptions.toKotlinInt())
|
dest.writeInt(obfuscationOptions.toKotlinInt())
|
||||||
dest.writeString(defaultSequence)
|
dest.writeString(defaultSequence)
|
||||||
ParcelableUtil.writeStringParcelableMap(dest, windowSeqPairs)
|
dest.writeTypedList(windowSeqPairs)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun put(key: String, value: String) {
|
fun add(key: String, value: String) {
|
||||||
windowSeqPairs[key] = value
|
windowSeqPairs.add(AutoTypeItem(key, value))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun entrySet(): Set<MutableMap.MutableEntry<String, String>> {
|
fun doForEachAutoTypeItem(action: (key: String, value: String) -> Unit) {
|
||||||
return windowSeqPairs.entries
|
windowSeqPairs.forEach {
|
||||||
|
action.invoke(it.key, it.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private data class AutoTypeItem(var key: String, var value: String): Parcelable {
|
||||||
|
constructor(parcel: Parcel) : this(
|
||||||
|
parcel.readString() ?: "",
|
||||||
|
parcel.readString() ?: "") {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun writeToParcel(parcel: Parcel, flags: Int) {
|
||||||
|
parcel.writeString(key)
|
||||||
|
parcel.writeString(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun describeContents(): Int {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object CREATOR : Parcelable.Creator<AutoTypeItem> {
|
||||||
|
override fun createFromParcel(parcel: Parcel): AutoTypeItem {
|
||||||
|
return AutoTypeItem(parcel)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun newArray(size: Int): Array<AutoTypeItem?> {
|
||||||
|
return arrayOfNulls(size)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ import com.kunzisoft.keepass.database.element.security.ProtectedString
|
|||||||
import com.kunzisoft.keepass.utils.ParcelableUtil
|
import com.kunzisoft.keepass.utils.ParcelableUtil
|
||||||
import com.kunzisoft.keepass.utils.UnsignedLong
|
import com.kunzisoft.keepass.utils.UnsignedLong
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import java.util.function.BiConsumer
|
|
||||||
import kotlin.collections.ArrayList
|
import kotlin.collections.ArrayList
|
||||||
import kotlin.collections.LinkedHashMap
|
import kotlin.collections.LinkedHashMap
|
||||||
|
|
||||||
@@ -239,7 +238,7 @@ class EntryKDBX : EntryVersioned<UUID, UUID, GroupKDBX, EntryKDBX>, NodeKDBXInte
|
|||||||
size += getAttachmentsSize(attachmentPool)
|
size += getAttachmentsSize(attachmentPool)
|
||||||
|
|
||||||
size += autoType.defaultSequence.length.toLong()
|
size += autoType.defaultSequence.length.toLong()
|
||||||
for ((key, value) in autoType.entrySet()) {
|
autoType.doForEachAutoTypeItem { key, value ->
|
||||||
size += key.length.toLong()
|
size += key.length.toLong()
|
||||||
size += value.length.toLong()
|
size += value.length.toLong()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -824,7 +824,7 @@ class DatabaseInputKDBX(cacheDirectory: File,
|
|||||||
return KdbContext.Entry
|
return KdbContext.Entry
|
||||||
} else if (ctx == KdbContext.EntryAutoTypeItem && name.equals(DatabaseKDBXXML.ElemAutoTypeItem, ignoreCase = true)) {
|
} else if (ctx == KdbContext.EntryAutoTypeItem && name.equals(DatabaseKDBXXML.ElemAutoTypeItem, ignoreCase = true)) {
|
||||||
if (ctxATName != null && ctxATSeq != null)
|
if (ctxATName != null && ctxATSeq != null)
|
||||||
ctxEntry?.autoType?.put(ctxATName!!, ctxATSeq!!)
|
ctxEntry?.autoType?.add(ctxATName!!, ctxATSeq!!)
|
||||||
ctxATName = null
|
ctxATName = null
|
||||||
ctxATSeq = null
|
ctxATSeq = null
|
||||||
|
|
||||||
|
|||||||
@@ -530,7 +530,7 @@ class DatabaseOutputKDBX(private val mDatabaseKDBX: DatabaseKDBX,
|
|||||||
writeString(DatabaseKDBXXML.ElemAutoTypeDefaultSeq, autoType.defaultSequence, true)
|
writeString(DatabaseKDBXXML.ElemAutoTypeDefaultSeq, autoType.defaultSequence, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
for ((key, value) in autoType.entrySet()) {
|
autoType.doForEachAutoTypeItem { key, value ->
|
||||||
xml.startTag(null, DatabaseKDBXXML.ElemAutoTypeItem)
|
xml.startTag(null, DatabaseKDBXXML.ElemAutoTypeItem)
|
||||||
|
|
||||||
xml.startTag(null, DatabaseKDBXXML.ElemWindow)
|
xml.startTag(null, DatabaseKDBXXML.ElemWindow)
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
* Fix search fields references #987
|
|
||||||
2
fastlane/metadata/android/en-US/changelogs/80.txt
Normal file
2
fastlane/metadata/android/en-US/changelogs/80.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
* Fix search fields references #987
|
||||||
|
* Fix Auto-Types with same key #997
|
||||||
@@ -1 +0,0 @@
|
|||||||
* Correction de la recherche des références de champs #987
|
|
||||||
2
fastlane/metadata/android/fr-FR/changelogs/80.txt
Normal file
2
fastlane/metadata/android/fr-FR/changelogs/80.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
* Correction de la recherche des références de champs #987
|
||||||
|
* Correction des Auto-Types avec la même clé #997
|
||||||
Reference in New Issue
Block a user