Use intent for ensuring commit after decrypt->edit button->save
This commit is contained in:
parent
394a549f7e
commit
8ed4449e4b
2 changed files with 9 additions and 3 deletions
|
@ -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(
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue