From 2ffd1abb279bb0e1a8895ef26b805a1a1651516c Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sun, 16 Aug 2020 02:16:02 +0530 Subject: Fix external storage UX (#1022) * build: update to Kotlin 1.4 Signed-off-by: Harsh Shandilya * UserPreference: finish if directory selection was triggered from an intent Signed-off-by: Harsh Shandilya * PasswordStore: switch permission request to ActivityResultContracts Signed-off-by: Harsh Shandilya * PasswordStore: fix activity reference Signed-off-by: Harsh Shandilya * GitOperationActivity: make invalid values more obvious Would have caught this issue much sooner if I had just done this Fixes: 3d8cea596600 ("Improve permission handling logic (#732)") Signed-off-by: Harsh Shandilya * Assorted collection of hackery to make external storage use palatable Signed-off-by: Harsh Shandilya * Update changelog Signed-off-by: Harsh Shandilya --- app/src/main/java/com/zeapo/pwdstore/git/GitOperationActivity.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'app/src/main/java/com/zeapo/pwdstore/git/GitOperationActivity.kt') diff --git a/app/src/main/java/com/zeapo/pwdstore/git/GitOperationActivity.kt b/app/src/main/java/com/zeapo/pwdstore/git/GitOperationActivity.kt index eda2a8fe..8b772747 100644 --- a/app/src/main/java/com/zeapo/pwdstore/git/GitOperationActivity.kt +++ b/app/src/main/java/com/zeapo/pwdstore/git/GitOperationActivity.kt @@ -20,13 +20,12 @@ open class GitOperationActivity : BaseGitActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - when (intent.extras?.getInt(REQUEST_ARG_OP)) { + when (val reqCode = intent.extras?.getInt(REQUEST_ARG_OP)) { REQUEST_PULL -> lifecycleScope.launch { syncRepository(REQUEST_PULL) } REQUEST_PUSH -> lifecycleScope.launch { syncRepository(REQUEST_PUSH) } REQUEST_SYNC -> lifecycleScope.launch { syncRepository(REQUEST_SYNC) } else -> { - setResult(RESULT_CANCELED) - finish() + throw IllegalArgumentException("Invalid request code: $reqCode") } } } -- cgit v1.2.3