mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
fix: AutoSearch
This commit is contained in:
@@ -1912,7 +1912,8 @@ class GroupActivity : DatabaseLockActivity(),
|
||||
context = activity,
|
||||
database = database,
|
||||
searchInfo = searchInfo,
|
||||
activityResultLauncher = activityResultLauncher
|
||||
activityResultLauncher = activityResultLauncher,
|
||||
autoSearch = true
|
||||
)
|
||||
onLaunchActivitySpecialMode()
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ class PasskeyLauncherActivity : DatabaseModeActivity() {
|
||||
database = openedDatabase,
|
||||
activityResultLauncher = mPasskeySelectionActivityResultLauncher,
|
||||
searchInfo = null,
|
||||
autoSearch = true
|
||||
autoSearch = false
|
||||
)
|
||||
},
|
||||
onDatabaseClosed = {
|
||||
|
||||
@@ -86,24 +86,7 @@ class PasskeyProviderService : CredentialProviderService() {
|
||||
|
||||
private fun buildPasskeySearchInfo(relyingParty: String): SearchInfo {
|
||||
return SearchInfo().apply {
|
||||
webDomain = relyingParty
|
||||
searchParameters.apply {
|
||||
allowEmptyQuery = false
|
||||
searchInTitles = false
|
||||
searchInUsernames = false
|
||||
searchInPasswords = false
|
||||
searchInUrls = true
|
||||
searchInNotes = false
|
||||
searchInOTP = false
|
||||
searchParameters.searchInRelyingParty = true
|
||||
searchInOther = false
|
||||
searchInUUIDs = false
|
||||
searchInTags = false
|
||||
searchInCurrentGroup = false
|
||||
searchInSearchableGroup = true
|
||||
searchInRecycleBin = false
|
||||
searchInTemplates = false
|
||||
}
|
||||
this.relyingParty = relyingParty
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -891,7 +891,7 @@ open class Database {
|
||||
): Group? {
|
||||
return mSearchHelper.createVirtualGroupWithSearchResult(
|
||||
database = this,
|
||||
searchParameters = searchInfo.searchParameters,
|
||||
searchParameters = searchInfo.buildSearchParameters(),
|
||||
fromGroup = null,
|
||||
max = max
|
||||
)
|
||||
|
||||
@@ -35,10 +35,9 @@ class SearchInfo : ObjectNameResource, Parcelable {
|
||||
get() {
|
||||
return if (webDomain == null) null else field
|
||||
}
|
||||
var relyingParty: String? = null
|
||||
var otpString: String? = null
|
||||
|
||||
var searchParameters: SearchParameters = buildSearchParameters()
|
||||
|
||||
constructor()
|
||||
|
||||
constructor(toCopy: SearchInfo?) {
|
||||
@@ -47,6 +46,7 @@ class SearchInfo : ObjectNameResource, Parcelable {
|
||||
applicationId = toCopy?.applicationId
|
||||
webDomain = toCopy?.webDomain
|
||||
webScheme = toCopy?.webScheme
|
||||
relyingParty = toCopy?.relyingParty
|
||||
otpString = toCopy?.otpString
|
||||
}
|
||||
|
||||
@@ -60,6 +60,8 @@ class SearchInfo : ObjectNameResource, Parcelable {
|
||||
webDomain = if (readDomain.isNullOrEmpty()) null else readDomain
|
||||
val readScheme = parcel.readString()
|
||||
webScheme = if (readScheme.isNullOrEmpty()) null else readScheme
|
||||
val readRelyingParty = parcel.readString()
|
||||
relyingParty = if (readRelyingParty.isNullOrEmpty()) null else readRelyingParty
|
||||
val readOtp = parcel.readString()
|
||||
otpString = if (readOtp.isNullOrEmpty()) null else readOtp
|
||||
}
|
||||
@@ -74,6 +76,7 @@ class SearchInfo : ObjectNameResource, Parcelable {
|
||||
parcel.writeString(applicationId ?: "")
|
||||
parcel.writeString(webDomain ?: "")
|
||||
parcel.writeString(webScheme ?: "")
|
||||
parcel.writeString(relyingParty ?: "")
|
||||
parcel.writeString(otpString ?: "")
|
||||
}
|
||||
|
||||
@@ -91,27 +94,33 @@ class SearchInfo : ObjectNameResource, Parcelable {
|
||||
&& applicationId == null
|
||||
&& webDomain == null
|
||||
&& webScheme == null
|
||||
&& relyingParty == null
|
||||
&& otpString == null
|
||||
}
|
||||
|
||||
private fun isASearchByDomain(): Boolean {
|
||||
private fun isADomainSearch(): Boolean {
|
||||
return toString() == webDomain && webDomain != null
|
||||
}
|
||||
|
||||
private fun buildSearchParameters(): SearchParameters {
|
||||
private fun isAPasskeySearch(): Boolean {
|
||||
return toString() == relyingParty && relyingParty != null
|
||||
}
|
||||
|
||||
fun buildSearchParameters(): SearchParameters {
|
||||
return SearchParameters().apply {
|
||||
searchQuery = toString()
|
||||
searchQuery = this@SearchInfo.toString()
|
||||
allowEmptyQuery = false
|
||||
searchInTitles = true
|
||||
searchInTitles = !isAPasskeySearch()
|
||||
searchInUsernames = false
|
||||
searchInPasswords = false
|
||||
searchInUrls = true
|
||||
searchByDomain = isASearchByDomain()
|
||||
searchInNotes = true
|
||||
searchInUrls = !isAPasskeySearch()
|
||||
searchByDomain = isADomainSearch()
|
||||
searchInNotes = false
|
||||
searchInOTP = false
|
||||
searchInOther = true
|
||||
searchInUUIDs = false
|
||||
searchInTags = false
|
||||
searchInRelyingParty = isAPasskeySearch()
|
||||
searchInCurrentGroup = false
|
||||
searchInSearchableGroup = true
|
||||
searchInRecycleBin = false
|
||||
@@ -128,6 +137,7 @@ class SearchInfo : ObjectNameResource, Parcelable {
|
||||
if (applicationId != other.applicationId) return false
|
||||
if (webDomain != other.webDomain) return false
|
||||
if (webScheme != other.webScheme) return false
|
||||
if (relyingParty != other.relyingParty) return false
|
||||
if (otpString != other.otpString) return false
|
||||
|
||||
return true
|
||||
@@ -139,12 +149,13 @@ class SearchInfo : ObjectNameResource, Parcelable {
|
||||
result = 31 * result + (applicationId?.hashCode() ?: 0)
|
||||
result = 31 * result + (webDomain?.hashCode() ?: 0)
|
||||
result = 31 * result + (webScheme?.hashCode() ?: 0)
|
||||
result = 31 * result + (relyingParty?.hashCode() ?: 0)
|
||||
result = 31 * result + (otpString?.hashCode() ?: 0)
|
||||
return result
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return otpString ?: webDomain ?: applicationId ?: tag ?: ""
|
||||
return otpString ?: webDomain ?: applicationId ?: relyingParty ?: tag ?: ""
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
Reference in New Issue
Block a user