Fixed send now with encryption

This commit is contained in:
M66B 2020-05-05 11:20:02 +02:00
parent edf448c932
commit 8b4e40bb2c
1 changed files with 9 additions and 7 deletions

View File

@ -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) || if (EntityMessage.SMIME_SIGNONLY.equals(draft.ui_encrypt) ||
EntityMessage.SMIME_SIGNENCRYPT.equals(draft.ui_encrypt)) { EntityMessage.SMIME_SIGNENCRYPT.equals(draft.ui_encrypt)) {
Bundle args = new Bundle(); Bundle args = new Bundle();
@ -1575,7 +1575,7 @@ public class FragmentCompose extends FragmentBase {
boolean available = args.getBoolean("available"); boolean available = args.getBoolean("available");
if (available) { if (available) {
args.putString("alias", identity.sign_key_alias); args.putString("alias", identity.sign_key_alias);
onSmime(args, action); onSmime(args, action, extras);
return; return;
} }
@ -1585,7 +1585,7 @@ public class FragmentCompose extends FragmentBase {
public void onSelected(String alias) { public void onSelected(String alias) {
args.putString("alias", alias); args.putString("alias", alias);
if (alias != null) if (alias != null)
onSmime(args, action); onSmime(args, action, extras);
} }
@Override @Override
@ -1643,6 +1643,7 @@ public class FragmentCompose extends FragmentBase {
Bundle largs = new Bundle(); Bundle largs = new Bundle();
largs.putLong("id", working); largs.putLong("id", working);
largs.putInt("action", action); largs.putInt("action", action);
largs.putBundle("extras", extras);
largs.putBoolean("interactive", interactive); largs.putBoolean("interactive", interactive);
intent.putExtra(BuildConfig.APPLICATION_ID, largs); intent.putExtra(BuildConfig.APPLICATION_ID, largs);
@ -2209,12 +2210,14 @@ public class FragmentCompose extends FragmentBase {
// send message // send message
args.putInt("action", largs.getInt("action")); args.putInt("action", largs.getInt("action"));
args.putBundle("extras", largs.getBundle("extras"));
return null; return null;
} else if (OpenPgpApi.ACTION_SIGN_AND_ENCRYPT.equals(data.getAction())) { } else if (OpenPgpApi.ACTION_SIGN_AND_ENCRYPT.equals(data.getAction())) {
input.delete(); input.delete();
// send message // send message
args.putInt("action", largs.getInt("action")); args.putInt("action", largs.getInt("action"));
args.putBundle("extras", largs.getBundle("extras"));
return null; return null;
} else } else
throw new IllegalStateException("Unknown action=" + data.getAction()); throw new IllegalStateException("Unknown action=" + data.getAction());
@ -2245,7 +2248,7 @@ public class FragmentCompose extends FragmentBase {
Log.i("Result= " + result); Log.i("Result= " + result);
if (result == null) { if (result == null) {
int action = args.getInt("action"); int action = args.getInt("action");
Bundle extras = new Bundle(); Bundle extras = args.getBundle("extras");
extras.putBoolean("encrypted", true); extras.putBoolean("encrypted", true);
onAction(action, extras, "pgp"); onAction(action, extras, "pgp");
} else if (result instanceof Intent) { } else if (result instanceof Intent) {
@ -2283,7 +2286,7 @@ public class FragmentCompose extends FragmentBase {
}.execute(this, args, "compose:pgp"); }.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<Void>() { new SimpleTask<Void>() {
@Override @Override
protected Void onExecute(Context context, Bundle args) throws Throwable { protected Void onExecute(Context context, Bundle args) throws Throwable {
@ -2510,7 +2513,6 @@ public class FragmentCompose extends FragmentBase {
@Override @Override
protected void onExecuted(Bundle args, Void result) { protected void onExecuted(Bundle args, Void result) {
Bundle extras = new Bundle();
extras.putBoolean("encrypted", true); extras.putBoolean("encrypted", true);
onAction(action, extras, "smime"); onAction(action, extras, "smime");
} }
@ -4255,7 +4257,7 @@ public class FragmentCompose extends FragmentBase {
EntityMessage.PGP_SIGNONLY.equals(draft.ui_encrypt) || EntityMessage.PGP_SIGNONLY.equals(draft.ui_encrypt) ||
EntityMessage.PGP_SIGNENCRYPT.equals(draft.ui_encrypt)) { EntityMessage.PGP_SIGNENCRYPT.equals(draft.ui_encrypt)) {
boolean interactive = args.getBoolean("interactive"); boolean interactive = args.getBoolean("interactive");
onEncrypt(draft, action, interactive); onEncrypt(draft, action, extras, interactive);
} else } else
startActivity(new Intent(getContext(), ActivityBilling.class)); startActivity(new Intent(getContext(), ActivityBilling.class));
return; return;