Skip to content

Commit

Permalink
Attempt to fix Samsung badge count
Browse files Browse the repository at this point in the history
  • Loading branch information
M66B committed Nov 8, 2024
1 parent 9c10b96 commit 0c5cfa5
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/src/main/java/eu/faircode/email/NotificationHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,8 @@ private static List<NotificationCompat.Builder> getNotificationUnseen(
boolean pro = ActivityBilling.isPro(context);

SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean badge = prefs.getBoolean("badge", true);
boolean unseen_ignored = prefs.getBoolean("unseen_ignored", false);
boolean notify_grouping = prefs.getBoolean("notify_grouping", true);
boolean notify_private = prefs.getBoolean("notify_private", true);
boolean notify_newest_first = prefs.getBoolean("notify_newest_first", false);
Expand Down Expand Up @@ -780,14 +782,21 @@ private static List<NotificationCompat.Builder> getNotificationUnseen(
: R.drawable.baseline_mail_white_24)
.setContentTitle(title)
.setContentIntent(piContent)
.setNumber(total_messages)
.setDeleteIntent(piClear)
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
.setCategory(notify_summary
? NotificationCompat.CATEGORY_EMAIL : NotificationCompat.CATEGORY_STATUS)
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
.setAllowSystemGeneratedContextualActions(false);

// https://github.com/leolin310148/ShortcutBadger/issues/266
if (badge && !unseen_ignored /* Unseen */ &&
Helper.isSamsung() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
EntityLog.log(context, "Notify no number" +
" badge=" + badge + " unseen_ignored=" + unseen_ignored);
else
builder.setNumber(total_messages);

if (latest != null)
builder.setWhen(latest).setShowWhen(true);

Expand Down

0 comments on commit 0c5cfa5

Please sign in to comment.