1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-25 18:15:49 +01:00

call the ready event as soon as the app js file has been loaded. Add a button to debug the different steps.

This commit is contained in:
Daniele Gobbetti 2016-03-08 17:45:11 +01:00
parent a89fea9c7d
commit 2da50e27c2
2 changed files with 13 additions and 6 deletions

View File

@ -11,11 +11,12 @@
<!-- TODO -->
</style>
</head>
<body style="width: 100%;">
<body onload="" style="width: 100%;">
<div id="step1">
<h2>Url of the configuration:</h2>
<div id="config_url" style="height: 100px; width: 100%;"></div>
<button name="open config" value="open config" onclick="Pebble.actuallyOpenURL()" >Open configuration website</button>
<button name="show config" value="show config" onclick="Pebble.showConfiguration()" >1) showConfig</button>
<button name="open config" value="open config" onclick="Pebble.actuallyOpenURL()" >2) Open configuration website</button>
</div>
<div id="step2">
<h2>Incoming configuration data:</h2>

View File

@ -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();
}
});
}