Skip to content

Commit 620bcd9

Browse files
committed
Added "Show the original message" switch to all errors.| #104.
1 parent 721a7c1 commit 620bcd9

File tree

4 files changed

+24
-14
lines changed

4 files changed

+24
-14
lines changed

FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/fragment/MessageDetailsFragment.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -745,11 +745,14 @@ private View generatePgpMessagePart(MessagePartPgpMessage messagePartPgpMessage,
745745
return formatErrorLayout;
746746

747747
default:
748-
TextView textViewMessagePartOther = (TextView) layoutInflater.inflate(
748+
ViewGroup viewGroup = (ViewGroup) layoutInflater.inflate(
749749
R.layout.message_part_pgp_message_error, layoutMessageParts, false);
750-
textViewMessagePartOther.setText(messagePartPgpMessage.getErrorMessage());
750+
TextView textViewErrorMessage = viewGroup.findViewById(R.id.textViewErrorMessage);
751+
textViewErrorMessage.setText(messagePartPgpMessage.getErrorMessage());
752+
viewGroup.addView(generateShowOriginalMessageLayout
753+
(messagePartPgpMessage.getValue(), layoutInflater, viewGroup));
751754

752-
return textViewMessagePartOther;
755+
return viewGroup;
753756
}
754757
}
755758
} else return new TextView(getContext());

FlowCrypt/src/main/java/com/flowcrypt/email/ui/loader/DecryptMessageAsyncTaskLoader.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,8 @@ private MessagePartPgpMessage generateMessagePartPgpMessage(Js js, MessageBlock
233233
pgpMessageDecryptError = MessagePartPgpMessage.PgpMessageDecryptError.MISSING_PASS_PHRASES;
234234
} else if (Objects.equals(pgpDecrypted.countPotentiallyMatchingKeys(), pgpDecrypted.countAttempts())) {
235235
pgpMessageDecryptError = MessagePartPgpMessage.PgpMessageDecryptError.MISSING_PRIVATE_KEY;
236-
errorMessage = getContext().getString(R.string.decrypt_error_single_sender);
236+
errorMessage = getContext().getString(R.string.decrypt_error_could_not_open_message) +
237+
"\n\n" + getContext().getString(R.string.decrypt_error_single_sender);
237238
} else if (pgpDecrypted.countUnsecureMdcErrors() > 0) {
238239
pgpMessageDecryptError = MessagePartPgpMessage.PgpMessageDecryptError.UNSECURED_MDC_ERROR;
239240
} else if (pgpDecrypted.getOtherErrors() != null && pgpDecrypted.getOtherErrors().length > 0) {

FlowCrypt/src/main/res/layout/message_part_pgp_message_error.xml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,23 @@
44
~ Contributors: DenBond7
55
-->
66

7-
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
7+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
88
xmlns:tools="http://schemas.android.com/tools"
9-
android:id="@+id/textViewMessagePartPgpMessage"
109
android:layout_width="match_parent"
1110
android:layout_height="wrap_content"
12-
android:layout_marginBottom="@dimen/default_margin_medium"
13-
android:autoLink="web"
1411
android:background="@drawable/bg_message_part_pgp_message_error"
15-
android:textColor="@android:color/black"
16-
android:textIsSelectable="true"
17-
android:textSize="@dimen/default_text_size_medium"
18-
tools:text="At nihil sequi quo maiores molestiae consequatur. Id aut nam voluptate doloribus saepe consequatur molestias. Eos sunt est ipsam accusantium saepe doloribus veritatis.
12+
android:orientation="vertical">
1913

20-
Recusandae velit sit veniam asperiores nisi. Eius tempore ab voluptatum dolorum nihil qui beatae. Et cum au" />
14+
<TextView
15+
android:id="@+id/textViewErrorMessage"
16+
android:layout_width="match_parent"
17+
android:layout_height="wrap_content"
18+
android:layout_marginBottom="@dimen/default_margin_medium"
19+
android:autoLink="web"
20+
android:textColor="@android:color/black"
21+
android:textIsSelectable="true"
22+
android:textSize="@dimen/default_text_size_medium"
23+
tools:text="At nihil sequi quo maiores molestiae consequatur. Id aut nam voluptate doloribus saepe consequatur molestias. Eos sunt est ipsam accusantium saepe doloribus veritatis.
24+
25+
Recusandae velit sit veniam asperiores nisi. Eius tempore ab voluptatum dolorum nihil qui beatae. Et cum au" />
26+
</LinearLayout>

FlowCrypt/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@
209209
respond very promptly.</string>
210210
<string name="decrypt_error_single_sender">Normally, messages are encrypted for at least two people
211211
(sender and the receiver). It seems the sender encrypted this message manually for themselves,
212-
and forgot to add you as a receiver. </string>
212+
and forgot to add you as a receiver. Please ask them to send a new message.</string>
213213
<string name="diagnostic_info">Diagnostic info</string>
214214
<string name="email_does_not_available_in_this_folder">Message not found, it may have been moved to another folder.</string>
215215
<string name="from">From</string>

0 commit comments

Comments
 (0)