Support legacy configuration pages #251
There are pages that do not honor return_to get parameter. This commit allows the user to enter the returned url manually.
This commit is contained in:
parent
9f61458790
commit
d5586478f3
|
@ -19,7 +19,8 @@
|
|||
}
|
||||
#config_url,#jsondata {
|
||||
word-wrap: break-word;
|
||||
margin: 20px;
|
||||
margin: 20px 0;
|
||||
width: 90%;
|
||||
}
|
||||
.btn {
|
||||
display: inline-block;
|
||||
|
@ -38,6 +39,16 @@
|
|||
box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2)inset;
|
||||
transition-delay: 0s;
|
||||
}
|
||||
p {
|
||||
width: 90%;
|
||||
}
|
||||
#pastereturn {
|
||||
width: 90%;
|
||||
min-height: 3em;
|
||||
}
|
||||
#step1compat, #step2 {
|
||||
display: none;
|
||||
}
|
||||
<!-- TODO -->
|
||||
</style>
|
||||
</head>
|
||||
|
@ -48,6 +59,14 @@
|
|||
<!--<button class="btn" name="show config" value="show config" onclick="Pebble.showConfiguration()" >Show config / URL</button>-->
|
||||
<button class="btn" name="open config" value="open config" onclick="Pebble.actuallyOpenURL()" >Open configuration website</button>
|
||||
</div>
|
||||
<div id="step1compat">
|
||||
<p>In case of "network error" after saving settings in the wathchapp, copy the "network error"
|
||||
URL and paste it here:</p>
|
||||
<textarea id="pastereturn"></textarea><br/>
|
||||
<button class="btn" name="parse" onclick="Pebble.parseReturnedPebbleJS()">Parse legacy app
|
||||
configuration
|
||||
</button>
|
||||
</div>
|
||||
<div id="step2">
|
||||
<h2>Incoming configuration data:</h2>
|
||||
<div id="jsondata"></div>
|
||||
|
|
|
@ -63,6 +63,7 @@ function gbPebble() {
|
|||
}
|
||||
}
|
||||
this.actuallyOpenURL = function() {
|
||||
document.getElementById('step1compat').style.display="block";
|
||||
window.open(this.configurationURL.toString(), "config");
|
||||
}
|
||||
|
||||
|
@ -114,6 +115,22 @@ function gbPebble() {
|
|||
this.ready = function() {
|
||||
}
|
||||
|
||||
this.parseReturnedPebbleJS = function() {
|
||||
|
||||
var str = document.getElementById('pastereturn').value;
|
||||
var needle = "pebblejs://close#";
|
||||
|
||||
if (str.split(needle)[1] !== undefined) {
|
||||
var t = new Object();
|
||||
t.response = unescape(str.split(needle)[1]);
|
||||
this.parseconfig(t);
|
||||
document.getElementById('step1').style.display="none";
|
||||
document.getElementById('step1compat').style.display="none";
|
||||
document.getElementById('step2').style.display="block";
|
||||
} else {
|
||||
console.error("No valid configuration found in the entered string.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var Pebble = new gbPebble();
|
||||
|
@ -123,13 +140,15 @@ if (jsConfigFile != null) {
|
|||
loadScript(jsConfigFile, function() {
|
||||
if (getURLVariable('config') == 'true') {
|
||||
document.getElementById('step1').style.display="none";
|
||||
document.getElementById('step1compat').style.display="none";
|
||||
document.getElementById('step2').style.display="block";
|
||||
|
||||
var json_string = unescape(getURLVariable('json'));
|
||||
var t = new Object();
|
||||
t.response = json_string;
|
||||
if (json_string != '')
|
||||
Pebble.parseconfig(t);
|
||||
} else {
|
||||
document.getElementById('step2').style.display="none";
|
||||
Pebble.ready();
|
||||
Pebble.showConfiguration();
|
||||
}
|
||||
|
|
|
@ -54,8 +54,12 @@ public class ExternalPebbleJSActivity extends GBActivity {
|
|||
Uri uri = getIntent().getData();
|
||||
if (uri != null) {
|
||||
//getting back with configuration data
|
||||
try {
|
||||
appUuid = UUID.fromString(uri.getHost());
|
||||
queryString = uri.getEncodedQuery();
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.d("returned uri: ", uri.toString());
|
||||
}
|
||||
} else {
|
||||
appUuid = (UUID) getIntent().getSerializableExtra("app_uuid");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue