From 684d976bfc92e7e879705581021803679ec14090 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Thu, 30 Nov 2023 09:33:07 +0000 Subject: [PATCH] Bangle.js: Ensure SMS messages have `src` field set to "SMS Message" (it was previously left out) --- .../service/devices/banglejs/BangleJSDeviceSupport.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/banglejs/BangleJSDeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/banglejs/BangleJSDeviceSupport.java index 9b4264a50..5c051bbe6 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/banglejs/BangleJSDeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/banglejs/BangleJSDeviceSupport.java @@ -125,6 +125,7 @@ import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec; import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec; import nodomain.freeyourgadget.gadgetbridge.model.NavigationInfoSpec; import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; +import nodomain.freeyourgadget.gadgetbridge.model.NotificationType; import nodomain.freeyourgadget.gadgetbridge.model.RecordedDataTypes; import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec; import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport; @@ -1225,11 +1226,16 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport { if (action.type==NotificationSpec.Action.TYPE_WEARABLE_REPLY) mNotificationReplyAction.add(notificationSpec.getId(), ((long) notificationSpec.getId() << 4) + i + 1); } + // sourceName isn't set for SMS messages + String src = notificationSpec.sourceName; + if (notificationSpec.type == NotificationType.GENERIC_SMS) + src = "SMS Message"; + // Send JSON to Bangle.js try { JSONObject o = new JSONObject(); o.put("t", "notify"); o.put("id", notificationSpec.getId()); - o.put("src", notificationSpec.sourceName); + o.put("src", src); o.put("title", renderUnicodeAsImage(cropToLength(notificationSpec.title,80))); o.put("subject", renderUnicodeAsImage(cropToLength(notificationSpec.subject,80))); o.put("body", renderUnicodeAsImage(cropToLength(notificationSpec.body, 400)));