diff options
| author | Aditya Wasan <adityawasan55@gmail.com> | 2020-07-01 00:00:02 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-01 00:00:02 +0530 |
| commit | 82a9a6125473dbffa6a76f33c6ff83b4a1bd69b3 (patch) | |
| tree | 965c887adfb0c5603f6e8f9dbcbd04d4d1011904 /app/src/main/java/com/zeapo/pwdstore/git/GitOperation.kt | |
| parent | e11ef1ca1d504bcccf73e75c3782cce2c8fc4bec (diff) | |
| download | HardenedPass-82a9a6125473dbffa6a76f33c6ff83b4a1bd69b3.tar.gz HardenedPass-82a9a6125473dbffa6a76f33c6ff83b4a1bd69b3.zip | |
Use PreferenceKeys file to manage SharedPreferences keys. (#891)
* Use PreferenceKeys file to manage SharedPreferences keys.
Signed-off-by: Aditya Wasan <adityawasan55@gmail.com>
* Use PreferenceKeys in all files
Signed-off-by: Aditya Wasan <adityawasan55@gmail.com>
* Divide PreferenceKeys into multiple regions
Signed-off-by: Aditya Wasan <adityawasan55@gmail.com>
* Fix build error
Signed-off-by: Aditya Wasan <adityawasan55@gmail.com>
* Use PreferenceKeys in more files
Signed-off-by: Aditya Wasan <adityawasan55@gmail.com>
* Reformat code
Signed-off-by: Aditya Wasan <adityawasan55@gmail.com>
* Fix build error
Signed-off-by: Aditya Wasan <adityawasan55@gmail.com>
* Fix merge issues
Signed-off-by: Aditya Wasan <adityawasan55@gmail.com>
Diffstat (limited to 'app/src/main/java/com/zeapo/pwdstore/git/GitOperation.kt')
| -rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/git/GitOperation.kt | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/git/GitOperation.kt b/app/src/main/java/com/zeapo/pwdstore/git/GitOperation.kt index 33a08fa4..48c28920 100644 --- a/app/src/main/java/com/zeapo/pwdstore/git/GitOperation.kt +++ b/app/src/main/java/com/zeapo/pwdstore/git/GitOperation.kt @@ -23,6 +23,7 @@ import com.zeapo.pwdstore.git.config.SshApiSessionFactory import com.zeapo.pwdstore.git.config.SshAuthData import com.zeapo.pwdstore.git.config.SshjSessionFactory import com.zeapo.pwdstore.utils.PasswordRepository +import com.zeapo.pwdstore.utils.PreferenceKeys import com.zeapo.pwdstore.utils.getEncryptedPrefs import com.zeapo.pwdstore.utils.requestInputFocusOnView import net.schmizz.sshj.userauth.password.PasswordFinder @@ -50,7 +51,7 @@ private class GitOperationCredentialFinder(val callingActivity: Activity, val co @StringRes val errorRes: Int when (connectionMode) { ConnectionMode.SshKey -> { - credentialPref = "ssh_key_local_passphrase" + credentialPref = PreferenceKeys.SSH_KEY_LOCAL_PASSPHRASE messageRes = R.string.passphrase_dialog_text hintRes = R.string.ssh_keygen_passphrase rememberRes = R.string.git_operation_remember_passphrase @@ -58,7 +59,7 @@ private class GitOperationCredentialFinder(val callingActivity: Activity, val co } ConnectionMode.Password -> { // Could be either an SSH or an HTTPS password - credentialPref = "https_password" + credentialPref = PreferenceKeys.HTTPS_PASSWORD messageRes = R.string.password_dialog_text hintRes = R.string.git_operation_hint_password rememberRes = R.string.git_operation_remember_password @@ -222,14 +223,14 @@ abstract class GitOperation(gitDir: File, internal val callingActivity: Activity when (SshSessionFactory.getInstance()) { is SshApiSessionFactory -> { PreferenceManager.getDefaultSharedPreferences(callingActivity.applicationContext) - .edit { remove("ssh_openkeystore_keyid") } + .edit { remove(PreferenceKeys.SSH_OPENKEYSTORE_KEYID) } } is SshjSessionFactory -> { callingActivity.applicationContext .getEncryptedPrefs("git_operation") .edit { - remove("ssh_key_local_passphrase") - remove("https_password") + remove(PreferenceKeys.SSH_KEY_LOCAL_PASSPHRASE) + remove(PreferenceKeys.HTTPS_PASSWORD) } } } |
