diff options
author | Matthew Wong <wongma7@outlook.com> | 2015-09-16 11:26:51 -0400 |
---|---|---|
committer | Matthew Wong <wongma7@outlook.com> | 2015-09-16 11:26:51 -0400 |
commit | 8ed4449e4b67c6832f50c1a29e59f146eaeb6f92 (patch) | |
tree | 70fe9ddcb709f3d65144537e96913119ea1694c2 | |
parent | 394a549f7e8aa5b656ba847a03938a34fccc54dd (diff) |
Use intent for ensuring commit after decrypt->edit button->save
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/PasswordStore.java | 7 | ||||
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java | 5 |
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) { |