mirror of
https://github.com/android-password-store/Android-Password-Store
synced 2025-09-01 14:55:19 +00:00
Use intent for ensuring commit after decrypt->edit button->save
This commit is contained in:
@@ -442,10 +442,11 @@ public class PasswordStore extends AppCompatActivity {
|
|||||||
// if we get here with a RESULT_OK then it's probably OK :)
|
// if we get here with a RESULT_OK then it's probably OK :)
|
||||||
settings.edit().putBoolean("repository_initialized", true).apply();
|
settings.edit().putBoolean("repository_initialized", true).apply();
|
||||||
break;
|
break;
|
||||||
case PgpHandler.REQUEST_CODE_ENCRYPT:
|
|
||||||
case PgpHandler.REQUEST_CODE_DECRYPT_AND_VERIFY:
|
case PgpHandler.REQUEST_CODE_DECRYPT_AND_VERIFY:
|
||||||
// RESULT_OK and REQUEST_CODE_DECRYPT_AND_VERIFY only when a file has been edited
|
if (!data.getBooleanExtra("needCommit", false)) {
|
||||||
// since normally REQUEST_CODE_DECRYPT_AND_VERIFY returns RESULT_CANCELLED
|
break;
|
||||||
|
}
|
||||||
|
case PgpHandler.REQUEST_CODE_ENCRYPT:
|
||||||
Git git = new Git(PasswordRepository.getRepository(new File("")));
|
Git git = new Git(PasswordRepository.getRepository(new File("")));
|
||||||
GitAsyncTask tasks = new GitAsyncTask(this, false, false, CommitCommand.class);
|
GitAsyncTask tasks = new GitAsyncTask(this, false, false, CommitCommand.class);
|
||||||
tasks.execute(
|
tasks.execute(
|
||||||
|
@@ -176,6 +176,7 @@ public class PgpHandler extends AppCompatActivity implements OpenPgpServiceConne
|
|||||||
Intent intent = new Intent(this, PgpHandler.class);
|
Intent intent = new Intent(this, PgpHandler.class);
|
||||||
intent.putExtra("FILE_PATH", directoryPath);
|
intent.putExtra("FILE_PATH", directoryPath);
|
||||||
intent.putExtra("Operation", "ENCRYPT");
|
intent.putExtra("Operation", "ENCRYPT");
|
||||||
|
intent.putExtra("fromDecrypt", true);
|
||||||
setIntent(intent);
|
setIntent(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -427,6 +428,10 @@ public class PgpHandler extends AppCompatActivity implements OpenPgpServiceConne
|
|||||||
Intent data = new Intent();
|
Intent data = new Intent();
|
||||||
data.putExtra("CREATED_FILE", path);
|
data.putExtra("CREATED_FILE", path);
|
||||||
data.putExtra("NAME", ((EditText) findViewById(R.id.crypto_password_file_edit)).getText().toString());
|
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);
|
setResult(RESULT_OK, data);
|
||||||
finish();
|
finish();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
Reference in New Issue
Block a user