From bad8e2b4043b1239c17aafc1cc6779a347b3680e Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Fri, 18 Sep 2020 18:14:52 +0530 Subject: Misc cleanups to build and extension functions (#1108) --- app/src/main/java/com/zeapo/pwdstore/git/BaseGitActivity.kt | 4 ++-- app/src/main/java/com/zeapo/pwdstore/git/config/GitSettings.kt | 4 ++-- .../main/java/com/zeapo/pwdstore/git/operation/CredentialFinder.kt | 4 ++-- app/src/main/java/com/zeapo/pwdstore/git/sshj/SshKey.kt | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'app/src/main/java/com/zeapo/pwdstore/git') diff --git a/app/src/main/java/com/zeapo/pwdstore/git/BaseGitActivity.kt b/app/src/main/java/com/zeapo/pwdstore/git/BaseGitActivity.kt index 6a975f6c..b0aed087 100644 --- a/app/src/main/java/com/zeapo/pwdstore/git/BaseGitActivity.kt +++ b/app/src/main/java/com/zeapo/pwdstore/git/BaseGitActivity.kt @@ -21,7 +21,7 @@ import com.zeapo.pwdstore.git.operation.PushOperation import com.zeapo.pwdstore.git.operation.ResetToRemoteOperation import com.zeapo.pwdstore.git.operation.SyncOperation import com.zeapo.pwdstore.utils.PreferenceKeys -import com.zeapo.pwdstore.utils.getEncryptedPrefs +import com.zeapo.pwdstore.utils.getEncryptedGitPrefs import com.zeapo.pwdstore.utils.sharedPrefs import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext @@ -86,7 +86,7 @@ abstract class BaseGitActivity : AppCompatActivity() { suspend fun promptOnErrorHandler(err: Throwable, onPromptDone: () -> Unit = {}) { val error = rootCauseException(err) if (!isExplicitlyUserInitiatedError(error)) { - getEncryptedPrefs("git_operation").edit { + getEncryptedGitPrefs().edit { remove(PreferenceKeys.HTTPS_PASSWORD) } sharedPrefs.edit { remove(PreferenceKeys.SSH_OPENKEYSTORE_KEYID) } diff --git a/app/src/main/java/com/zeapo/pwdstore/git/config/GitSettings.kt b/app/src/main/java/com/zeapo/pwdstore/git/config/GitSettings.kt index f4cbc04f..e43deaf4 100644 --- a/app/src/main/java/com/zeapo/pwdstore/git/config/GitSettings.kt +++ b/app/src/main/java/com/zeapo/pwdstore/git/config/GitSettings.kt @@ -10,7 +10,7 @@ import com.github.michaelbull.result.runCatching import com.zeapo.pwdstore.Application import com.zeapo.pwdstore.utils.PasswordRepository import com.zeapo.pwdstore.utils.PreferenceKeys -import com.zeapo.pwdstore.utils.getEncryptedPrefs +import com.zeapo.pwdstore.utils.getEncryptedGitPrefs import com.zeapo.pwdstore.utils.getString import com.zeapo.pwdstore.utils.sharedPrefs import java.io.File @@ -53,7 +53,7 @@ object GitSettings { private const val DEFAULT_BRANCH = "master" private val settings by lazy { Application.instance.sharedPrefs } - private val encryptedSettings by lazy { Application.instance.getEncryptedPrefs("git_operation") } + private val encryptedSettings by lazy { Application.instance.getEncryptedGitPrefs() } var authMode get() = AuthMode.fromString(settings.getString(PreferenceKeys.GIT_REMOTE_AUTH)) diff --git a/app/src/main/java/com/zeapo/pwdstore/git/operation/CredentialFinder.kt b/app/src/main/java/com/zeapo/pwdstore/git/operation/CredentialFinder.kt index 742361c0..c34af18a 100644 --- a/app/src/main/java/com/zeapo/pwdstore/git/operation/CredentialFinder.kt +++ b/app/src/main/java/com/zeapo/pwdstore/git/operation/CredentialFinder.kt @@ -14,7 +14,7 @@ import com.zeapo.pwdstore.R import com.zeapo.pwdstore.git.config.AuthMode import com.zeapo.pwdstore.git.sshj.InteractivePasswordFinder import com.zeapo.pwdstore.utils.PreferenceKeys -import com.zeapo.pwdstore.utils.getEncryptedPrefs +import com.zeapo.pwdstore.utils.getEncryptedGitPrefs import com.zeapo.pwdstore.utils.requestInputFocusOnView import kotlin.coroutines.Continuation import kotlin.coroutines.resume @@ -25,7 +25,7 @@ class CredentialFinder( ) : InteractivePasswordFinder() { override fun askForPassword(cont: Continuation, isRetry: Boolean) { - val gitOperationPrefs = callingActivity.getEncryptedPrefs("git_operation") + val gitOperationPrefs = callingActivity.getEncryptedGitPrefs() val credentialPref: String @StringRes val messageRes: Int @StringRes val hintRes: Int diff --git a/app/src/main/java/com/zeapo/pwdstore/git/sshj/SshKey.kt b/app/src/main/java/com/zeapo/pwdstore/git/sshj/SshKey.kt index ce09f1a9..73072f7d 100644 --- a/app/src/main/java/com/zeapo/pwdstore/git/sshj/SshKey.kt +++ b/app/src/main/java/com/zeapo/pwdstore/git/sshj/SshKey.kt @@ -23,7 +23,7 @@ import com.github.michaelbull.result.runCatching import com.zeapo.pwdstore.Application import com.zeapo.pwdstore.R import com.zeapo.pwdstore.utils.PreferenceKeys -import com.zeapo.pwdstore.utils.getEncryptedPrefs +import com.zeapo.pwdstore.utils.getEncryptedGitPrefs import com.zeapo.pwdstore.utils.getString import com.zeapo.pwdstore.utils.sharedPrefs import java.io.File @@ -169,7 +169,7 @@ object SshKey { if (publicKeyFile.isFile) { publicKeyFile.delete() } - context.getEncryptedPrefs("git_operation").edit { + context.getEncryptedGitPrefs().edit { remove(PreferenceKeys.SSH_KEY_LOCAL_PASSPHRASE) } type = null -- cgit v1.2.3