From 23d633b198df0306865578c1b9996cdeff8a6e1f Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 29 Jan 2021 10:07:44 +0100 Subject: [PATCH] Check if sender can be blocked --- .../main/java/eu/faircode/email/AdapterMessage.java | 10 +++++++++- app/src/main/java/eu/faircode/email/EntityRule.java | 3 ++- .../main/java/eu/faircode/email/FragmentMessages.java | 7 +++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/AdapterMessage.java b/app/src/main/java/eu/faircode/email/AdapterMessage.java index e2fdddacf7..1bc7f06695 100644 --- a/app/src/main/java/eu/faircode/email/AdapterMessage.java +++ b/app/src/main/java/eu/faircode/email/AdapterMessage.java @@ -4007,6 +4007,12 @@ public class AdapterMessage extends RecyclerView.Adapter 0) { + String email = ((InternetAddress) message.from[0]).getAddress(); + canBlock = !TextUtils.isEmpty(email) && Helper.EMAIL_ADDRESS.matcher(email).matches(); + } + Bundle aargs = new Bundle(); aargs.putLong("id", message.id); aargs.putLong("account", message.account); @@ -4015,6 +4021,7 @@ public class AdapterMessage extends RecyclerView.Adapter 0) { + String email = ((InternetAddress) message.from[0]).getAddress(); + canBlock = !TextUtils.isEmpty(email) && Helper.EMAIL_ADDRESS.matcher(email).matches(); + } + Bundle aargs = new Bundle(); aargs.putLong("id", message.id); aargs.putLong("account", message.account); @@ -2269,6 +2275,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. aargs.putString("type", message.folderType); aargs.putString("from", MessageHelper.formatAddresses(message.from)); aargs.putBoolean("inJunk", EntityFolder.JUNK.equals(message.folderType)); + aargs.putBoolean("canBlock", canBlock); AdapterMessage.FragmentDialogJunk ask = new AdapterMessage.FragmentDialogJunk(); ask.setArguments(aargs);