|
|
|
@ -1101,9 +1101,9 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
for (int i = 0; i < ato.length; i++)
|
|
|
|
|
tos[i] = ato[i].getAddress();
|
|
|
|
|
|
|
|
|
|
Intent data = new Intent(OpenPgpApi.ACTION_GET_SIGN_KEY_ID);
|
|
|
|
|
data.putExtra(OpenPgpApi.EXTRA_USER_IDS, tos);
|
|
|
|
|
encrypt(data);
|
|
|
|
|
Intent intent = new Intent(OpenPgpApi.ACTION_GET_SIGN_KEY_ID);
|
|
|
|
|
intent.putExtra(OpenPgpApi.EXTRA_USER_IDS, tos);
|
|
|
|
|
encrypt(intent);
|
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
|
if (ex instanceof IllegalArgumentException)
|
|
|
|
|
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
|
|
|
|
@ -1206,6 +1206,7 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
: result.getByteArrayExtra(OpenPgpApi.RESULT_DETACHED_SIGNATURE));
|
|
|
|
|
|
|
|
|
|
File file = attachment.getFile(context);
|
|
|
|
|
if (BuildConfig.BETA_RELEASE)
|
|
|
|
|
Log.i("Writing " + file + " size=" + bytes.length);
|
|
|
|
|
try (OutputStream out = new BufferedOutputStream(new FileOutputStream(file))) {
|
|
|
|
|
out.write(bytes);
|
|
|
|
@ -1233,12 +1234,6 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED:
|
|
|
|
|
if (OpenPgpApi.ACTION_GET_SIGN_KEY_ID.equals(data.getAction()))
|
|
|
|
|
args.putInt("request", ActivityCompose.REQUEST_KEY);
|
|
|
|
|
else if (OpenPgpApi.ACTION_SIGN_AND_ENCRYPT.equals(data.getAction()))
|
|
|
|
|
args.putInt("request", ActivityCompose.REQUEST_ENCRYPT);
|
|
|
|
|
else if (OpenPgpApi.ACTION_DETACHED_SIGN.equals(data.getAction()))
|
|
|
|
|
args.putInt("request", ActivityCompose.REQUEST_SIGN);
|
|
|
|
|
return result.getParcelableExtra(OpenPgpApi.RESULT_INTENT);
|
|
|
|
|
|
|
|
|
|
case OpenPgpApi.RESULT_CODE_ERROR:
|
|
|
|
@ -1255,14 +1250,14 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
if (result == null)
|
|
|
|
|
onAction(R.id.action_send);
|
|
|
|
|
else if (result instanceof Intent) {
|
|
|
|
|
Intent data = (Intent) result;
|
|
|
|
|
encrypt(data);
|
|
|
|
|
Intent intent = (Intent) result;
|
|
|
|
|
encrypt(intent);
|
|
|
|
|
} else if (result instanceof PendingIntent)
|
|
|
|
|
try {
|
|
|
|
|
PendingIntent pi = (PendingIntent) result;
|
|
|
|
|
startIntentSenderForResult(
|
|
|
|
|
pi.getIntentSender(),
|
|
|
|
|
args.getInt("request"),
|
|
|
|
|
ActivityCompose.REQUEST_ENCRYPT,
|
|
|
|
|
null, 0, 0, 0, null);
|
|
|
|
|
} catch (IntentSender.SendIntentException ex) {
|
|
|
|
|
Log.e(ex);
|
|
|
|
@ -1305,24 +1300,23 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (requestCode == ActivityCompose.REQUEST_KEY) {
|
|
|
|
|
} else if (requestCode == ActivityCompose.REQUEST_ENCRYPT) {
|
|
|
|
|
if (data != null) {
|
|
|
|
|
if (BuildConfig.BETA_RELEASE)
|
|
|
|
|
Log.logExtras(data);
|
|
|
|
|
if (OpenPgpApi.ACTION_GET_SIGN_KEY_ID.equals(data.getAction())) {
|
|
|
|
|
Intent intent = new Intent(OpenPgpApi.ACTION_SIGN_AND_ENCRYPT);
|
|
|
|
|
|
|
|
|
|
String action = data.getAction();
|
|
|
|
|
if (OpenPgpApi.ACTION_GET_SIGN_KEY_ID.equals(action))
|
|
|
|
|
action = OpenPgpApi.ACTION_SIGN_AND_ENCRYPT;
|
|
|
|
|
|
|
|
|
|
Intent intent = new Intent(action);
|
|
|
|
|
if (data.hasExtra(OpenPgpApi.EXTRA_USER_IDS))
|
|
|
|
|
intent.putExtra(OpenPgpApi.EXTRA_USER_IDS, data.getStringArrayExtra(OpenPgpApi.EXTRA_USER_IDS));
|
|
|
|
|
if (data.hasExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID))
|
|
|
|
|
intent.putExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID, data.getLongExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID, -1));
|
|
|
|
|
if (OpenPgpApi.ACTION_SIGN_AND_ENCRYPT.equals(action))
|
|
|
|
|
intent.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true);
|
|
|
|
|
encrypt(intent);
|
|
|
|
|
} else
|
|
|
|
|
encrypt(data);
|
|
|
|
|
}
|
|
|
|
|
} else if (requestCode == ActivityCompose.REQUEST_ENCRYPT || requestCode == ActivityCompose.REQUEST_SIGN) {
|
|
|
|
|
if (data != null) {
|
|
|
|
|
if (BuildConfig.BETA_RELEASE)
|
|
|
|
|
Log.logExtras(data);
|
|
|
|
|
encrypt(data);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (data != null)
|
|
|
|
|