diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/PebbleReceiver.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/PebbleReceiver.java index 4fa3bcba..ab408429 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/PebbleReceiver.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/PebbleReceiver.java @@ -13,6 +13,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import nodomain.freeyourgadget.gadgetbridge.GBApplication; +import nodomain.freeyourgadget.gadgetbridge.model.NotificationKind; public class PebbleReceiver extends BroadcastReceiver { @@ -46,6 +47,7 @@ public class PebbleReceiver extends BroadcastReceiver { return; } + String notificationData = intent.getStringExtra("notificationData"); try { JSONArray notificationJSON = new JSONArray(notificationData); @@ -57,7 +59,12 @@ public class PebbleReceiver extends BroadcastReceiver { } if (title != null && body != null) { - GBApplication.deviceService().onSMS(title, body); + NotificationKind notificationKind = NotificationKind.UNDEFINED; + String sender = intent.getStringExtra("sender"); + if ("Conversations".equals(sender)) { + notificationKind = NotificationKind.CHAT; + } + GBApplication.deviceService().onGenericNotification(title, body, -1, notificationKind); } } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleProtocol.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleProtocol.java index 10a040bc..61d7e838 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleProtocol.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleProtocol.java @@ -383,11 +383,11 @@ public class PebbleProtocol extends GBDeviceProtocol { if (isFw3x) { // 3.x notification - //return encodeTimelinePin(id, (int) (ts + 600 & 0xffffffff), (short) 90, ICON_TIMELINE_CALENDAR, title); // really, this is just for testing - return encodeBlobdbNotification(id, (int) (ts & 0xffffffff), title, subtitle, body, type, hasHandle, notificationKind); + //return encodeTimelinePin(id, (int) ((ts + 600) & 0xffffffffL), (short) 90, PebbleIconID.TIMELINE_CALENDAR, title); // really, this is just for testing + return encodeBlobdbNotification(id, (int) (ts & 0xffffffffL), title, subtitle, body, type, hasHandle, notificationKind); } else if (mForceProtocol || type != NOTIFICATION_EMAIL) { // 2.x notification - return encodeExtensibleNotification(id, (int) (ts & 0xffffffff), title, subtitle, body, type, hasHandle); + return encodeExtensibleNotification(id, (int) (ts & 0xffffffffL), title, subtitle, body, type, hasHandle); } else { // 1.x notification on FW 2.X String[] parts = {title, body, ts.toString(), subtitle}; @@ -408,7 +408,7 @@ public class PebbleProtocol extends GBDeviceProtocol { @Override public byte[] encodeGenericNotification(String title, String details, int handle, NotificationKind notificationKind) { - return encodeNotification(handle, title, null, details, NOTIFICATION_UNDEFINED, true, notificationKind); + return encodeNotification(handle, title, null, details, NOTIFICATION_UNDEFINED, handle != -1, notificationKind); } @Override