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) ||
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<Void>() {
@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;