1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-26 20:06:52 +01:00

Moyoung: Fix malformed notifications when sender/title contains colon

This commit is contained in:
Arjan Schrijver 2024-09-05 22:07:06 +02:00
parent 0f9c278a2e
commit e95892f30b

View File

@ -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";
}