diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/HuaweiCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/HuaweiCoordinator.java index 5640b7906..c605e15d6 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/HuaweiCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/HuaweiCoordinator.java @@ -282,11 +282,15 @@ public class HuaweiCoordinator { // Notifications final List notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.NOTIFICATIONS); notifications.add(R.xml.devicesettings_notifications_enable); + if (supportsNotificationsRepeatedNotify() || supportsNotificationsRemoveSingle()){ + notifications.add(R.xml.devicesettings_autoremove_notifications); + } if (supportsNotificationOnBluetoothLoss()) notifications.add(R.xml.devicesettings_disconnectnotification_noshed); if (supportsDoNotDisturb(device)) notifications.add(R.xml.devicesettings_donotdisturb_allday_liftwirst_notwear); + // Workout if (supportsSendingGps()) deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.WORKOUT, R.xml.devicesettings_workout_send_gps_to_band); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/packets/Notifications.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/packets/Notifications.java index b45c477ab..4926b4415 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/packets/Notifications.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei/packets/Notifications.java @@ -48,8 +48,7 @@ public class Notifications { public String channelId = ""; public byte subscriptionId = 0; public String address = ""; - - + public String category = ""; } // TODO: support other types of notifications @@ -129,7 +128,9 @@ public class Notifications { if (addParams.supportsSyncKey) this.tlv.put(0x18, (addParams.notificationKey != null) ? addParams.notificationKey : ""); - //this.tlv.put(0x12, "msg"); //"msg" or "imcall", maybe other - category, if not empty and productType>=34 + if(!TextUtils.isEmpty(addParams.category)) { //TODO: device type >=34 + this.tlv.put(0x12, addParams.category); // "imcall" also possible value, not standard for android + } //if(addParams.repeatedNotifySupports) { // this.tlv.put(0x13, 0); // 0x13 - reminder 15 = vibrate, 0 - default @@ -142,8 +143,8 @@ public class Notifications { if (addParams.supportsRepeatedNotify || addParams.supportsRemoveSingle) { this.tlv.put(0x19, (addParams.notificationKey != null) ? addParams.notificationKey : ""); - this.tlv.put(0x20, addParams.notificationId); - this.tlv.put(0x1d, (addParams.channelId != null) ? addParams.channelId : ""); + this.tlv.put(0x1a, addParams.notificationId); + this.tlv.put(0x1b, (addParams.channelId != null) ? addParams.channelId : ""); } if (addParams.supportsTimestamp) { @@ -347,8 +348,8 @@ public class Notifications { .put(0x03, notificationKey) .put(0x04, notificationId) .put(0x05, notificationChannelId); - if (notificationCategory != null && !TextUtils.isEmpty(notificationCategory)) - this.tlv.put(0x06, notificationCategory); // category + if (!TextUtils.isEmpty(notificationCategory)) + this.tlv.put(0x06, notificationCategory); this.complete = true; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huawei/HuaweiNotificationsManager.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huawei/HuaweiNotificationsManager.java index 2813d6af7..3e79ceb5d 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huawei/HuaweiNotificationsManager.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huawei/HuaweiNotificationsManager.java @@ -81,8 +81,8 @@ public class HuaweiNotificationsManager { notificationSpec.sourceAppId, notificationSpec.key, id, - "", // TODO: - null); + notificationSpec.channelId, + notificationSpec.category); sendNotificationReq.doPerform(); } catch (IOException e) { LOG.error("Sending notification remove failed", e); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huawei/requests/SendNotificationRequest.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huawei/requests/SendNotificationRequest.java index 3fa9f6caa..a54359e02 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huawei/requests/SendNotificationRequest.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huawei/requests/SendNotificationRequest.java @@ -76,6 +76,8 @@ public class SendNotificationRequest extends Request { params.notificationId = notificationSpec.getId(); params.notificationKey = notificationSpec.key; + params.channelId = notificationSpec.channelId; + params.category = notificationSpec.category; this.packet = new Notifications.NotificationActionRequest( @@ -92,7 +94,6 @@ public class SendNotificationRequest extends Request { } public void buildNotificationTLVFromCallSpec(CallSpec callSpec) { - this.packet = new Notifications.NotificationActionRequest( paramsProvider, supportProvider.getNotificationId(),