1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-04 01:09:47 +01:00

Webview: Fix sending configuration from watchfaces when background message exchange is going on

This commit is contained in:
Daniele Gobbetti 2017-09-03 17:10:04 +02:00
parent d669d3b325
commit b8a137226f
2 changed files with 4 additions and 4 deletions

View File

@ -89,7 +89,7 @@
<div id="step2" class="step"> <div id="step2" class="step">
<h2>Incoming configuration data:</h2> <h2>Incoming configuration data:</h2>
<div id="jsondata"></div> <div id="jsondata"></div>
<button class="btn" name="send config" value="send config" onclick="Pebble.actuallySendData()"> <button class="btn" name="send config" value="send config" onclick="Pebble.sendConfiguration()">
Send data to pebble Send data to pebble
</button> </button>
<h2 class="store_presets">App Presets:</h2> <h2 class="store_presets">App Presets:</h2>

View File

@ -138,8 +138,8 @@ function gbPebble() {
window.open(self.configurationURL.toString(), "config"); window.open(self.configurationURL.toString(), "config");
} }
this.actuallySendData = function() { this.sendConfiguration = function() {
GBjs.sendAppMessage(self.configurationValues, false ); GBjs.sendAppMessage(document.getElementById("jsondata").innerHTML, false );
showStep("step1"); showStep("step1");
GBActivity.closeActivity(); GBActivity.closeActivity();
} }
@ -189,7 +189,7 @@ function gbPebble() {
this.sendAppMessage = function (dict, callbackAck, callbackNack){ this.sendAppMessage = function (dict, callbackAck, callbackNack){
try { try {
self.configurationValues = JSON.stringify(dict); self.configurationValues = JSON.stringify(dict);
if (document.getElementById("step2").style.display == 'block') { //intercept the values if (document.getElementById("step2").style.display == 'block' && document.getElementById("jsondata").innerHTML == "") { //intercept the values
document.getElementById("jsondata").innerHTML=self.configurationValues; document.getElementById("jsondata").innerHTML=self.configurationValues;
} else { //pass them silently } else { //pass them silently
var needsTransaction = false; var needsTransaction = false;