handle the case when no account name was set

This commit is contained in:
knuthy 2014-08-10 18:40:55 +01:00
parent 9823d1cfc8
commit 3ce3909ade
2 changed files with 8 additions and 4 deletions

View file

@ -3,6 +3,8 @@ PwdStore
This application tries to be 100% compatible with [pass](http://www.zx2c4.com/projects/password-store/) This application tries to be 100% compatible with [pass](http://www.zx2c4.com/projects/password-store/)
Alpha version available at [PlayStore]
Features Features
======== ========
- Clone an existing pass repository - Clone an existing pass repository

View file

@ -275,7 +275,7 @@ public class PgpHandler extends Activity {
public void onReturn(Intent result) { public void onReturn(Intent result) {
switch (result.getIntExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR)) { switch (result.getIntExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR)) {
case OpenPgpApi.RESULT_CODE_SUCCESS: { case OpenPgpApi.RESULT_CODE_SUCCESS: {
showToast("RESULT_CODE_SUCCESS"); showToast("SUCCESS");
// encrypt/decrypt/sign/verify // encrypt/decrypt/sign/verify
if (requestCode == REQUEST_CODE_DECRYPT_AND_VERIFY && os != null) { if (requestCode == REQUEST_CODE_DECRYPT_AND_VERIFY && os != null) {
@ -342,7 +342,7 @@ public class PgpHandler extends Activity {
break; break;
} }
case OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED: { case OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED: {
showToast("RESULT_CODE_USER_INTERACTION_REQUIRED"); Log.i("PgpHandler", "RESULT_CODE_USER_INTERACTION_REQUIRED");
PendingIntent pi = result.getParcelableExtra(OpenPgpApi.RESULT_INTENT); PendingIntent pi = result.getParcelableExtra(OpenPgpApi.RESULT_INTENT);
try { try {
@ -354,7 +354,7 @@ public class PgpHandler extends Activity {
break; break;
} }
case OpenPgpApi.RESULT_CODE_ERROR: { case OpenPgpApi.RESULT_CODE_ERROR: {
showToast("RESULT_CODE_ERROR"); showToast("ERROR");
OpenPgpError error = result.getParcelableExtra(OpenPgpApi.RESULT_ERROR); OpenPgpError error = result.getParcelableExtra(OpenPgpApi.RESULT_ERROR);
handleError(error); handleError(error);
@ -367,9 +367,11 @@ public class PgpHandler extends Activity {
public void getKeyIds(Intent data) { public void getKeyIds(Intent data) {
accountName = settings.getString("openpgp_account_name", ""); accountName = settings.getString("openpgp_account_name", "");
if (accountName.isEmpty())
showToast("Please set your account name in settings whenever you can");
data.setAction(OpenPgpApi.ACTION_GET_KEY_IDS); data.setAction(OpenPgpApi.ACTION_GET_KEY_IDS);
data.putExtra(OpenPgpApi.EXTRA_USER_IDS, new String[]{accountName}); data.putExtra(OpenPgpApi.EXTRA_USER_IDS, new String[]{accountName.isEmpty() ? "default" : accountName});
OpenPgpApi api = new OpenPgpApi(this, mServiceConnection.getService()); OpenPgpApi api = new OpenPgpApi(this, mServiceConnection.getService());