|
|
|
@ -3222,12 +3222,8 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
EntityIdentity identity = db.identity().getIdentity(draft.identity);
|
|
|
|
|
if (identity != null && identity.sign_key_alias != null)
|
|
|
|
|
try {
|
|
|
|
|
Pair<String, String> aliases = identity.getAliases();
|
|
|
|
|
if (aliases != null && aliases.first != null) {
|
|
|
|
|
args.putString("alias", aliases.first);
|
|
|
|
|
PrivateKey key = KeyChain.getPrivateKey(context, aliases.first);
|
|
|
|
|
args.putBoolean("available", key != null);
|
|
|
|
|
}
|
|
|
|
|
PrivateKey key = KeyChain.getPrivateKey(context, identity.sign_key_alias);
|
|
|
|
|
args.putBoolean("available", key != null);
|
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
|
Log.w(ex);
|
|
|
|
|
}
|
|
|
|
@ -3242,13 +3238,13 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
|
|
|
|
|
boolean available = args.getBoolean("available");
|
|
|
|
|
if (available) {
|
|
|
|
|
args.putString("alias", identity.sign_key_alias);
|
|
|
|
|
onSmime(args, action, extras);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (interactive) {
|
|
|
|
|
String alias = args.getString("alias");
|
|
|
|
|
Helper.selectKeyAlias(getActivity(), getViewLifecycleOwner(), alias, new Helper.IKeyAlias() {
|
|
|
|
|
if (interactive)
|
|
|
|
|
Helper.selectKeyAlias(getActivity(), getViewLifecycleOwner(), identity.sign_key_alias, new Helper.IKeyAlias() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onSelected(String alias) {
|
|
|
|
|
args.putString("alias", alias);
|
|
|
|
@ -3273,7 +3269,6 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
snackbar.show();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -4468,8 +4463,7 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Store selected alias
|
|
|
|
|
identity.setAlias(alias, true);
|
|
|
|
|
db.identity().setIdentitySignKeyAlias(identity.id, identity.sign_key_alias);
|
|
|
|
|
db.identity().setIdentitySignKeyAlias(identity.id, alias);
|
|
|
|
|
|
|
|
|
|
// Build content
|
|
|
|
|
File sinput = new File(tmp, draft.id + ".smime_sign");
|
|
|
|
|