Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #7340 from vingtetun/819947
Browse files Browse the repository at this point in the history
Bug 819947 - No WiFi networks detected during FTU experience. Add more d...
  • Loading branch information
vingtetun committed Jan 7, 2013
2 parents b46fc2c + f3de829 commit 59804bd
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
1 change: 1 addition & 0 deletions apps/communications/ftu/js/tutorial.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ var Tutorial = {

this.tutorialFinish.addEventListener('click', function ftuEnd() {
self.tutorialFinish.removeEventListener('click', ftuEnd);
WifiManager.finish();
window.close();
});
window.addEventListener('hashchange', this);
Expand Down
1 change: 1 addition & 0 deletions apps/communications/ftu/js/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ var UIManager = {
});

this.skipTutorialButton.addEventListener('click', function() {
WifiManager.finish();
window.close();
});
this.letsGoButton.addEventListener('click', function() {
Expand Down
26 changes: 23 additions & 3 deletions apps/communications/ftu/js/wifi.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ var WifiManager = {
if ('mozWifiManager' in window.navigator) {
this.api = window.navigator.mozWifiManager;
this.changeStatus();
// Ensure that wifi is on.
var lock = window.navigator.mozSettings.createLock();
this.enable(lock);
this.enableDebugging(lock);

this.gCurrentNetwork = this.api.connection.network;
if (this.gCurrentNetwork !== null) {
this.api.forget(this.gCurrentNetwork);
Expand Down Expand Up @@ -76,9 +81,24 @@ var WifiManager = {
callback(fakeNetworks);
}
},
enable: function wn_enable(firstTime) {
var settings = window.navigator.mozSettings;
settings.createLock().set({'wifi.enabled': true});
enable: function wn_enable(lock) {
lock.set({'wifi.enabled': true});
},
enableDebugging: function wn_enableDebugging(lock) {
// For bug 819947: turn on wifi debugging output to help track down a bug
// in wifi. We turn on wifi output only while the FTU app is active.
this._prevDebuggingValue = false;
var req = lock.get('wifi.debugging.enabled');
req.onsuccess = function wn_getDebuggingSuccess() {
this._prevDebuggingValue = req.result['wifi.debugging.enabled'];
};
lock.set({ 'wifi.debugging.enabled': true });
},
finish: function wn_finish() {
if (!this._prevDebuggingValue) {
var resetLock = window.navigator.mozSettings.createLock();
resetLock.set({'wifi.debugging.enabled': false});
}
},
getNetwork: function wm_gn(ssid) {
var network;
Expand Down

0 comments on commit 59804bd

Please sign in to comment.