diff --git a/app/src/main/java/eu/faircode/email/ActivityBase.java b/app/src/main/java/eu/faircode/email/ActivityBase.java index a9fb3bba52..ed8a91519e 100644 --- a/app/src/main/java/eu/faircode/email/ActivityBase.java +++ b/app/src/main/java/eu/faircode/email/ActivityBase.java @@ -201,6 +201,7 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc @Override protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { Log.i("Result class=" + this.getClass().getSimpleName() + + " action=" + data.getAction() + " request=" + requestCode + " result=" + resultCode); Log.logExtras(data); super.onActivityResult(requestCode, resultCode, data); diff --git a/app/src/main/java/eu/faircode/email/FragmentBase.java b/app/src/main/java/eu/faircode/email/FragmentBase.java index 6e57002abf..16efe9449d 100644 --- a/app/src/main/java/eu/faircode/email/FragmentBase.java +++ b/app/src/main/java/eu/faircode/email/FragmentBase.java @@ -193,6 +193,7 @@ public class FragmentBase extends Fragment { @Override public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { Log.i("Result class=" + this.getClass().getSimpleName() + + " action=" + data.getAction() + " request=" + requestCode + " result=" + resultCode); Log.logExtras(data); super.onActivityResult(requestCode, resultCode, data); diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index 7a1d89a1d4..4fe1e4aff8 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -1248,11 +1248,8 @@ public class FragmentCompose extends FragmentBase { onAddMedia(data); break; case REQUEST_ENCRYPT: - if (resultCode == RESULT_OK && data != null) { - if (BuildConfig.DEBUG || BuildConfig.BETA_RELEASE) - Log.logExtras(data); + if (resultCode == RESULT_OK && data != null) onPgp(data); - } break; case REQUEST_REF_DELETE: if (resultCode == RESULT_OK) @@ -1489,21 +1486,13 @@ public class FragmentCompose extends FragmentBase { OpenPgpApi.ACTION_SIGN_AND_ENCRYPT.equals(data.getAction())) encrypted = new ByteArrayOutputStream(); - if (BuildConfig.DEBUG || BuildConfig.BETA_RELEASE) { - Log.i("Execute " + data); - Log.logExtras(data); - } - // Encrypt message + Log.i("Executing " + data.getAction()); OpenPgpApi api = new OpenPgpApi(context, pgpService.getService()); Intent result = api.executeApi(data, decrypted, encrypted); - if (BuildConfig.DEBUG || BuildConfig.BETA_RELEASE) { - Log.i("Result " + result); - Log.logExtras(result); - } - int resultCode = result.getIntExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR); + Log.i("Result action=" + data.getAction() + " code=" + resultCode); switch (resultCode) { case OpenPgpApi.RESULT_CODE_SUCCESS: // Attach encrypted data / signature @@ -1543,8 +1532,7 @@ public class FragmentCompose extends FragmentBase { bytes = encrypted.toByteArray(); File file = attachment.getFile(context); - if (BuildConfig.DEBUG || BuildConfig.BETA_RELEASE) - Log.i("Writing " + file + " size=" + bytes.length); + Log.i("Writing " + file + " size=" + bytes.length); try (OutputStream out = new FileOutputStream(file)) { out.write(bytes); } @@ -1557,8 +1545,7 @@ public class FragmentCompose extends FragmentBase { if (OpenPgpApi.ACTION_GET_KEY_IDS.equals(data.getAction())) { pgpKeyIds = result.getLongArrayExtra(OpenPgpApi.EXTRA_KEY_IDS); - if (BuildConfig.DEBUG || BuildConfig.BETA_RELEASE) - Log.i("Keys=" + pgpKeyIds.length); + Log.i("Keys=" + pgpKeyIds.length); // Send without encryption if (pgpKeyIds.length == 0) @@ -1570,7 +1557,7 @@ public class FragmentCompose extends FragmentBase { intent.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true); return intent; } else if (OpenPgpApi.ACTION_GET_KEY.equals(data.getAction())) { - if (identity != null && identity.sign_key != null) { + if (identity.sign_key != null) { // Encrypt message Intent intent = new Intent(OpenPgpApi.ACTION_SIGN_AND_ENCRYPT); intent.putExtra(OpenPgpApi.EXTRA_KEY_IDS, pgpKeyIds); @@ -1583,8 +1570,7 @@ public class FragmentCompose extends FragmentBase { } } else if (OpenPgpApi.ACTION_GET_SIGN_KEY_ID.equals(data.getAction())) { pgpSignKeyId = result.getLongExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID, -1); - if (identity != null) - db.identity().setIdentitySignKey(identity.id, pgpSignKeyId); + db.identity().setIdentitySignKey(identity.id, pgpSignKeyId); // Encrypt message Intent intent = new Intent(OpenPgpApi.ACTION_SIGN_AND_ENCRYPT); @@ -1606,8 +1592,7 @@ public class FragmentCompose extends FragmentBase { return result.getParcelableExtra(OpenPgpApi.RESULT_INTENT); case OpenPgpApi.RESULT_CODE_ERROR: - if (identity != null) - db.identity().setIdentitySignKey(identity.id, null); + db.identity().setIdentitySignKey(identity.id, null); OpenPgpError error = result.getParcelableExtra(OpenPgpApi.RESULT_ERROR); if (error == null) throw new IllegalArgumentException("Unknown error"); @@ -1621,6 +1606,7 @@ public class FragmentCompose extends FragmentBase { @Override protected void onExecuted(Bundle args, Object result) { + Log.i("Result= " + result); if (result == null) onAction(R.id.action_send); else if (result instanceof Intent) { diff --git a/app/src/main/java/eu/faircode/email/FragmentDialogBase.java b/app/src/main/java/eu/faircode/email/FragmentDialogBase.java index 4992137580..592c5a422b 100644 --- a/app/src/main/java/eu/faircode/email/FragmentDialogBase.java +++ b/app/src/main/java/eu/faircode/email/FragmentDialogBase.java @@ -81,6 +81,7 @@ public class FragmentDialogBase extends DialogFragment { @Override public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { Log.i("Result class=" + this.getClass().getSimpleName() + + " action=" + data.getAction() + " request=" + requestCode + " result=" + resultCode); Log.logExtras(data); super.onActivityResult(requestCode, resultCode, data);