Xiaomi apply notification

pull/217/head
M66B 6 months ago
parent 6ebf6cb3b2
commit b698e6f71d

@ -646,6 +646,10 @@ class NotificationHelper {
" sort=" + notification.getSortKey()); " sort=" + notification.getSortKey());
try { try {
if (NotificationHelper.areNotificationsEnabled(nm)) { 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); nm.notify(tag, NotificationHelper.NOTIFICATION_TAGGED, notification);
if (update.contains(id)) if (update.contains(id))
try { 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) { } catch (Throwable ex) {
Log.w(ex); Log.w(ex);
} }

@ -187,6 +187,7 @@ public final class ShortcutBadgerAlt {
Method method = extraNotification.getClass().getDeclaredMethod("setMessageCount", int.class); Method method = extraNotification.getClass().getDeclaredMethod("setMessageCount", int.class);
method.invoke(extraNotification, badgeCount); method.invoke(extraNotification, badgeCount);
} catch (Exception e) { } catch (Exception e) {
eu.faircode.email.Log.w(e);
if (Log.isLoggable(LOG_TAG, Log.DEBUG)) { if (Log.isLoggable(LOG_TAG, Log.DEBUG)) {
Log.d(LOG_TAG, "Unable to execute badge", e); Log.d(LOG_TAG, "Unable to execute badge", e);
} }

Loading…
Cancel
Save