mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-25 18:15:49 +01:00
Pebble JS: add transactionId metadata to the appmessage.
Removes the errors in Pebble-Casio-WV58DE as reported in #482
This commit is contained in:
parent
1e0d7550d9
commit
d88badaf4d
@ -124,7 +124,7 @@ class PebbleIoThread extends GBDeviceIoThread {
|
||||
jsEvent = "appmessage";
|
||||
}
|
||||
|
||||
final String appMessage = PebbleUtils.parseIncomingAppMessage(message.message, message.appUUID);
|
||||
final String appMessage = PebbleUtils.parseIncomingAppMessage(message.message, message.appUUID, message.id);
|
||||
LOG.debug("to WEBVIEW: event: " + jsEvent + " message: " + appMessage);
|
||||
WebViewSingleton.invokeWebview(new WebViewSingleton.WebViewRunnable() {
|
||||
@Override
|
||||
|
@ -130,14 +130,14 @@ public class PebbleUtils {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String parseIncomingAppMessage(String msg, UUID uuid) {
|
||||
public static String parseIncomingAppMessage(String msg, UUID uuid, int transactionId) {
|
||||
JSONObject jsAppMessage = new JSONObject();
|
||||
|
||||
JSONObject knownKeys = PebbleUtils.getAppConfigurationKeys(uuid);
|
||||
SparseArray<String> appKeysMap = new SparseArray<>();
|
||||
|
||||
if (knownKeys == null || msg == null) {
|
||||
return "{}";
|
||||
msg = "[]";
|
||||
}
|
||||
|
||||
String inKey, outKey;
|
||||
@ -169,6 +169,9 @@ public class PebbleUtils {
|
||||
}
|
||||
}
|
||||
jsAppMessage.put("payload", outgoing);
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("transactionId", transactionId);
|
||||
jsAppMessage.put("data", data);
|
||||
|
||||
} catch (Exception e) {
|
||||
LOG.warn("Unable to parse incoming app message", e);
|
||||
|
Loading…
Reference in New Issue
Block a user