From 3dace243e4b0fe1378e2d81c46fb70cb236e6ae5 Mon Sep 17 00:00:00 2001 From: Fabian Henneke Date: Thu, 6 Aug 2020 10:58:20 +0200 Subject: Refactor uses of applicationContext and startActivityForResult (#997) * Refactor uses of applicationContext and startActivityForResult This commit applies three types of refactoring: 1. Remove context argument from PasswordRepository companion functions by relying on Application.instance. 2. Introduce a sharedPrefs extension function on Context that returns the default SharedPreferences for the applicationContext. 3. Use OpenDocument() and OpenDocumentTree() contracts. * Drop toPasswordItem argument --- app/src/main/java/com/zeapo/pwdstore/git/operation/GitOperation.kt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'app/src/main/java/com/zeapo/pwdstore/git/operation') diff --git a/app/src/main/java/com/zeapo/pwdstore/git/operation/GitOperation.kt b/app/src/main/java/com/zeapo/pwdstore/git/operation/GitOperation.kt index 45fefd64..591c121f 100644 --- a/app/src/main/java/com/zeapo/pwdstore/git/operation/GitOperation.kt +++ b/app/src/main/java/com/zeapo/pwdstore/git/operation/GitOperation.kt @@ -158,9 +158,7 @@ abstract class GitOperation(gitDir: File, internal val callingActivity: Fragment .edit { remove(PreferenceKeys.SSH_OPENKEYSTORE_KEYID) } } is SshjSessionFactory -> { - callingActivity.applicationContext - .getEncryptedPrefs("git_operation") - .edit { + callingActivity.getEncryptedPrefs("git_operation").edit { remove(PreferenceKeys.SSH_KEY_LOCAL_PASSPHRASE) remove(PreferenceKeys.HTTPS_PASSWORD) } -- cgit v1.2.3