From 2da50e27c25f2a4ec6e94c228c9b9f7686e6686f Mon Sep 17 00:00:00 2001 From: Daniele Gobbetti Date: Tue, 8 Mar 2016 17:45:11 +0100 Subject: [PATCH] call the ready event as soon as the app js file has been loaded. Add a button to debug the different steps. --- app/src/main/assets/app_config/configure.html | 5 +++-- .../app_config/js/gadgetbridge_boilerplate.js | 14 ++++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/app/src/main/assets/app_config/configure.html b/app/src/main/assets/app_config/configure.html index ac25d82ce..a4d10e985 100644 --- a/app/src/main/assets/app_config/configure.html +++ b/app/src/main/assets/app_config/configure.html @@ -11,11 +11,12 @@ - +

Url of the configuration:

- + +

Incoming configuration data:

diff --git a/app/src/main/assets/app_config/js/gadgetbridge_boilerplate.js b/app/src/main/assets/app_config/js/gadgetbridge_boilerplate.js index 760a2ec83..3e025ccb8 100644 --- a/app/src/main/assets/app_config/js/gadgetbridge_boilerplate.js +++ b/app/src/main/assets/app_config/js/gadgetbridge_boilerplate.js @@ -72,9 +72,15 @@ function gbPebble() { //needs to be called like this because of original Pebble function name this.openURL = function(url) { - document.getElementById("config_url").innerHTML=url; - var UUID = GBjs.getAppUUID(); - this.configurationURL = new Uri(url).addQueryParam("return_to", "gadgetbridge://"+UUID+"?config=true&json="); + if (url.lastIndexOf("http", 0) === 0) { + document.getElementById("config_url").innerHTML=url; + var UUID = GBjs.getAppUUID(); + this.configurationURL = new Uri(url).addQueryParam("return_to", "gadgetbridge://"+UUID+"?config=true&json="); + } else { + //TODO: add custom return_to + location.href = url; + } + } this.getActiveWatchInfo = function() { @@ -122,7 +128,7 @@ if (jsConfigFile != null) { Pebble.parseconfig(t); } else { document.getElementById('step2').style.display="none"; - Pebble.showConfiguration(); + Pebble.ready(); } }); }