mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
Improve BangleJS code according to review
This commit is contained in:
committed by
Arjan Schrijver
parent
5757ce7749
commit
3c725b9276
+6
-4
@@ -207,9 +207,6 @@ public class AppsManagementActivity extends AbstractGBActivity {
|
||||
webView.addJavascriptInterface(new WebViewInterface(this), "Android");
|
||||
webView.setWebContentsDebuggingEnabled(true); // FIXME
|
||||
|
||||
Prefs devicePrefs = new Prefs(GBApplication.getDeviceSpecificSharedPrefs(mGBDevice.getAddress()));
|
||||
final String url = devicePrefs.getString(PREF_BANGLEJS_WEBVIEW_URL, "https://banglejs.com/apps/android.html").trim();
|
||||
|
||||
webView.setWebViewClient(new GBWebClient(GBWebClient.REQUEST_TYPE_BANGLE_APP_LOADER){
|
||||
@Override
|
||||
public void onPageFinished(WebView view, String weburl){
|
||||
@@ -229,9 +226,14 @@ public class AppsManagementActivity extends AbstractGBActivity {
|
||||
}
|
||||
});
|
||||
|
||||
Prefs devicePrefs = new Prefs(GBApplication.getDeviceSpecificSharedPrefs(mGBDevice.getAddress()));
|
||||
String url = devicePrefs.getString(PREF_BANGLEJS_WEBVIEW_URL, "").trim();
|
||||
if (url.isEmpty()) url = "https://banglejs.com/apps/android.html";
|
||||
final String finalUrl = url;
|
||||
|
||||
final Looper mainLooper = Looper.getMainLooper();
|
||||
new Handler(mainLooper).postDelayed(() -> {
|
||||
webView.loadUrl(url);
|
||||
webView.loadUrl(finalUrl);
|
||||
}, 1000);
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -925,7 +925,7 @@ public class BangleJSDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
|
||||
Prefs devicePrefs = new Prefs(GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()));
|
||||
if (! devicePrefs.getBoolean(PREF_DEVICE_INTERNET_ACCESS, false)) {
|
||||
uartTxJSONError("http", "Internet access not enabled for this device", id);
|
||||
uartTxJSONError("http", "Internet access not enabled for this watch", id);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user