diff --git a/app/src/main/java/eu/faircode/email/NotificationHelper.java b/app/src/main/java/eu/faircode/email/NotificationHelper.java index dc42af3ab5..d8dd3149db 100644 --- a/app/src/main/java/eu/faircode/email/NotificationHelper.java +++ b/app/src/main/java/eu/faircode/email/NotificationHelper.java @@ -679,6 +679,8 @@ class NotificationHelper { 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); @@ -780,7 +782,6 @@ class NotificationHelper { : R.drawable.baseline_mail_white_24) .setContentTitle(title) .setContentIntent(piContent) - .setNumber(total_messages) .setDeleteIntent(piClear) .setPriority(NotificationCompat.PRIORITY_DEFAULT) .setCategory(notify_summary @@ -788,6 +789,14 @@ class NotificationHelper { .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);