From b74c8000e554ef2f5c0ca94730a85ae10dc125f9 Mon Sep 17 00:00:00 2001 From: Jimmy Huang Date: Thu, 6 Mar 2014 13:00:55 -0800 Subject: [PATCH] Fixed wifi tethering issues - Fixed issue where tethering other technologies like bluetooth will cause wifi tethering input to be disabled. - Added timer to wait for reloading page after untethering as sometimes connman will report wifi as unpowered. Change-Id: Id1ed51bd4a7679d09bf89122786321cf3fa84fff Signed-off-by: Jimmy Huang --- index.html | 4 ++-- js/panel-connman.js | 38 +++++++++++++++++++++++++------------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/index.html b/index.html index da8eb80..e7f8f76 100644 --- a/index.html +++ b/index.html @@ -115,10 +115,10 @@
- + - +
diff --git a/js/panel-connman.js b/js/panel-connman.js index 8af5326..78dc900 100644 --- a/js/panel-connman.js +++ b/js/panel-connman.js @@ -547,6 +547,10 @@ function connmanConstructServiceElement(parent, service) { function connmanTetheringPageReload() { $('#connman_tethering_technologies').html(''); + $('#connman_wifi_tethering_options').hide(); + $('#input_wifi_tethering_id').textinput('enable'); + $('#input_wifi_tethering_passphrase').textinput('enable'); + settings.connman.getTechnologies(function(technologies) { for (var i = 0; i < technologies.length; i++) { var technology = technologies[i]; @@ -577,28 +581,34 @@ function connmanConstructTetheringElement(technology) { console.log('Connman technology ' + technology.prop.Type + ' is tethered: ' + technology.prop.Tethering); if (technology.prop.Powered === true) { + /* WiFi-only options */ + if (technology.prop.Type === 'wifi') { + $('#connman_wifi_tethering_options').show(); + if (technology.prop.TetheringIdentifier) { + $('#input_wifi_tethering_id').val(technology.prop.TetheringIdentifier); + } + if (technology.prop.TetheringPassphrase) { + $('#input_wifi_tethering_passphrase').val(technology.prop.TetheringPassphrase); + } + + if (technology.prop.Tethering === true) { + $('#input_wifi_tethering_id').textinput('disable'); + $('#input_wifi_tethering_passphrase').textinput('disable'); + } + } + if (technology.prop.Tethering === true) { $('#toggle_tethering_' + technology.prop.Type).val('on').slider('refresh'); - $('#input_wifi_tethering_id').textinput('disable'); - $('#input_wifi_tethering_passphrase').textinput('disable'); - /* WiFi-only options */ - if (technology.prop.Type === 'wifi') { - $('#connman_wifi_tethering_options').show(); - if (technology.prop.TetheringIdentifier) { - $('#input_wifi_tethering_id').val(technology.prop.TetheringIdentifier); - } - if (technology.prop.TetheringPassphrase) { - $('#input_wifi_tethering_passphrase').val(technology.prop.TetheringPassphrase); - } - } } else { $('#toggle_tethering_' + technology.prop.Type).val('off').slider('refresh'); } } else { + /* WiFi-only options */ if (technology.prop.Type === 'wifi') { $('#input_wifi_tethering_id').textinput('disable'); $('#input_wifi_tethering_passphrase').textinput('disable'); } + $('#toggle_tethering_' + technology.prop.Type).slider('disable'); $('#toggle_tethering_' + technology.prop.Type).slider('refresh'); } @@ -638,7 +648,9 @@ function connmanConstructTetheringElement(technology) { technology.setTethering(false, '', '', function() { /* success */ console.log('Successfully untethered connman technology ' + technology.prop.Type); - connmanTetheringPageReload(); + setTimeout(function() { + connmanTetheringPageReload(); + }, 2000); }, function(e) { /* error */ connmanTetheringPageReload(); -- 2.7.4