1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-26 10:35:50 +01:00

Support for COL Reminder notifications

This commit is contained in:
Davis Mosenkovs 2023-10-08 10:30:33 +03:00 committed by José Rebelo
parent 6234359c69
commit 60f91a9f93
3 changed files with 18 additions and 3 deletions

View File

@ -653,6 +653,12 @@ public class NotificationListener extends NotificationListenerService {
notificationSpec.body = sanitizeUnicode(contentCS.toString()); notificationSpec.body = sanitizeUnicode(contentCS.toString());
} }
if (notificationSpec.type == NotificationType.COL_REMINDER
&& notificationSpec.body == null
&& notificationSpec.title != null) {
notificationSpec.body = notificationSpec.title;
notificationSpec.title = null;
}
} }
private boolean isServiceRunning() { private boolean isServiceRunning() {
@ -883,10 +889,13 @@ public class NotificationListener extends NotificationListenerService {
return false; return false;
} }
private boolean shouldIgnoreOngoing(StatusBarNotification sbn) { private boolean shouldIgnoreOngoing(StatusBarNotification sbn, NotificationType type) {
if (isFitnessApp(sbn)) { if (isFitnessApp(sbn)) {
return true; return true;
} }
if (type == NotificationType.COL_REMINDER) {
return true;
}
return false; return false;
} }
@ -932,6 +941,7 @@ public class NotificationListener extends NotificationListenerService {
type != NotificationType.WECHAT && type != NotificationType.WECHAT &&
type != NotificationType.TELEGRAM && type != NotificationType.TELEGRAM &&
type != NotificationType.OUTLOOK && type != NotificationType.OUTLOOK &&
type != NotificationType.COL_REMINDER &&
type != NotificationType.SKYPE) { //see https://github.com/Freeyourgadget/Gadgetbridge/issues/1109 type != NotificationType.SKYPE) { //see https://github.com/Freeyourgadget/Gadgetbridge/issues/1109
LOG.info("Ignoring notification, local only"); LOG.info("Ignoring notification, local only");
return true; return true;
@ -958,7 +968,7 @@ public class NotificationListener extends NotificationListenerService {
} }
} }
if (shouldIgnoreOngoing(sbn)) { if (shouldIgnoreOngoing(sbn, type)) {
return false; return false;
} }

View File

@ -174,6 +174,9 @@ public class AppNotificationType extends HashMap<String, NotificationType> {
// Discord // Discord
put("com.discord", NotificationType.DISCORD); put("com.discord", NotificationType.DISCORD);
// COL Reminder
put("com.colapps.reminder", NotificationType.COL_REMINDER);
} }
} }

View File

@ -72,7 +72,8 @@ public enum NotificationType {
VIBER(PebbleIconID.NOTIFICATION_VIBER, PebbleColor.VividViolet), VIBER(PebbleIconID.NOTIFICATION_VIBER, PebbleColor.VividViolet),
WECHAT(PebbleIconID.NOTIFICATION_WECHAT, PebbleColor.KellyGreen), WECHAT(PebbleIconID.NOTIFICATION_WECHAT, PebbleColor.KellyGreen),
WHATSAPP(PebbleIconID.NOTIFICATION_WHATSAPP, PebbleColor.IslamicGreen), WHATSAPP(PebbleIconID.NOTIFICATION_WHATSAPP, PebbleColor.IslamicGreen),
YAHOO_MAIL(PebbleIconID.NOTIFICATION_YAHOO_MAIL, PebbleColor.Indigo); YAHOO_MAIL(PebbleIconID.NOTIFICATION_YAHOO_MAIL, PebbleColor.Indigo),
COL_REMINDER(PebbleIconID.NOTIFICATION_REMINDER, PebbleColor.IslamicGreen);
// Note: if you add any more constants, update all clients as well // Note: if you add any more constants, update all clients as well
@ -134,6 +135,7 @@ public enum NotificationType {
case OUTLOOK: case OUTLOOK:
case YAHOO_MAIL: case YAHOO_MAIL:
return "generic_email"; return "generic_email";
case COL_REMINDER:
case UNKNOWN: case UNKNOWN:
default: default:
return "generic"; return "generic";