fixed wifi issue

ZohaibIqbalKambrani
umasoodch 5 years ago
parent 0da64271fc
commit b792048a8f

@ -39,6 +39,8 @@ export class AttendanceOptionsComponent implements OnInit {
public nfcIOSSuccess = false;
public lat = 0;
public longt = 0;
private ssid = CommonService.MOHEMM_WIFI_SSID;
constructor(
private nfc: NFC,
@ -206,6 +208,19 @@ export class AttendanceOptionsComponent implements OnInit {
}
}
async verifyWIFIConfiguration() {
try {
let ssid_ = await this.wifiWizard2.getConnectedSSID();
if(ssid_ == this.ssid){
this.common.presentAlert(this.ts.trPK("general", "forget-wifi-connection-text"));
} else {
this.startWIFIProcedure();
}
} catch (err) {
this.common.presentAlert(this.ts.trPK("general", "forget-wifi-connection-text"));
}
}
// Wifi Attendance
public async startWifi() {
const isAndroid = this.platform.is("android");
@ -216,25 +231,24 @@ export class AttendanceOptionsComponent implements OnInit {
if(!isWifiEnabled){
this.showWifiNotEnabled();
return;
} else {
this.verifyWIFIConfiguration();
}
} else if(isAndroid) {
let locationPermission = await this.devicePermissionsService.requestLocationAutherization();
if (!locationPermission) {
return;
}
if (!isWifiEnabled) {
this.wifiWizard2.setWifiEnabled(true).then(()=>{
this.startWifi();
}).catch((err) => {
console.debug(err);
this.showWifiNotEnabled();
});
return;
} else {
this.startWIFIProcedure();
}
}
// opening wifi dailog if all above conditions are passed (isWifiEnabled == true)
}
async startWIFIProcedure () {
let modal = await this.modalController.create({
component: WifiModalComponent,
showBackdrop: true,

Loading…
Cancel
Save