mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-25 23:43:07 +00:00
Explain signed data
This commit is contained in:
parent
a17ca96453
commit
610dc68817
3 changed files with 35 additions and 5 deletions
|
@ -382,6 +382,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
private ImageButton ibJunk;
|
||||
private ImageButton ibVerify;
|
||||
private ImageButton ibDecrypt;
|
||||
private TextView tvSignedData;
|
||||
|
||||
private TextView tvBody;
|
||||
private View wvBody;
|
||||
|
@ -571,6 +572,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
ibJunk = vsBody.findViewById(R.id.ibJunk);
|
||||
ibVerify = vsBody.findViewById(R.id.ibVerify);
|
||||
ibDecrypt = vsBody.findViewById(R.id.ibDecrypt);
|
||||
tvSignedData = vsBody.findViewById(R.id.tvSignedData);
|
||||
|
||||
tvBody = vsBody.findViewById(R.id.tvBody);
|
||||
wvBody = vsBody.findViewById(R.id.wvBody);
|
||||
|
@ -1160,6 +1162,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
ibJunk.setVisibility(View.GONE);
|
||||
ibVerify.setVisibility(View.GONE);
|
||||
ibDecrypt.setVisibility(View.GONE);
|
||||
tvSignedData.setVisibility(View.GONE);
|
||||
|
||||
tvBody.setVisibility(View.GONE);
|
||||
wvBody.setVisibility(View.GONE);
|
||||
|
@ -1284,8 +1287,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
ibUnsubscribe.setVisibility(View.GONE);
|
||||
ibJunk.setEnabled(false);
|
||||
ibJunk.setVisibility(View.GONE);
|
||||
ibDecrypt.setVisibility(View.GONE);
|
||||
ibVerify.setVisibility(View.GONE);
|
||||
ibDecrypt.setVisibility(View.GONE);
|
||||
tvSignedData.setVisibility(View.GONE);
|
||||
|
||||
// Addresses
|
||||
ibExpanderAddress.setImageLevel(show_addresses ? 0 /* less */ : 1 /* more */);
|
||||
|
@ -1641,11 +1645,25 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
if (message == null || !message.content)
|
||||
return null;
|
||||
|
||||
DB db = DB.getInstance(context);
|
||||
List<EntityAttachment> attachments = db.attachment().getAttachments(message.id);
|
||||
|
||||
boolean signed_data = false;
|
||||
for (EntityAttachment attachment : attachments)
|
||||
if (EntityAttachment.SMIME_SIGNED_DATA.equals(attachment.encryption)) {
|
||||
signed_data = true;
|
||||
break;
|
||||
}
|
||||
|
||||
File file = message.getFile(context);
|
||||
if (!file.exists())
|
||||
return null;
|
||||
|
||||
String body = Helper.readText(file);
|
||||
if (!TextUtils.isEmpty(body))
|
||||
signed_data = false;
|
||||
args.putBoolean("signed_data", signed_data);
|
||||
|
||||
Document document = JsoupEx.parse(body);
|
||||
|
||||
// Check for inline encryption
|
||||
|
@ -1670,12 +1688,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
args.putBoolean("has_images", has_images);
|
||||
|
||||
// Download inline images
|
||||
if (show_images) {
|
||||
DB db = DB.getInstance(context);
|
||||
if (show_images)
|
||||
try {
|
||||
db.beginTransaction();
|
||||
|
||||
List<EntityAttachment> attachments = db.attachment().getAttachments(message.id);
|
||||
for (EntityAttachment attachment : attachments)
|
||||
if (attachment.isInline() && attachment.isImage() &&
|
||||
attachment.progress == null && !attachment.available)
|
||||
|
@ -1685,7 +1701,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
} finally {
|
||||
db.endTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
// Format message
|
||||
if (show_full) {
|
||||
|
@ -1838,6 +1853,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
EntityMessage.PGP_SIGNENCRYPT.equals(message.encrypt) ||
|
||||
EntityMessage.SMIME_SIGNENCRYPT.equals(message.encrypt)
|
||||
? View.VISIBLE : View.GONE);
|
||||
|
||||
boolean signed_data = args.getBoolean("signed_data");
|
||||
tvSignedData.setVisibility(signed_data ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -141,6 +141,17 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/vSeparatorBottom"
|
||||
app:srcCompat="@drawable/baseline_fullscreen_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSignedData"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@string/title_signed_data"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/ibVerify" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/grpActions"
|
||||
android:layout_width="0dp"
|
||||
|
|
|
@ -797,6 +797,7 @@
|
|||
<string name="title_resync">Resync</string>
|
||||
<string name="title_no_openpgp">OpenKeychain not found</string>
|
||||
<string name="title_user_interaction">Transferring to OpenKeychain</string>
|
||||
<string name="title_signed_data">Verify the signature to show the message text</string>
|
||||
<string name="title_not_encrypted">Message is not signed or encrypted</string>
|
||||
<string name="title_reset_sign_key">Reset sign key</string>
|
||||
|
||||
|
|
Loading…
Reference in a new issue