From bfbbdecc0796fdd8e68b675e3fd8d26dd99a8d60 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Mon, 16 Dec 2019 12:46:06 +0530 Subject: Fix release builds (#601) * proguard: Don't obfuscate stacktraces * Deploy snapshots from this branch * PasswordRepository: Handle uninitialized settings * Keep classes that are used in parcels * Revert "Deploy snapshots from this branch" This reverts commit 66918ca2b90dbf7629bd56606eb3d3f578d96105. Signed-off-by: Harsh Shandilya --- app/src/main/java/com/zeapo/pwdstore/utils/PasswordRepository.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'app/src') 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()) { -- cgit v1.2.3