Skip to content

Commit

Permalink
Rescan wireless networks on no result
Browse files Browse the repository at this point in the history
  • Loading branch information
mervinderuiter committed Dec 13, 2021
1 parent ca4d1f2 commit d9fe3ff
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/app/plugin/core-plugin/wifi-plugin.controller.js
Expand Up @@ -8,6 +8,7 @@ class WifiPluginController {
this.$translate = $translate;
this.uiSettingsService = uiSettingsService;
//this.wirelessNetworks = mockService.get('wirelessNetworks');
this.retryGetWirelessNetworks = false;
this.init();
}

Expand Down Expand Up @@ -94,6 +95,16 @@ class WifiPluginController {
data = {'available' : []};
}

if (data.available && data.available.length === 0) {
if (!this.retryGetWirelessNetworks) {
this.retryGetWirelessNetworks = true;
setTimeout(() => {
this.socketService.emit('getWirelessNetworks');
this.retryGetWirelessNetworks = false;
}, 2000);
}
}

data.available.forEach((network) => {
const actualNetwork = this.wirelessNetworks.available.find((n) => {
return n.ssid === network.ssid;
Expand Down

0 comments on commit d9fe3ff

Please sign in to comment.