mirror of https://github.com/M66B/FairEmail.git
Suppress notification content when using biometric authentication
This commit is contained in:
parent
955c997736
commit
cb5fd98909
|
@ -1799,6 +1799,7 @@ class Core {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
|
boolean biometrics = prefs.getBoolean("biometrics", false);
|
||||||
boolean badge = prefs.getBoolean("badge", true);
|
boolean badge = prefs.getBoolean("badge", true);
|
||||||
boolean pro = Helper.isPro(context);
|
boolean pro = Helper.isPro(context);
|
||||||
|
|
||||||
|
@ -1883,7 +1884,7 @@ class Core {
|
||||||
|
|
||||||
for (Notification notification : notifications) {
|
for (Notification notification : notifications) {
|
||||||
long id = notification.extras.getLong("id", 0);
|
long id = notification.extras.getLong("id", 0);
|
||||||
if ((id == 0 && add.size() + remove.size() > 0) || add.contains(id)) {
|
if ((id == 0 && add.size() + remove.size() > 0) || (add.contains(id) && !biometrics)) {
|
||||||
String tag = "unseen." + group + "." + Math.abs(id);
|
String tag = "unseen." + group + "." + Math.abs(id);
|
||||||
Log.i("Notifying tag=" + tag +
|
Log.i("Notifying tag=" + tag +
|
||||||
(Build.VERSION.SDK_INT < Build.VERSION_CODES.O ? "" : " channel=" + notification.getChannelId()));
|
(Build.VERSION.SDK_INT < Build.VERSION_CODES.O ? "" : " channel=" + notification.getChannelId()));
|
||||||
|
@ -1928,6 +1929,7 @@ class Core {
|
||||||
boolean pro = Helper.isPro(context);
|
boolean pro = Helper.isPro(context);
|
||||||
|
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
|
boolean biometrics = prefs.getBoolean("biometrics", false);
|
||||||
boolean flags = prefs.getBoolean("flags", true);
|
boolean flags = prefs.getBoolean("flags", true);
|
||||||
boolean notify_preview = prefs.getBoolean("notify_preview", true);
|
boolean notify_preview = prefs.getBoolean("notify_preview", true);
|
||||||
boolean notify_trash = (prefs.getBoolean("notify_trash", true) || !pro);
|
boolean notify_trash = (prefs.getBoolean("notify_trash", true) || !pro);
|
||||||
|
@ -1965,29 +1967,32 @@ class Core {
|
||||||
.setDeleteIntent(piClear)
|
.setDeleteIntent(piClear)
|
||||||
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
|
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
|
||||||
.setCategory(NotificationCompat.CATEGORY_STATUS)
|
.setCategory(NotificationCompat.CATEGORY_STATUS)
|
||||||
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
|
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC);
|
||||||
.setGroup(group)
|
|
||||||
.setGroupSummary(true)
|
|
||||||
.setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_CHILDREN);
|
|
||||||
|
|
||||||
Notification pub = builder.build();
|
Notification pub = builder.build();
|
||||||
builder
|
builder
|
||||||
.setVisibility(NotificationCompat.VISIBILITY_PRIVATE)
|
.setVisibility(NotificationCompat.VISIBILITY_PRIVATE)
|
||||||
.setPublicVersion(pub);
|
.setPublicVersion(pub);
|
||||||
|
|
||||||
DateFormat df = SimpleDateFormat.getDateTimeInstance(SimpleDateFormat.SHORT, SimpleDateFormat.SHORT);
|
if (!biometrics) {
|
||||||
StringBuilder sb = new StringBuilder();
|
builder.setGroup(group)
|
||||||
for (EntityMessage message : messages) {
|
.setGroupSummary(true)
|
||||||
sb.append("<strong>").append(messageContact.get(message).getDisplayName(true)).append("</strong>");
|
.setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_CHILDREN);
|
||||||
if (!TextUtils.isEmpty(message.subject))
|
|
||||||
sb.append(": ").append(message.subject);
|
|
||||||
sb.append(" ").append(df.format(message.received));
|
|
||||||
sb.append("<br>");
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.setStyle(new NotificationCompat.BigTextStyle()
|
DateFormat df = SimpleDateFormat.getDateTimeInstance(SimpleDateFormat.SHORT, SimpleDateFormat.SHORT);
|
||||||
.bigText(HtmlHelper.fromHtml(sb.toString()))
|
StringBuilder sb = new StringBuilder();
|
||||||
.setSummaryText(title));
|
for (EntityMessage message : messages) {
|
||||||
|
sb.append("<strong>").append(messageContact.get(message).getDisplayName(true)).append("</strong>");
|
||||||
|
if (!TextUtils.isEmpty(message.subject))
|
||||||
|
sb.append(": ").append(message.subject);
|
||||||
|
sb.append(" ").append(df.format(message.received));
|
||||||
|
sb.append("<br>");
|
||||||
|
}
|
||||||
|
|
||||||
|
builder.setStyle(new NotificationCompat.BigTextStyle()
|
||||||
|
.bigText(HtmlHelper.fromHtml(sb.toString()))
|
||||||
|
.setSummaryText(title));
|
||||||
|
}
|
||||||
|
|
||||||
notifications.add(builder.build());
|
notifications.add(builder.build());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue