aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/com')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/utils/PasswordRepository.kt7
1 files changed, 6 insertions, 1 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 d10a5d59..e0bf9857 100644
--- a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRepository.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRepository.kt
@@ -140,6 +140,9 @@ open class PasswordRepository protected constructor() {
@JvmStatic
fun getRepositoryDirectory(context: Context): File {
+ if (!::settings.isInitialized) {
+ settings = PreferenceManager.getDefaultSharedPreferences(context.applicationContext)
+ }
return if (settings.getBoolean("git_external", false)) {
val externalRepo = settings.getString("git_external_repo", null)
File(requireNotNull(externalRepo))
@@ -150,7 +153,9 @@ open class PasswordRepository protected constructor() {
@JvmStatic
fun initialize(context: Context): Repository? {
- settings = PreferenceManager.getDefaultSharedPreferences(context.applicationContext)
+ if (!::settings.isInitialized) {
+ settings = PreferenceManager.getDefaultSharedPreferences(context.applicationContext)
+ }
val dir = getRepositoryDirectory(context)
// uninitialize the repo if the dir does not exist or is absolutely empty
if (!dir.exists() || !dir.isDirectory || dir.listFiles()!!.isEmpty()) {