aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/com/zeapo/pwdstore/utils
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/com/zeapo/pwdstore/utils')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/utils/PasswordRepository.kt13
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/utils/PreferenceKeys.kt60
2 files changed, 67 insertions, 6 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRepository.kt b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRepository.kt
index 794630be..65109d99 100644
--- a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRepository.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRepository.kt
@@ -39,7 +39,8 @@ open class PasswordRepository protected constructor() {
companion object {
@JvmStatic
fun getSortOrder(settings: SharedPreferences): PasswordSortOrder {
- return valueOf(settings.getString("sort_order", null) ?: FOLDER_FIRST.name)
+ return valueOf(settings.getString(PreferenceKeys.SORT_ORDER, null)
+ ?: FOLDER_FIRST.name)
}
}
}
@@ -154,8 +155,8 @@ open class PasswordRepository protected constructor() {
if (!::settings.isInitialized) {
settings = PreferenceManager.getDefaultSharedPreferences(context.applicationContext)
}
- return if (settings.getBoolean("git_external", false)) {
- val externalRepo = settings.getString("git_external_repo", null)
+ return if (settings.getBoolean(PreferenceKeys.GIT_EXTERNAL, false)) {
+ val externalRepo = settings.getString(PreferenceKeys.GIT_EXTERNAL_REPO, null)
if (externalRepo != null)
File(externalRepo)
else
@@ -174,9 +175,9 @@ open class PasswordRepository protected constructor() {
// uninitialize the repo if the dir does not exist or is absolutely empty
settings.edit {
if (!dir.exists() || !dir.isDirectory || dir.listFiles()!!.isEmpty()) {
- putBoolean("repository_initialized", false)
+ putBoolean(PreferenceKeys.REPOSITORY_INITIALIZED, false)
} else {
- putBoolean("repository_initialized", true)
+ putBoolean(PreferenceKeys.REPOSITORY_INITIALIZED, true)
}
}
@@ -217,7 +218,7 @@ open class PasswordRepository protected constructor() {
// We need to recover the passwords then parse the files
val passList = getFilesList(path).also { it.sortBy { f -> f.name } }
val passwordList = ArrayList<PasswordItem>()
- val showHiddenDirs = settings.getBoolean("show_hidden_folders", false)
+ val showHiddenDirs = settings.getBoolean(PreferenceKeys.SHOW_HIDDEN_FOLDERS, false)
if (passList.size == 0) return passwordList
if (showHiddenDirs) {
diff --git a/app/src/main/java/com/zeapo/pwdstore/utils/PreferenceKeys.kt b/app/src/main/java/com/zeapo/pwdstore/utils/PreferenceKeys.kt
new file mode 100644
index 00000000..05f9c741
--- /dev/null
+++ b/app/src/main/java/com/zeapo/pwdstore/utils/PreferenceKeys.kt
@@ -0,0 +1,60 @@
+package com.zeapo.pwdstore.utils
+
+object PreferenceKeys {
+
+ const val APP_THEME = "app_theme"
+ const val APP_VERSION = "app_version"
+ const val AUTOFILL_APPS = "autofill_apps"
+ const val AUTOFILL_ALWAYS = "autofill_always"
+ const val AUTOFILL_DEFAULT = "autofill_default"
+ const val AUTOFILL_ENABLE = "autofill_enable"
+ const val AUTOFILL_FULL_PATH = "autofill_full_path"
+ const val BIOMETRIC_AUTH = "biometric_auth"
+ const val CLEAR_CLIPBOARD_20X = "clear_clipboard_20x"
+ const val CLEAR_SAVED_PASS = "clear_saved_pass"
+ const val COPY_ON_DECRYPT = "copy_on_decrypt"
+ const val ENABLE_DEBUG_LOGGING = "enable_debug_logging"
+ const val EXPORT_PASSWORDS = "export_passwords"
+ const val FILTER_RECURSIVELY = "filter_recursively"
+ const val GENERAL_SHOW_TIME = "general_show_time"
+ const val GIT_CONFIG = "git_config"
+ const val GIT_CONFIG_USER_EMAIL = "git_config_user_email"
+ const val GIT_CONFIG_USER_NAME = "git_config_user_name"
+ const val GIT_EXTERNAL = "git_external"
+ const val GIT_EXTERNAL_REPO = "git_external_repo"
+ const val GIT_REMOTE_AUTH = "git_remote_auth"
+ const val GIT_REMOTE_LOCATION = "git_remote_location"
+ const val GIT_REMOTE_PORT = "git_remote_port"
+ const val GIT_REMOTE_PROTOCOL = "git_remote_protocol"
+ const val GIT_DELETE_REPO = "git_delete_repo"
+ const val GIT_REMOTE_SERVER = "git_remote_server"
+ const val GIT_REMOTE_USERNAME = "git_remote_username"
+ const val GIT_SERVER_INFO = "git_server_info"
+ const val HTTPS_PASSWORD = "https_password"
+ const val LENGTH = "length"
+ const val OPENPGP_KEY_IDS_SET = "openpgp_key_ids_set"
+ const val OPENPGP_KEY_ID_PREF = "openpgp_key_id_pref"
+ const val OPENPGP_PROVIDER_LIST = "openpgp_provider_list"
+ const val OREO_AUTOFILL_CUSTOM_PUBLIC_SUFFIXES = "oreo_autofill_custom_public_suffixes"
+ const val OREO_AUTOFILL_DEFAULT_USERNAME = "oreo_autofill_default_username"
+ const val OREO_AUTOFILL_DIRECTORY_STRUCTURE = "oreo_autofill_directory_structure"
+ const val PREF_KEY_CUSTOM_DICT = "pref_key_custom_dict"
+ const val PREF_KEY_IS_CUSTOM_DICT = "pref_key_is_custom_dict"
+ const val PREF_KEY_PWGEN_TYPE = "pref_key_pwgen_type"
+ const val PREF_SELECT_EXTERNAL = "pref_select_external"
+ const val REPOSITORY_INITIALIZED = "repository_initialized"
+ const val REPO_CHANGED = "repo_changed"
+ const val SEARCH_ON_START = "search_on_start"
+ const val SHOW_EXTRA_CONTENT = "show_extra_content"
+ const val SHOW_HIDDEN_FOLDERS = "show_hidden_folders"
+ const val SORT_ORDER = "sort_order"
+ const val SHOW_PASSWORD = "show_password"
+ const val SSH_KEY = "ssh_key"
+ const val SSH_KEYGEN = "ssh_keygen"
+ const val SSH_KEY_LOCAL_PASSPHRASE = "ssh_key_local_passphrase"
+ const val SSH_OPENKEYSTORE_CLEAR_KEY_ID = "ssh_openkeystore_clear_keyid"
+ const val SSH_OPENKEYSTORE_KEYID = "ssh_openkeystore_keyid"
+ const val SSH_SEE_KEY = "ssh_see_key"
+ const val USE_GENERATED_KEY = "use_generated_key"
+
+}