Notify known pro

This commit is contained in:
M66B 2020-06-07 16:32:14 +02:00
parent 3c9b1899ce
commit 54b184d3b4
4 changed files with 22 additions and 4 deletions

View File

@ -194,7 +194,8 @@ public class ActivityBilling extends ActivityBase implements PurchasesUpdatedLis
static boolean isPro(Context context) { static boolean isPro(Context context) {
if (BuildConfig.DEBUG && false) if (BuildConfig.DEBUG && false)
return true; return true;
return PreferenceManager.getDefaultSharedPreferences(context).getBoolean("pro", false); return PreferenceManager.getDefaultSharedPreferences(context)
.getBoolean("pro", false);
} }
private BroadcastReceiver receiver = new BroadcastReceiver() { private BroadcastReceiver receiver = new BroadcastReceiver() {

View File

@ -1503,6 +1503,7 @@ class Core {
DB db = DB.getInstance(context); DB db = DB.getInstance(context);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean notify_known = prefs.getBoolean("notify_known", false); 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)); Log.i(folder.name + " POP sync type=" + folder.type + " connected=" + (ifolder != null));
@ -1643,7 +1644,7 @@ class Core {
message.sender = MessageHelper.getSortKey(message.from); message.sender = MessageHelper.getSortKey(message.from);
Uri lookupUri = ContactInfo.getLookupUri(message.from); Uri lookupUri = ContactInfo.getLookupUri(message.from);
message.avatar = (lookupUri == null ? null : lookupUri.toString()); message.avatar = (lookupUri == null ? null : lookupUri.toString());
if (message.avatar == null && notify_known) if (message.avatar == null && notify_known && pro)
message.ui_ignored = true; message.ui_ignored = true;
// No MX check // No MX check
@ -2147,6 +2148,7 @@ class Core {
DB db = DB.getInstance(context); DB db = DB.getInstance(context);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean notify_known = prefs.getBoolean("notify_known", false); boolean notify_known = prefs.getBoolean("notify_known", false);
boolean pro = ActivityBilling.isPro(context);
// Find message by uid (fast, no headers required) // Find message by uid (fast, no headers required)
EntityMessage message = db.message().getMessageByUid(folder.id, uid); EntityMessage message = db.message().getMessageByUid(folder.id, uid);
@ -2281,7 +2283,7 @@ class Core {
message.sender = MessageHelper.getSortKey(message.from); message.sender = MessageHelper.getSortKey(message.from);
Uri lookupUri = ContactInfo.getLookupUri(message.from); Uri lookupUri = ContactInfo.getLookupUri(message.from);
message.avatar = (lookupUri == null ? null : lookupUri.toString()); message.avatar = (lookupUri == null ? null : lookupUri.toString());
if (message.avatar == null && notify_known) if (message.avatar == null && notify_known && pro)
message.ui_ignored = true; message.ui_ignored = true;
boolean check_mx = prefs.getBoolean("check_mx", false); boolean check_mx = prefs.getBoolean("check_mx", false);

View File

@ -71,6 +71,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
private SwitchCompat swBadge; private SwitchCompat swBadge;
private SwitchCompat swUnseenIgnored; private SwitchCompat swUnseenIgnored;
private SwitchCompat swNotifyKnown; private SwitchCompat swNotifyKnown;
private TextView tvNotifyKnownPro;
private SwitchCompat swNotifySummary; private SwitchCompat swNotifySummary;
private SwitchCompat swNotifyRemove; private SwitchCompat swNotifyRemove;
private SwitchCompat swNotifyClear; private SwitchCompat swNotifyClear;
@ -129,6 +130,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
swBadge = view.findViewById(R.id.swBadge); swBadge = view.findViewById(R.id.swBadge);
swUnseenIgnored = view.findViewById(R.id.swUnseenIgnored); swUnseenIgnored = view.findViewById(R.id.swUnseenIgnored);
swNotifyKnown = view.findViewById(R.id.swNotifyKnown); swNotifyKnown = view.findViewById(R.id.swNotifyKnown);
tvNotifyKnownPro = view.findViewById(R.id.tvNotifyKnownPro);
swNotifySummary = view.findViewById(R.id.swNotifySummary); swNotifySummary = view.findViewById(R.id.swNotifySummary);
swNotifyRemove = view.findViewById(R.id.swNotifyRemove); swNotifyRemove = view.findViewById(R.id.swNotifyRemove);
swNotifyClear = view.findViewById(R.id.swNotifyClear); swNotifyClear = view.findViewById(R.id.swNotifyClear);
@ -267,6 +269,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
}); });
Helper.linkPro(tvNotifyActionsPro); Helper.linkPro(tvNotifyActionsPro);
Helper.linkPro(tvNotifyKnownPro);
swLight.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { swLight.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override

View File

@ -338,6 +338,18 @@
app:layout_constraintTop_toBottomOf="@id/swUnseenIgnored" app:layout_constraintTop_toBottomOf="@id/swUnseenIgnored"
app:switchPadding="12dp" /> app:switchPadding="12dp" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvNotifyKnownPro"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="48dp"
android:text="@string/title_pro_feature"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="?android:attr/textColorLink"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swNotifyKnown" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swNotifySummary" android:id="@+id/swNotifySummary"
android:layout_width="0dp" android:layout_width="0dp"
@ -346,7 +358,7 @@
android:text="@string/title_advanced_notify_summary" android:text="@string/title_advanced_notify_summary"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swNotifyKnown" app:layout_constraintTop_toBottomOf="@id/tvNotifyKnownPro"
app:switchPadding="12dp" /> app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat