mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-24 10:56:50 +01:00
Pebble: add method to stop the background JS engine without disposing the webview
This commit is contained in:
parent
83038a47ca
commit
e028b4d223
@ -518,7 +518,7 @@ class PebbleIoThread extends GBDeviceIoThread {
|
||||
LOG.info("got GBDeviceEventAppManagement START event for uuid: " + appMgmt.uuid);
|
||||
if (prefs.getBoolean("pebble_enable_background_javascript", false)) {
|
||||
if (mPebbleProtocol.hasAppMessageHandler(appMgmt.uuid)) {
|
||||
WebViewSingleton.disposeWebView();
|
||||
WebViewSingleton.stopJavascriptInterface();
|
||||
} else {
|
||||
WebViewSingleton.runJavascriptInterface(gbDevice, appMgmt.uuid);
|
||||
}
|
||||
|
@ -197,6 +197,18 @@ public class WebViewSingleton {
|
||||
});
|
||||
}
|
||||
|
||||
public static void stopJavascriptInterface() {
|
||||
new Handler(webViewSingleton.mainLooper).post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (webViewSingleton.instance != null) {
|
||||
webViewSingleton.instance.removeJavascriptInterface("GBjs");
|
||||
webViewSingleton.instance.loadUrl("about:blank");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void disposeWebView() {
|
||||
if (internetHelperBound) {
|
||||
LOG.debug("WEBVIEW: will unbind the internet helper");
|
||||
|
Loading…
Reference in New Issue
Block a user