From 4f81f4c832a697cbf5fab9110d0d40bf6d00a1e2 Mon Sep 17 00:00:00 2001 From: Arjan Schrijver Date: Thu, 5 Sep 2024 22:07:06 +0200 Subject: [PATCH] Moyoung: Fix malformed notifications when sender/title contains colon --- .../service/devices/moyoung/MoyoungDeviceSupport.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/moyoung/MoyoungDeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/moyoung/MoyoungDeviceSupport.java index e0370dc05..0e6f7bea1 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/moyoung/MoyoungDeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/moyoung/MoyoungDeviceSupport.java @@ -523,7 +523,9 @@ public class MoyoungDeviceSupport extends AbstractBTLEDeviceSupport { public void onNotification(NotificationSpec notificationSpec) { final String senderOrTitle = StringUtils.getFirstOf(notificationSpec.sender, notificationSpec.title); - String message = StringUtils.truncate(senderOrTitle, 32) + ":"; + // Notifications are sent with both sender/title and message in 1 packet, separated by a ':', + // so we have to make sure there is no ':' in the sender/title part + String message = StringUtils.truncate(senderOrTitle, 32).replace(":", ";") + ":"; if (notificationSpec.subject != null) { message += StringUtils.truncate(notificationSpec.subject, 128) + "\n\n"; }