diff --git a/src/main/java/org/thoughtcrime/securesms/WebxdcActivity.java b/src/main/java/org/thoughtcrime/securesms/WebxdcActivity.java index 682ea6151..dc8589999 100644 --- a/src/main/java/org/thoughtcrime/securesms/WebxdcActivity.java +++ b/src/main/java/org/thoughtcrime/securesms/WebxdcActivity.java @@ -74,7 +74,9 @@ public class WebxdcActivity extends WebViewActivity implements DcEventCenter.DcE private DcMsg dcAppMsg; private String baseURL; private String sourceCodeUrl = ""; - private String selfAddr = ""; + private String selfAddr; + private int sendUpdateMaxSize; + private int sendUpdateInterval; private boolean internetAccess = false; private boolean hideActionBar = false; @@ -199,7 +201,9 @@ public boolean onShowFileChooser(WebView webView, ValueCallback filePathC final JSONObject info = this.dcAppMsg.getWebxdcInfo(); internetAccess = JsonUtils.optBoolean(info, "internet_access"); - selfAddr = JsonUtils.optString(info, "self_addr"); + selfAddr = info.optString("self_addr"); + sendUpdateMaxSize = info.optInt("send_update_max_size"); + sendUpdateInterval = info.optInt("send_update_interval"); toggleFakeProxy(!internetAccess); @@ -494,6 +498,16 @@ private void leaveRealtimeChannel() { } class InternalJSApi { + @JavascriptInterface + public int sendUpdateMaxSize() { + return WebxdcActivity.this.sendUpdateMaxSize; + } + + @JavascriptInterface + public int sendUpdateInterval() { + return WebxdcActivity.this.sendUpdateInterval; + } + @JavascriptInterface public String selfAddr() { return WebxdcActivity.this.selfAddr; diff --git a/src/main/res/raw/webxdc.js b/src/main/res/raw/webxdc.js index 921597bd3..a68bdda8e 100644 --- a/src/main/res/raw/webxdc.js +++ b/src/main/res/raw/webxdc.js @@ -42,6 +42,10 @@ window.webxdc = (() => { } return { + sendUpdateMaxSize: InternalJSApi.sendUpdateMaxSize(), + + sendUpdateInterval: InternalJSApi.sendUpdateInterval(), + selfAddr: InternalJSApi.selfAddr(), selfName: InternalJSApi.selfName(),