From 2e3cc409b0e89042dd5e5a7579f059d5a951452c Mon Sep 17 00:00:00 2001 From: mmcwilliams Date: Fri, 15 May 2020 23:06:57 -0400 Subject: [PATCH] PWA wifi functions were not attached to DOM elements, only mobile ones. getWifi, setWifi and editWifi bindings were added to both pwa.init and mobile.init functions and DOM elements were bound to the generic functions. Resolves #7 --- app/package.json | 2 +- app/www/index.html | 6 +++--- app/www/static/js/intval.core.js | 4 ++-- app/www/static/js/intval.mobile.js | 5 ++++- app/www/static/js/intval.pwa.js | 8 ++++++-- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/app/package.json b/app/package.json index 84c1cf8..9c608e0 100644 --- a/app/package.json +++ b/app/package.json @@ -47,4 +47,4 @@ "android" ] } -} +} \ No newline at end of file diff --git a/app/www/index.html b/app/www/index.html index 795982f..3cc8e45 100644 --- a/app/www/index.html +++ b/app/www/index.html @@ -73,15 +73,15 @@ Local IP: null
-
- - + +
diff --git a/app/www/static/js/intval.core.js b/app/www/static/js/intval.core.js index 4467950..8211733 100644 --- a/app/www/static/js/intval.core.js +++ b/app/www/static/js/intval.core.js @@ -185,11 +185,11 @@ var setState = function (res) { if (res.sequence == true) { if (mobile.ble) mobile.ble.active = true; - if (pwa.wble) pwa.ble.active = true; + if (pwa.wble) pwa.wble.active = true; seqState(true); } else { if (mobile.ble) mobile.ble.active = false; - if (pwa.wble) pwa.ble.active = false; + if (pwa.wble) pwa.wble.active = false; seqState(false); } }; diff --git a/app/www/static/js/intval.mobile.js b/app/www/static/js/intval.mobile.js index d124dd8..df6d333 100644 --- a/app/www/static/js/intval.mobile.js +++ b/app/www/static/js/intval.mobile.js @@ -82,7 +82,7 @@ mobile.ble.onConnect = function (peripheral, device) { scan.classList.remove('active'); getState(); - mobile.getWifi(); + getWifi(); }; mobile.ble.disconnect = function () { @@ -148,6 +148,9 @@ mobile.init = function () { window.reset = mobile.reset; window.restart = mobile.restart; window.update = mobile.update; + window.getWifi = mobile.getWifi; + window.setWifi = mobile.setWifi; + window.editWifi = mobile.editWifi; //show ble-specific fields in settings for (let i of bleInputs) { diff --git a/app/www/static/js/intval.pwa.js b/app/www/static/js/intval.pwa.js index 446d259..bb72d7f 100644 --- a/app/www/static/js/intval.pwa.js +++ b/app/www/static/js/intval.pwa.js @@ -129,7 +129,7 @@ pwa.wble.onConnect = function (peripheral, device, service) { scan.classList.remove('active'); getState(); - pwa.getWifi(); + getWifi(); }; pwa.wble.disconnect = function () { @@ -252,6 +252,9 @@ pwa.init = function () { window.reset = pwa.reset; window.restart = pwa.restart; window.update = pwa.update; + window.getWifi = pwa.getWifi; + window.setWifi = pwa.setWifi; + window.editWifi = pwa.editWifi; //show ble-specific fields in settings for (let i of bleInputs) { @@ -497,7 +500,8 @@ pwa.getWifiSuccess = function (res) { UI.spinner.hide(); UI.overlay.hide(); - elem.innerHTML = '' + elem.innerHTML = ''; + console.dir(res); if (!res.available || res.available.length === 0) { if (elem.classList.contains('active')) { elem.classList.remove('active');