mirror of https://github.com/M66B/FairEmail.git
Auto select certificate
This commit is contained in:
parent
a4e5403f9d
commit
c02e5992ec
|
@ -1264,10 +1264,39 @@ public class FragmentCompose extends FragmentBase {
|
||||||
args.putString("alias", alias);
|
args.putString("alias", alias);
|
||||||
|
|
||||||
if (EntityMessage.SMIME_SIGNENCRYPT.equals(draft.encrypt)) {
|
if (EntityMessage.SMIME_SIGNENCRYPT.equals(draft.encrypt)) {
|
||||||
|
new SimpleTask<Long>() {
|
||||||
|
@Override
|
||||||
|
protected Long onExecute(Context context, Bundle args) throws Throwable {
|
||||||
|
String email = args.getString("email");
|
||||||
|
if (email == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
DB db = DB.getInstance(context);
|
||||||
|
List<EntityCertificate> certs = db.certificate().getCertificateByEmail(email);
|
||||||
|
if (certs == null || certs.size() != 1)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return certs.get(0).id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onExecuted(Bundle args, Long id) {
|
||||||
|
if (id == null) {
|
||||||
FragmentDialogCertificate fragment = new FragmentDialogCertificate();
|
FragmentDialogCertificate fragment = new FragmentDialogCertificate();
|
||||||
fragment.setArguments(args);
|
fragment.setArguments(args);
|
||||||
fragment.setTargetFragment(FragmentCompose.this, REQUEST_CERTIFICATE);
|
fragment.setTargetFragment(FragmentCompose.this, REQUEST_CERTIFICATE);
|
||||||
fragment.show(getParentFragmentManager(), "compose:certificate");
|
fragment.show(getParentFragmentManager(), "certificate:select");
|
||||||
|
} else {
|
||||||
|
args.putLong("certificate", id);
|
||||||
|
onSmime(args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onException(Bundle args, Throwable ex) {
|
||||||
|
Helper.unexpectedError(getParentFragmentManager(), ex);
|
||||||
|
}
|
||||||
|
}.execute(FragmentCompose.this, args, "certificate:find");
|
||||||
} else
|
} else
|
||||||
onSmime(args);
|
onSmime(args);
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
|
|
Loading…
Reference in New Issue