mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2026-11-30 13:52:58 -08:00
Add only the current app id in blocklist
This commit is contained in:
1 parent
bd9f2c4757
commit
b1b92b2995
3 files changed
+15
-9
No files matched your search
@@ -20,8 +20,10 @@
|
||||
package com.kunzisoft.keepass.settings
|
||||
|
||||
import android.content.Context
|
||||
import android.content.res.Resources
|
||||
import android.net.Uri
|
||||
import androidx.preference.PreferenceManager
|
||||
import com.kunzisoft.keepass.BuildConfig
|
||||
import com.kunzisoft.keepass.R
|
||||
import com.kunzisoft.keepass.database.element.SortNodeEnum
|
||||
import com.kunzisoft.keepass.timeout.TimeoutHelper
|
||||
@@ -373,10 +375,20 @@ object PreferencesUtil {
|
||||
context.resources.getBoolean(R.bool.autofill_auto_search_default))
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the default Blocklist for application ID, including the current app
|
||||
*/
|
||||
fun getDefaultApplicationIdBlocklist(resources: Resources?): Set<String> {
|
||||
return resources?.getStringArray(R.array.autofill_application_id_blocklist_default)
|
||||
?.toMutableSet()?.apply {
|
||||
add(BuildConfig.APPLICATION_ID)
|
||||
} ?: emptySet()
|
||||
}
|
||||
|
||||
fun applicationIdBlocklist(context: Context): Set<String> {
|
||||
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
return prefs.getStringSet(context.getString(R.string.autofill_application_id_blocklist_key),
|
||||
context.resources.getStringArray(R.array.autofill_application_id_blocklist_default).toMutableSet())
|
||||
getDefaultApplicationIdBlocklist(context.resources))
|
||||
?: emptySet()
|
||||
}
|
||||
|
||||
|
||||
+2
-5
@@ -20,8 +20,8 @@
|
||||
package com.kunzisoft.keepass.settings.preferencedialogfragment
|
||||
|
||||
import android.os.Bundle
|
||||
import com.kunzisoft.keepass.R
|
||||
import com.kunzisoft.keepass.model.SearchInfo
|
||||
import com.kunzisoft.keepass.settings.PreferencesUtil
|
||||
|
||||
class AutofillBlocklistAppIdPreferenceDialogFragmentCompat
|
||||
: AutofillBlocklistPreferenceDialogFragmentCompat() {
|
||||
@@ -34,10 +34,7 @@ class AutofillBlocklistAppIdPreferenceDialogFragmentCompat
|
||||
}
|
||||
|
||||
override fun getDefaultValues(): Set<String> {
|
||||
return context?.resources
|
||||
?.getStringArray(R.array.autofill_application_id_blocklist_default)
|
||||
?.toMutableSet()
|
||||
?: emptySet()
|
||||
return PreferencesUtil.getDefaultApplicationIdBlocklist(this.resources)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -136,9 +136,6 @@
|
||||
<bool name="autofill_auto_search_default" translatable="false">true</bool>
|
||||
<string name="autofill_application_id_blocklist_key" translatable="false">autofill_application_id_blocklist_key</string>
|
||||
<string-array name="autofill_application_id_blocklist_default">
|
||||
<item translatable="false">com.kunzisoft.keepass.libre</item>
|
||||
<item translatable="false">com.kunzisoft.keepass.free</item>
|
||||
<item translatable="false">com.kunzisoft.keepass.pro</item>
|
||||
</string-array>
|
||||
<string name="autofill_web_domain_blocklist_key" translatable="false">autofill_web_domain_blocklist_key</string>
|
||||
<string-array name="autofill_web_domain_blocklist_default">
|
||||
|
||||
Reference in new issue
Block a user