From 8b4e40bb2c6e39de754c6b170b92bdf3ab108b0f Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 5 May 2020 11:20:02 +0200 Subject: [PATCH] Fixed send now with encryption --- .../java/eu/faircode/email/FragmentCompose.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index c0b747346d..498863ce81 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -1538,7 +1538,7 @@ public class FragmentCompose extends FragmentBase { } } - private void onEncrypt(final EntityMessage draft, final int action, final boolean interactive) { + private void onEncrypt(final EntityMessage draft, final int action, final Bundle extras, final boolean interactive) { if (EntityMessage.SMIME_SIGNONLY.equals(draft.ui_encrypt) || EntityMessage.SMIME_SIGNENCRYPT.equals(draft.ui_encrypt)) { Bundle args = new Bundle(); @@ -1575,7 +1575,7 @@ public class FragmentCompose extends FragmentBase { boolean available = args.getBoolean("available"); if (available) { args.putString("alias", identity.sign_key_alias); - onSmime(args, action); + onSmime(args, action, extras); return; } @@ -1585,7 +1585,7 @@ public class FragmentCompose extends FragmentBase { public void onSelected(String alias) { args.putString("alias", alias); if (alias != null) - onSmime(args, action); + onSmime(args, action, extras); } @Override @@ -1643,6 +1643,7 @@ public class FragmentCompose extends FragmentBase { Bundle largs = new Bundle(); largs.putLong("id", working); largs.putInt("action", action); + largs.putBundle("extras", extras); largs.putBoolean("interactive", interactive); intent.putExtra(BuildConfig.APPLICATION_ID, largs); @@ -2209,12 +2210,14 @@ public class FragmentCompose extends FragmentBase { // send message args.putInt("action", largs.getInt("action")); + args.putBundle("extras", largs.getBundle("extras")); return null; } else if (OpenPgpApi.ACTION_SIGN_AND_ENCRYPT.equals(data.getAction())) { input.delete(); // send message args.putInt("action", largs.getInt("action")); + args.putBundle("extras", largs.getBundle("extras")); return null; } else throw new IllegalStateException("Unknown action=" + data.getAction()); @@ -2245,7 +2248,7 @@ public class FragmentCompose extends FragmentBase { Log.i("Result= " + result); if (result == null) { int action = args.getInt("action"); - Bundle extras = new Bundle(); + Bundle extras = args.getBundle("extras"); extras.putBoolean("encrypted", true); onAction(action, extras, "pgp"); } else if (result instanceof Intent) { @@ -2283,7 +2286,7 @@ public class FragmentCompose extends FragmentBase { }.execute(this, args, "compose:pgp"); } - private void onSmime(Bundle args, final int action) { + private void onSmime(Bundle args, final int action, final Bundle extras) { new SimpleTask() { @Override protected Void onExecute(Context context, Bundle args) throws Throwable { @@ -2510,7 +2513,6 @@ public class FragmentCompose extends FragmentBase { @Override protected void onExecuted(Bundle args, Void result) { - Bundle extras = new Bundle(); extras.putBoolean("encrypted", true); onAction(action, extras, "smime"); } @@ -4255,7 +4257,7 @@ public class FragmentCompose extends FragmentBase { EntityMessage.PGP_SIGNONLY.equals(draft.ui_encrypt) || EntityMessage.PGP_SIGNENCRYPT.equals(draft.ui_encrypt)) { boolean interactive = args.getBoolean("interactive"); - onEncrypt(draft, action, interactive); + onEncrypt(draft, action, extras, interactive); } else startActivity(new Intent(getContext(), ActivityBilling.class)); return;