1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-06-20 03:50:43 +02:00

Xiaomi: Fix dismiss multiple notifications from watch

This commit is contained in:
José Rebelo 2023-12-08 11:49:47 +00:00
parent 6479cc3bb0
commit 2b8d8c2cb0
2 changed files with 11 additions and 9 deletions

View File

@ -87,11 +87,13 @@ public class XiaomiNotificationService extends AbstractXiaomiService implements
switch (cmd.getSubtype()) {
case CMD_NOTIFICATION_DISMISS:
final int dismissNotificationId = cmd.getNotification().getNotification4().getNotificationId().getId();
LOG.info("Watch dismiss notification {}", dismissNotificationId);
deviceEvtNotificationControl.handle = dismissNotificationId;
deviceEvtNotificationControl.event = GBDeviceEventNotificationControl.Event.DISMISS;
getSupport().evaluateGBDeviceEvent(deviceEvtNotificationControl);
LOG.info("Watch dismiss {} notifications", cmd.getNotification().getNotificationDismiss().getNotificationIdCount());
for (final XiaomiProto.NotificationId notificationId : cmd.getNotification().getNotificationDismiss().getNotificationIdList()) {
LOG.debug("Watch dismiss {}", notificationId.getId());
deviceEvtNotificationControl.handle = notificationId.getId();
deviceEvtNotificationControl.event = GBDeviceEventNotificationControl.Event.DISMISS;
getSupport().evaluateGBDeviceEvent(deviceEvtNotificationControl);
}
return;
case CMD_CALL_REJECT:
LOG.debug("Reject call");
@ -196,10 +198,10 @@ public class XiaomiNotificationService extends AbstractXiaomiService implements
if (callSpec.command != CallSpec.CALL_INCOMING) {
final XiaomiProto.NotificationDismiss.Builder notification4 = XiaomiProto.NotificationDismiss.newBuilder()
.setNotificationId(XiaomiProto.NotificationId.newBuilder().setId(0).setPackage("phone"));
.addNotificationId(XiaomiProto.NotificationId.newBuilder().setId(0).setPackage("phone"));
final XiaomiProto.Notification notification = XiaomiProto.Notification.newBuilder()
.setNotification4(notification4)
.setNotificationDismiss(notification4)
.build();
getSupport().sendCommand(

View File

@ -571,7 +571,7 @@ message MediaKey {
message Notification {
optional Notification2 notification2 = 3;
optional NotificationDismiss notification4 = 4;
optional NotificationDismiss notificationDismiss = 4;
optional bool screenOnOnNotifications = 7;
optional uint32 unknown8 = 8; // 1 on canned replies request?
@ -605,7 +605,7 @@ message Notification3 {
}
message NotificationDismiss {
optional NotificationId notificationId = 1;
repeated NotificationId notificationId = 1;
}
message NotificationId {