mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-26 02:25:50 +01:00
Treat Conversations messagess as chat messages, even if arrived via Pebble Intents (which is the default)
This commit is contained in:
parent
a5ef952e37
commit
041bd1a7f4
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user