From b698e6f71da09f6d25a80d924e086574b6982857 Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 4 Mar 2025 13:48:50 +0100 Subject: [PATCH] Xiaomi apply notification --- .../main/java/eu/faircode/email/NotificationHelper.java | 7 ++++--- .../java/me/leolin/shortcutbadger/ShortcutBadgerAlt.java | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/NotificationHelper.java b/app/src/main/java/eu/faircode/email/NotificationHelper.java index 1cea23a500..1b3384a8a5 100644 --- a/app/src/main/java/eu/faircode/email/NotificationHelper.java +++ b/app/src/main/java/eu/faircode/email/NotificationHelper.java @@ -646,6 +646,10 @@ class NotificationHelper { " sort=" + notification.getSortKey()); try { if (NotificationHelper.areNotificationsEnabled(nm)) { + // https://github.com/leolin310148/ShortcutBadger/wiki/Xiaomi-Device-Support + if (id == 0 && badge && Helper.isXiaomi()) + ShortcutBadgerAlt.applyNotification(context, notification, current); + nm.notify(tag, NotificationHelper.NOTIFICATION_TAGGED, notification); if (update.contains(id)) try { @@ -656,9 +660,6 @@ class NotificationHelper { } } - // https://github.com/leolin310148/ShortcutBadger/wiki/Xiaomi-Device-Support - if (id == 0 && badge && Helper.isXiaomi()) - ShortcutBadgerAlt.applyNotification(context, notification, current); } catch (Throwable ex) { Log.w(ex); } diff --git a/app/src/main/java/me/leolin/shortcutbadger/ShortcutBadgerAlt.java b/app/src/main/java/me/leolin/shortcutbadger/ShortcutBadgerAlt.java index bd22001d7d..eee3faefda 100644 --- a/app/src/main/java/me/leolin/shortcutbadger/ShortcutBadgerAlt.java +++ b/app/src/main/java/me/leolin/shortcutbadger/ShortcutBadgerAlt.java @@ -187,6 +187,7 @@ public final class ShortcutBadgerAlt { Method method = extraNotification.getClass().getDeclaredMethod("setMessageCount", int.class); method.invoke(extraNotification, badgeCount); } catch (Exception e) { + eu.faircode.email.Log.w(e); if (Log.isLoggable(LOG_TAG, Log.DEBUG)) { Log.d(LOG_TAG, "Unable to execute badge", e); }