diff options
author | Harsh Shandilya <msfjarvis@gmail.com> | 2020-08-12 13:04:47 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-12 09:34:47 +0200 |
commit | 372c0f3dbd395e93c89ac0730a06344e3c9d6376 (patch) | |
tree | b9c5e8b8710f46892562949aaf9966d7d659656d | |
parent | 52e2139f6afc14a2b442e89b4bcb2095870c6a0f (diff) |
Improve clone operation semantics (#1010)
* Improve clone operation semantics
Fixes #1003
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
* Update changelog
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/git/operation/CloneOperation.kt | 11 | ||||
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/git/operation/GitOperation.kt | 3 |
3 files changed, 13 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 94c94c31..42c99227 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ All notable changes to this project will be documented in this file. - Allow creating nested directories directly - I keep saying this but for real: error message for wrong SSH/HTTPS password is properly fixed now - Fix crash when OpenKeychain is not installed +- Clone operation won't leave user on an empty password list upon failure ## [1.10.3] - 2020-07-30 diff --git a/app/src/main/java/com/zeapo/pwdstore/git/operation/CloneOperation.kt b/app/src/main/java/com/zeapo/pwdstore/git/operation/CloneOperation.kt index 8c516eac..a032a669 100644 --- a/app/src/main/java/com/zeapo/pwdstore/git/operation/CloneOperation.kt +++ b/app/src/main/java/com/zeapo/pwdstore/git/operation/CloneOperation.kt @@ -24,6 +24,15 @@ class CloneOperation(fileDir: File, uri: String, callingActivity: AppCompatActiv ) override suspend fun execute() { - GitCommandExecutor(callingActivity, this).execute() + GitCommandExecutor(callingActivity, this, finishActivityOnEnd = false).execute() + } + + override fun onSuccess() { + callingActivity.finish() + } + + override fun onError(err: Exception) { + finishFromErrorDialog = false + super.onError(err) } } 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 ad8d318a..e72c5743 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 @@ -46,6 +46,7 @@ abstract class GitOperation(gitDir: File, internal val callingActivity: Fragment private var provider: CredentialsProvider? = null private val sshKeyFile = callingActivity.filesDir.resolve(".ssh_key") private val hostKeyFile = callingActivity.filesDir.resolve(".host_key") + protected var finishFromErrorDialog = true protected val repository = PasswordRepository.getRepository(gitDir) protected val git = Git(repository) protected val remoteBranch = GitSettings.branch @@ -166,7 +167,7 @@ abstract class GitOperation(gitDir: File, internal val callingActivity: Fragment .setTitle(callingActivity.resources.getString(R.string.jgit_error_dialog_title)) .setMessage(ErrorMessages[err]) .setPositiveButton(callingActivity.resources.getString(R.string.dialog_ok)) { _, _ -> - callingActivity.finish() + if (finishFromErrorDialog) callingActivity.finish() }.show() } |