aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/git/operation/CloneOperation.kt11
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/git/operation/GitOperation.kt3
2 files changed, 12 insertions, 2 deletions
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()
}