Repeat OpenPgp commands

This commit is contained in:
M66B 2019-04-24 10:15:50 +02:00
parent 01bd7a423a
commit c7c31289b3
1 changed files with 13 additions and 11 deletions

View File

@ -1099,11 +1099,9 @@ public class FragmentCompose extends FragmentBase {
for (int i = 0; i < ato.length; i++) for (int i = 0; i < ato.length; i++)
tos[i] = ato[i].getAddress(); tos[i] = ato[i].getAddress();
Intent data = new Intent(); Intent data = new Intent(OpenPgpApi.ACTION_SIGN_AND_ENCRYPT);
data.setAction(OpenPgpApi.ACTION_SIGN_AND_ENCRYPT);
data.putExtra(OpenPgpApi.EXTRA_USER_IDS, tos); data.putExtra(OpenPgpApi.EXTRA_USER_IDS, tos);
data.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true); data.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true);
encrypt(data, false); encrypt(data, false);
} catch (Throwable ex) { } catch (Throwable ex) {
if (ex instanceof IllegalArgumentException) if (ex instanceof IllegalArgumentException)
@ -1220,10 +1218,9 @@ public class FragmentCompose extends FragmentBase {
return null; // send message return null; // send message
else { else {
// Sign message // Sign message
Intent signRequest = new Intent(); Intent intent = new Intent(OpenPgpApi.ACTION_DETACHED_SIGN);
signRequest.setAction(OpenPgpApi.ACTION_DETACHED_SIGN); intent.putExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID, data.getLongExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID, -1));
signRequest.putExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID, data.getLongExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID, -1)); return intent;
return signRequest;
} }
case OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED: case OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED:
@ -1296,13 +1293,18 @@ public class FragmentCompose extends FragmentBase {
} }
} else if (requestCode == ActivityCompose.REQUEST_ENCRYPT) { } else if (requestCode == ActivityCompose.REQUEST_ENCRYPT) {
if (data != null) { if (data != null) {
data.setAction(OpenPgpApi.ACTION_SIGN_AND_ENCRYPT); Intent intent = new Intent(OpenPgpApi.ACTION_SIGN_AND_ENCRYPT);
encrypt(data, false); if (data.hasExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID))
intent.putExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID, data.getLongExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID, -1));
intent.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true);
encrypt(intent, false);
} }
} else if (requestCode == ActivityCompose.REQUEST_SIGN) { } else if (requestCode == ActivityCompose.REQUEST_SIGN) {
if (data != null) { if (data != null) {
data.setAction(OpenPgpApi.ACTION_DETACHED_SIGN); Intent intent = new Intent(OpenPgpApi.ACTION_DETACHED_SIGN);
encrypt(data, true); if (data.hasExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID))
intent.putExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID, data.getLongExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID, -1));
encrypt(intent, true);
} }
} else { } else {
if (data != null) if (data != null)