1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 21:06:50 +01:00

Pebble: only call Pebble object in javascript if it is actually available

This commit is contained in:
Andreas Shimokawa 2018-02-04 00:02:14 +01:00
parent 06929d04f9
commit e657b327c9

View File

@ -129,7 +129,7 @@ class PebbleIoThread extends GBDeviceIoThread {
WebViewSingleton.invokeWebview(new WebViewSingleton.WebViewRunnable() {
@Override
public void invoke(WebView webView) {
webView.evaluateJavascript("Pebble.evaluate('" + jsEvent + "',[" + appMessage + "]);", new ValueCallback<String>() {
webView.evaluateJavascript("if (typeof Pebble == 'object') Pebble.evaluate('" + jsEvent + "',[" + appMessage + "]);", new ValueCallback<String>() {
@Override
public void onReceiveValue(String s) {
//TODO: the message should be acked here instead of in PebbleIoThread