Forward also group summary notifications, if they contain wearable actions. Hopefully helps with #456
Tested with conversations and there is no regression. Also a specific workaround for telegram was removed, hopefully this does not break #395
This commit is contained in:
parent
f1965c7b00
commit
846c74aa86
|
@ -34,7 +34,6 @@ import nodomain.freeyourgadget.gadgetbridge.model.AppNotificationType;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec;
|
import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec;
|
import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec;
|
import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.NotificationType;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.DeviceCommunicationService;
|
import nodomain.freeyourgadget.gadgetbridge.service.DeviceCommunicationService;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.LimitedQueue;
|
import nodomain.freeyourgadget.gadgetbridge.util.LimitedQueue;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
|
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
|
||||||
|
@ -190,19 +189,13 @@ public class NotificationListener extends NotificationListenerService {
|
||||||
if (!prefs.getBoolean("notifications_generic_whenscreenon", false)) {
|
if (!prefs.getBoolean("notifications_generic_whenscreenon", false)) {
|
||||||
PowerManager powermanager = (PowerManager) getSystemService(POWER_SERVICE);
|
PowerManager powermanager = (PowerManager) getSystemService(POWER_SERVICE);
|
||||||
if (powermanager.isScreenOn()) {
|
if (powermanager.isScreenOn()) {
|
||||||
LOG.info("Not forwarding notification, screen seems to be on and settings do not allow this");
|
// LOG.info("Not forwarding notification, screen seems to be on and settings do not allow this");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//don't forward group summary notifications to the wearable, they are meant for the android device only
|
|
||||||
if ((notification.flags & Notification.FLAG_GROUP_SUMMARY) == Notification.FLAG_GROUP_SUMMARY) {
|
|
||||||
LOG.info("Not forwarding notification, FLAG_GROUP_SUMMARY is set. Notification flags: " + notification.flags);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((notification.flags & Notification.FLAG_ONGOING_EVENT) == Notification.FLAG_ONGOING_EVENT) {
|
if ((notification.flags & Notification.FLAG_ONGOING_EVENT) == Notification.FLAG_ONGOING_EVENT) {
|
||||||
LOG.info("Not forwarding notification, FLAG_ONGOING_EVENT is set. Notification flags: " + notification.flags);
|
// LOG.info("Not forwarding notification, FLAG_ONGOING_EVENT is set. Notification flags: " + notification.flags);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,8 +259,9 @@ public class NotificationListener extends NotificationListenerService {
|
||||||
NotificationCompat.WearableExtender wearableExtender = new NotificationCompat.WearableExtender(notification);
|
NotificationCompat.WearableExtender wearableExtender = new NotificationCompat.WearableExtender(notification);
|
||||||
List<NotificationCompat.Action> actions = wearableExtender.getActions();
|
List<NotificationCompat.Action> actions = wearableExtender.getActions();
|
||||||
|
|
||||||
if (actions.isEmpty() && notificationSpec.type == NotificationType.TELEGRAM) {
|
if (actions.isEmpty() && (notification.flags & Notification.FLAG_GROUP_SUMMARY) == Notification.FLAG_GROUP_SUMMARY) { //this could cause #395 to come back
|
||||||
return; // workaround for duplicate telegram message
|
LOG.info("Not forwarding notification, FLAG_GROUP_SUMMARY is set and no wearable action present. Notification flags: " + notification.flags);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (NotificationCompat.Action act : actions) {
|
for (NotificationCompat.Action act : actions) {
|
||||||
|
|
Loading…
Reference in New Issue