From 54b184d3b4ec7794ee136aedad5bb1e683b3fe36 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 7 Jun 2020 16:32:14 +0200 Subject: [PATCH] Notify known pro --- .../java/eu/faircode/email/ActivityBilling.java | 3 ++- app/src/main/java/eu/faircode/email/Core.java | 6 ++++-- .../email/FragmentOptionsNotifications.java | 3 +++ .../res/layout/fragment_options_notifications.xml | 14 +++++++++++++- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ActivityBilling.java b/app/src/main/java/eu/faircode/email/ActivityBilling.java index 66b153bca4..a136c1afa7 100644 --- a/app/src/main/java/eu/faircode/email/ActivityBilling.java +++ b/app/src/main/java/eu/faircode/email/ActivityBilling.java @@ -194,7 +194,8 @@ public class ActivityBilling extends ActivityBase implements PurchasesUpdatedLis static boolean isPro(Context context) { if (BuildConfig.DEBUG && false) return true; - return PreferenceManager.getDefaultSharedPreferences(context).getBoolean("pro", false); + return PreferenceManager.getDefaultSharedPreferences(context) + .getBoolean("pro", false); } private BroadcastReceiver receiver = new BroadcastReceiver() { diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index febc6b03d5..e97850cca7 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -1503,6 +1503,7 @@ class Core { DB db = DB.getInstance(context); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); boolean notify_known = prefs.getBoolean("notify_known", false); + boolean pro = ActivityBilling.isPro(context); Log.i(folder.name + " POP sync type=" + folder.type + " connected=" + (ifolder != null)); @@ -1643,7 +1644,7 @@ class Core { message.sender = MessageHelper.getSortKey(message.from); Uri lookupUri = ContactInfo.getLookupUri(message.from); message.avatar = (lookupUri == null ? null : lookupUri.toString()); - if (message.avatar == null && notify_known) + if (message.avatar == null && notify_known && pro) message.ui_ignored = true; // No MX check @@ -2147,6 +2148,7 @@ class Core { DB db = DB.getInstance(context); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); boolean notify_known = prefs.getBoolean("notify_known", false); + boolean pro = ActivityBilling.isPro(context); // Find message by uid (fast, no headers required) EntityMessage message = db.message().getMessageByUid(folder.id, uid); @@ -2281,7 +2283,7 @@ class Core { message.sender = MessageHelper.getSortKey(message.from); Uri lookupUri = ContactInfo.getLookupUri(message.from); message.avatar = (lookupUri == null ? null : lookupUri.toString()); - if (message.avatar == null && notify_known) + if (message.avatar == null && notify_known && pro) message.ui_ignored = true; boolean check_mx = prefs.getBoolean("check_mx", false); diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java b/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java index a20d55d351..1b51390edf 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java @@ -71,6 +71,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared private SwitchCompat swBadge; private SwitchCompat swUnseenIgnored; private SwitchCompat swNotifyKnown; + private TextView tvNotifyKnownPro; private SwitchCompat swNotifySummary; private SwitchCompat swNotifyRemove; private SwitchCompat swNotifyClear; @@ -129,6 +130,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared swBadge = view.findViewById(R.id.swBadge); swUnseenIgnored = view.findViewById(R.id.swUnseenIgnored); swNotifyKnown = view.findViewById(R.id.swNotifyKnown); + tvNotifyKnownPro = view.findViewById(R.id.tvNotifyKnownPro); swNotifySummary = view.findViewById(R.id.swNotifySummary); swNotifyRemove = view.findViewById(R.id.swNotifyRemove); swNotifyClear = view.findViewById(R.id.swNotifyClear); @@ -267,6 +269,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared }); Helper.linkPro(tvNotifyActionsPro); + Helper.linkPro(tvNotifyKnownPro); swLight.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override diff --git a/app/src/main/res/layout/fragment_options_notifications.xml b/app/src/main/res/layout/fragment_options_notifications.xml index b0e19bf228..8384b369c6 100644 --- a/app/src/main/res/layout/fragment_options_notifications.xml +++ b/app/src/main/res/layout/fragment_options_notifications.xml @@ -338,6 +338,18 @@ app:layout_constraintTop_toBottomOf="@id/swUnseenIgnored" app:switchPadding="12dp" /> + +