mirror of https://github.com/M66B/FairEmail.git
Added option for public notifications
This commit is contained in:
parent
27bcd73249
commit
e7fffb2c5f
|
@ -5380,6 +5380,7 @@ class Core {
|
|||
boolean pro = ActivityBilling.isPro(context);
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean notify_private = prefs.getBoolean("notify_private", true);
|
||||
boolean notify_newest_first = prefs.getBoolean("notify_newest_first", false);
|
||||
MessageHelper.AddressFormat email_format = MessageHelper.getAddressFormat(context);
|
||||
boolean prefer_contact = prefs.getBoolean("prefer_contact", false);
|
||||
|
@ -5520,10 +5521,12 @@ class Core {
|
|||
|
||||
// Subtext should not be set, to show number of new messages
|
||||
|
||||
Notification pub = builder.build();
|
||||
builder
|
||||
.setVisibility(NotificationCompat.VISIBILITY_PRIVATE)
|
||||
.setPublicVersion(pub);
|
||||
if (notify_private) {
|
||||
Notification pub = builder.build();
|
||||
builder
|
||||
.setVisibility(NotificationCompat.VISIBILITY_PRIVATE)
|
||||
.setPublicVersion(pub);
|
||||
}
|
||||
|
||||
if (notify_preview)
|
||||
if (redacted)
|
||||
|
@ -5618,7 +5621,9 @@ class Core {
|
|||
.setDeleteIntent(piIgnore)
|
||||
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
|
||||
.setCategory(NotificationCompat.CATEGORY_EMAIL)
|
||||
.setVisibility(NotificationCompat.VISIBILITY_PRIVATE)
|
||||
.setVisibility(notify_private
|
||||
? NotificationCompat.VISIBILITY_PRIVATE
|
||||
: NotificationCompat.VISIBILITY_PUBLIC)
|
||||
.setOnlyAlertOnce(alert_once)
|
||||
.setAllowSystemGeneratedContextualActions(false);
|
||||
|
||||
|
|
|
@ -97,6 +97,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
|||
private SwitchCompat swBadge;
|
||||
private ImageButton ibBadge;
|
||||
private SwitchCompat swUnseenIgnored;
|
||||
private SwitchCompat swNotifyPrivate;
|
||||
private SwitchCompat swNotifyBackgroundOnly;
|
||||
private SwitchCompat swNotifyKnownOnly;
|
||||
private SwitchCompat swNotifySuppressInCall;
|
||||
|
@ -134,7 +135,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
|||
"notify_flag", "notify_seen", "notify_hide", "notify_snooze",
|
||||
"light", "sound", "notify_screen_on",
|
||||
"badge", "unseen_ignored",
|
||||
"notify_background_only", "notify_known", "notify_suppress_in_call", "notify_suppress_in_car",
|
||||
"notify_private", "notify_background_only", "notify_known", "notify_suppress_in_call", "notify_suppress_in_car",
|
||||
"notify_remove", "notify_clear",
|
||||
"notify_subtext", "notify_preview", "notify_preview_all", "notify_preview_only", "notify_transliterate",
|
||||
"wearable_preview",
|
||||
|
@ -183,6 +184,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
|||
swBadge = view.findViewById(R.id.swBadge);
|
||||
ibBadge = view.findViewById(R.id.ibBadge);
|
||||
swUnseenIgnored = view.findViewById(R.id.swUnseenIgnored);
|
||||
swNotifyPrivate = view.findViewById(R.id.swNotifyPrivate);
|
||||
swNotifyBackgroundOnly = view.findViewById(R.id.swNotifyBackgroundOnly);
|
||||
swNotifyKnownOnly = view.findViewById(R.id.swNotifyKnownOnly);
|
||||
swNotifySuppressInCall = view.findViewById(R.id.swNotifySuppressInCall);
|
||||
|
@ -539,6 +541,13 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
|||
}
|
||||
});
|
||||
|
||||
swNotifyPrivate.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("notify_private", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
swNotifyBackgroundOnly.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
|
@ -802,6 +811,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
|||
|
||||
swBadge.setChecked(prefs.getBoolean("badge", true));
|
||||
swUnseenIgnored.setChecked(prefs.getBoolean("unseen_ignored", false));
|
||||
swNotifyPrivate.setChecked(prefs.getBoolean("notify_private", true));
|
||||
swNotifyBackgroundOnly.setChecked(prefs.getBoolean("notify_background_only", false));
|
||||
swNotifyKnownOnly.setChecked(prefs.getBoolean("notify_known", false));
|
||||
swNotifySuppressInCall.setChecked(prefs.getBoolean("notify_suppress_in_call", false));
|
||||
|
|
|
@ -526,6 +526,18 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/ibBadge"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swNotifyPrivate"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:checked="true"
|
||||
android:text="@string/title_advanced_notify_private"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swUnseenIgnored"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swNotifyBackgroundOnly"
|
||||
android:layout_width="0dp"
|
||||
|
@ -534,7 +546,7 @@
|
|||
android:text="@string/title_advanced_notify_background"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swUnseenIgnored"
|
||||
app:layout_constraintTop_toBottomOf="@id/swNotifyPrivate"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
|
|
|
@ -671,6 +671,7 @@
|
|||
|
||||
<string name="title_advanced_badge">Show launcher icon with number of new messages</string>
|
||||
<string name="title_advanced_unseen_ignored">Let the number of new messages match the number of notifications</string>
|
||||
<string name="title_advanced_notify_private">Keep notifications private when the device is locked</string>
|
||||
<string name="title_advanced_notify_background">Show notifications when in the background only</string>
|
||||
<string name="title_advanced_notify_known">Show notifications for contacts only</string>
|
||||
<string name="title_advanced_notify_suppress_in_call">Delay notifications while on a call</string>
|
||||
|
|
Loading…
Reference in New Issue