send realtime data events as int array instead of base64

This commit is contained in:
adbenitez
2024-06-13 16:26:47 +02:00
parent 9e6b69c122
commit cd0350cc6d
2 changed files with 7 additions and 5 deletions
@@ -365,8 +365,11 @@ public class WebxdcActivity extends WebViewActivity implements DcEventCenter.DcE
callJavaScriptFunction("__webxdcUpdate()");
} else if ((eventId == DcContext.DC_EVENT_WEBXDC_REALTIME_DATA && event.getData1Int() == dcAppMsg.getId())) {
Log.i(TAG, "handling realtime data event");
String base64 = Base64.encodeToString(event.getData2Blob(), Base64.NO_WRAP | Base64.NO_PADDING);
callJavaScriptFunction("__webxdcRealtimeData(\"" + base64 + "\")");
StringBuilder data = new StringBuilder();
for (byte b : event.getData2Blob()) {
data.append(((int) b) + ",");
}
callJavaScriptFunction("__webxdcRealtimeData([" + data + "])");
} else if ((eventId == DcContext.DC_EVENT_MSGS_CHANGED && event.getData2Int() == dcAppMsg.getId())) {
this.dcAppMsg = this.dcContext.getMsg(event.getData2Int()); // msg changed, reload data from db
Util.runOnAnyBackgroundThread(() -> {