aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/PasswordStore.kt23
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillSaveActivity.kt14
2 files changed, 24 insertions, 13 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.kt b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.kt
index 9ee28f09..72fbee8d 100644
--- a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.kt
@@ -548,14 +548,7 @@ class PasswordStore : AppCompatActivity() {
get() = plist?.currentDir ?: getRepositoryDirectory(applicationContext)
private fun commitChange(message: String) {
- object : GitOperation(getRepositoryDirectory(activity), activity) {
- override fun execute() {
- Timber.tag(TAG).d("Committing with message $message")
- val git = Git(repository)
- val tasks = GitAsyncTask(activity, false, true, this)
- tasks.execute(git.add().addFilepattern("."), git.commit().setAll(true).setMessage(message))
- }
- }.execute()
+ Companion.commitChange(activity, message)
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
@@ -772,5 +765,19 @@ class PasswordStore : AppCompatActivity() {
return (!Character.isISOControl(c) &&
block != null && block !== UnicodeBlock.SPECIALS)
}
+
+ fun commitChange(activity: Activity, message: String) {
+ object : GitOperation(getRepositoryDirectory(activity), activity) {
+ override fun execute() {
+ Timber.tag(TAG).d("Committing with message $message")
+ val git = Git(repository)
+ val tasks = GitAsyncTask(activity, false, true, this)
+ tasks.execute(
+ git.add().addFilepattern("."),
+ git.commit().setAll(true).setMessage(message)
+ )
+ }
+ }.execute()
+ }
}
}
diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillSaveActivity.kt b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillSaveActivity.kt
index e5def0fb..3a4831d6 100644
--- a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillSaveActivity.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillSaveActivity.kt
@@ -16,6 +16,7 @@ import androidx.annotation.RequiresApi
import androidx.core.os.bundleOf
import com.github.ajalt.timberkt.e
import com.zeapo.pwdstore.PasswordStore
+import com.zeapo.pwdstore.R
import com.zeapo.pwdstore.autofill.oreo.AutofillAction
import com.zeapo.pwdstore.autofill.oreo.AutofillMatcher
import com.zeapo.pwdstore.autofill.oreo.AutofillPreferences
@@ -114,12 +115,15 @@ class AutofillSaveActivity : Activity() {
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == PasswordStore.REQUEST_CODE_ENCRYPT && resultCode == RESULT_OK && data != null) {
- val createdPath = data.getStringExtra("CREATED_FILE")
- if (createdPath != null) {
- formOrigin?.let {
- AutofillMatcher.addMatchFor(this, it, File(createdPath))
- }
+ val createdPath = data.getStringExtra("CREATED_FILE")!!
+ formOrigin?.let {
+ AutofillMatcher.addMatchFor(this, it, File(createdPath))
}
+ val longName = data.getStringExtra("LONG_NAME")!!
+ // PgpActivity delegates committing the added file to PasswordStore. Since PasswordStore
+ // is not involved in an AutofillScenario, we have to commit the file ourself.
+ PasswordStore.commitChange(this, getString(R.string.git_commit_add_text, longName))
+
val password = data.getStringExtra("PASSWORD")
val username = data.getStringExtra("USERNAME")
if (password != null) {