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 nfcIOSSuccess = false;
public lat = 0; public lat = 0;
public longt = 0; public longt = 0;
private ssid = CommonService.MOHEMM_WIFI_SSID;
constructor( constructor(
private nfc: NFC, 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 // Wifi Attendance
public async startWifi() { public async startWifi() {
const isAndroid = this.platform.is("android"); const isAndroid = this.platform.is("android");
@ -216,25 +231,24 @@ export class AttendanceOptionsComponent implements OnInit {
if(!isWifiEnabled){ if(!isWifiEnabled){
this.showWifiNotEnabled(); this.showWifiNotEnabled();
return; return;
} else {
this.verifyWIFIConfiguration();
} }
} else if(isAndroid) { } else if(isAndroid) {
let locationPermission = await this.devicePermissionsService.requestLocationAutherization(); let locationPermission = await this.devicePermissionsService.requestLocationAutherization();
if (!locationPermission) { if (!locationPermission) {
return; return;
} }
if (!isWifiEnabled) { if (!isWifiEnabled) {
this.wifiWizard2.setWifiEnabled(true).then(()=>{
this.startWifi();
}).catch((err) => {
console.debug(err);
this.showWifiNotEnabled(); this.showWifiNotEnabled();
}); } else {
return; this.startWIFIProcedure();
} }
} }
// opening wifi dailog if all above conditions are passed (isWifiEnabled == true) }
async startWIFIProcedure () {
let modal = await this.modalController.create({ let modal = await this.modalController.create({
component: WifiModalComponent, component: WifiModalComponent,
showBackdrop: true, showBackdrop: true,

Loading…
Cancel
Save