summaryrefslogtreecommitdiff
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.java7
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java5
2 files changed, 9 insertions, 3 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java
index d6e18995..33b6bd29 100644
--- a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java
+++ b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java
@@ -442,10 +442,11 @@ public class PasswordStore extends AppCompatActivity {
// if we get here with a RESULT_OK then it's probably OK :)
settings.edit().putBoolean("repository_initialized", true).apply();
break;
- case PgpHandler.REQUEST_CODE_ENCRYPT:
case PgpHandler.REQUEST_CODE_DECRYPT_AND_VERIFY:
- // RESULT_OK and REQUEST_CODE_DECRYPT_AND_VERIFY only when a file has been edited
- // since normally REQUEST_CODE_DECRYPT_AND_VERIFY returns RESULT_CANCELLED
+ if (!data.getBooleanExtra("needCommit", false)) {
+ break;
+ }
+ case PgpHandler.REQUEST_CODE_ENCRYPT:
Git git = new Git(PasswordRepository.getRepository(new File("")));
GitAsyncTask tasks = new GitAsyncTask(this, false, false, CommitCommand.class);
tasks.execute(
diff --git a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java
index 131e8e51..6c8a1a61 100644
--- a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java
+++ b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java
@@ -176,6 +176,7 @@ public class PgpHandler extends AppCompatActivity implements OpenPgpServiceConne
Intent intent = new Intent(this, PgpHandler.class);
intent.putExtra("FILE_PATH", directoryPath);
intent.putExtra("Operation", "ENCRYPT");
+ intent.putExtra("fromDecrypt", true);
setIntent(intent);
}
@@ -427,6 +428,10 @@ public class PgpHandler extends AppCompatActivity implements OpenPgpServiceConne
Intent data = new Intent();
data.putExtra("CREATED_FILE", path);
data.putExtra("NAME", ((EditText) findViewById(R.id.crypto_password_file_edit)).getText().toString());
+ // if coming from decrypt screen->edit button
+ if (getIntent().getBooleanExtra("fromDecrypt", false)) {
+ data.putExtra("needCommit", true);
+ }
setResult(RESULT_OK, data);
finish();
} catch (Exception e) {