1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-07-21 14:21:03 +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()) { switch (cmd.getSubtype()) {
case CMD_NOTIFICATION_DISMISS: case CMD_NOTIFICATION_DISMISS:
final int dismissNotificationId = cmd.getNotification().getNotification4().getNotificationId().getId(); LOG.info("Watch dismiss {} notifications", cmd.getNotification().getNotificationDismiss().getNotificationIdCount());
LOG.info("Watch dismiss notification {}", dismissNotificationId); for (final XiaomiProto.NotificationId notificationId : cmd.getNotification().getNotificationDismiss().getNotificationIdList()) {
deviceEvtNotificationControl.handle = dismissNotificationId; LOG.debug("Watch dismiss {}", notificationId.getId());
deviceEvtNotificationControl.event = GBDeviceEventNotificationControl.Event.DISMISS; deviceEvtNotificationControl.handle = notificationId.getId();
getSupport().evaluateGBDeviceEvent(deviceEvtNotificationControl); deviceEvtNotificationControl.event = GBDeviceEventNotificationControl.Event.DISMISS;
getSupport().evaluateGBDeviceEvent(deviceEvtNotificationControl);
}
return; return;
case CMD_CALL_REJECT: case CMD_CALL_REJECT:
LOG.debug("Reject call"); LOG.debug("Reject call");
@ -196,10 +198,10 @@ public class XiaomiNotificationService extends AbstractXiaomiService implements
if (callSpec.command != CallSpec.CALL_INCOMING) { if (callSpec.command != CallSpec.CALL_INCOMING) {
final XiaomiProto.NotificationDismiss.Builder notification4 = XiaomiProto.NotificationDismiss.newBuilder() 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() final XiaomiProto.Notification notification = XiaomiProto.Notification.newBuilder()
.setNotification4(notification4) .setNotificationDismiss(notification4)
.build(); .build();
getSupport().sendCommand( getSupport().sendCommand(

View File

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