Fix pebble webview local content- and HttpService access.

This commit is contained in:
Daniele Gobbetti 2023-08-23 14:56:47 +02:00
parent 1af800666e
commit 13064036fe
2 changed files with 13 additions and 1 deletions

View File

@ -195,6 +195,10 @@ public class ExternalPebbleJSActivity extends AbstractGBActivity {
webSettings.setDomStorageEnabled(true);
//needed for localstorage
webSettings.setDatabaseEnabled(true);
//allow local js files access
webSettings.setAllowContentAccess(true);
webSettings.setAllowFileAccess(true);
webSettings.setAllowFileAccessFromFileURLs(true);
JSInterface gbJSInterface = new JSInterface(device, uuid);
myWebView.addJavascriptInterface(gbJSInterface, "GBjs");

View File

@ -108,6 +108,11 @@ public class WebViewSingleton {
webSettings.setDomStorageEnabled(true);
//needed for localstorage
webSettings.setDatabaseEnabled(true);
//allow local js files access
webSettings.setAllowContentAccess(true);
webSettings.setAllowFileAccess(true);
webSettings.setAllowFileAccessFromFileURLs(true);
webSettings.setAllowUniversalAccessFromFileURLs(true);
}
}
@ -201,8 +206,11 @@ public class WebViewSingleton {
contextWrapper.getPackageManager().getApplicationInfo(internetHelperPkg, 0);
Intent intent = new Intent();
intent.setComponent(new ComponentName(internetHelperPkg, internetHelperCls));
contextWrapper.getApplicationContext().bindService(intent, internetHelperConnection, Context.BIND_AUTO_CREATE);
internetHelperInstalled = true;
final Intent intent1 = new Intent("nodomain.freeyourgadget.internethelper.HttpService");
intent1.setPackage("nodomain.freeyourgadget.internethelper");
contextWrapper.getApplicationContext().bindService(intent1, internetHelperConnection, Context.BIND_AUTO_CREATE);
}
catch (PackageManager.NameNotFoundException e) {
internetHelperInstalled = false;