Make commitChange honor finishWithResultOnEnd (#815)

If PasswordRepository.isGitRepo() returns false, commitChange currently
doesn't honor the finishWithResultOnEnd parameter, which causes
Autofill generate flows to hang on a blank AutofillSaveActivity.

This commit lets commitChange mimic what GitAsyncTask does with the
parameter.

Co-authored-by: Harsh Shandilya <msfjarvis@gmail.com>
This commit is contained in:
Fabian Henneke 2020-05-30 21:08:38 +02:00 committed by GitHub
parent 2428d4c0de
commit cd0b23e003
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -839,7 +839,13 @@ class PasswordStore : AppCompatActivity() {
private const val PREFERENCE_SEEN_AUTOFILL_ONBOARDING = "seen_autofill_onboarding"
fun commitChange(activity: Activity, message: String, finishWithResultOnEnd: Intent? = null) {
if (!PasswordRepository.isGitRepo()) return
if (!PasswordRepository.isGitRepo()) {
if (finishWithResultOnEnd != null) {
activity.setResult(Activity.RESULT_OK, finishWithResultOnEnd)
activity.finish()
}
return
}
object : GitOperation(getRepositoryDirectory(activity), activity) {
override fun execute() {
tag(TAG).d { "Committing with message $message" }