1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-31 20:25:38 +00:00

Show sender domain which will be blocked

This commit is contained in:
M66B 2021-11-08 13:40:00 +01:00
parent 52492467a1
commit 9d2bb498a0
3 changed files with 6 additions and 3 deletions

View file

@ -305,12 +305,13 @@ public class FragmentDialogJunk extends FragmentDialogBase {
}
});
String domain = null;
try {
boolean common = false;
Address[] froms = MessageHelper.parseAddresses(context, from);
String email = (froms.length == 0 ? null : ((InternetAddress) froms[0]).getAddress());
int at = (email == null ? -1 : email.indexOf('@'));
String domain = (at > 0 ? email.substring(at + 1).toLowerCase(Locale.ROOT) : null);
domain = (at > 0 ? email.substring(at + 1).toLowerCase(Locale.ROOT) : null);
if (domain != null) {
List<String> domains = EmailProvider.getDomainNames(context);
@ -341,6 +342,8 @@ public class FragmentDialogJunk extends FragmentDialogBase {
cbBlockSender.setEnabled(canBlock);
cbBlockDomain.setEnabled(false);
cbBlockSender.setChecked(canBlock);
cbBlockDomain.setText(getString(R.string.title_block_sender_domain, domain));
cbBlockDomain.setVisibility(domain == null ? View.GONE : View.VISIBLE);
ibMore.setImageLevel(1);
cbBlocklist.setChecked(check_blocklist && use_blocklist);
tvBlocklist.setText(TextUtils.join(", ", DnsBlockList.getNamesEnabled(context)));

View file

@ -66,7 +66,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:text="@string/title_block_domain"
android:text="@string/title_block_sender_domain"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbBlockSender" />

View file

@ -92,7 +92,7 @@
<string name="title_block">Block %1$s</string>
<string name="title_block_sender">Block sender</string>
<string name="title_block_domain">Block sender domain</string>
<string name="title_block_sender_domain">Block domain \'%1$s\'</string>
<string name="title_block_sender_hint">
Blocking a sender is a free feature.
Blocking a sender domain uses filter rules, which is a pro feature.