|
|
|
|
@ -1,6 +1,5 @@
|
|
|
|
|
import { Component, OnInit, NgZone } from '@angular/core';
|
|
|
|
|
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
|
|
|
|
|
import {AttendScanService} from '../../hmg-common/services/attend-services/attend-scan.service';
|
|
|
|
|
import { attendanceSwipeScannerRequest } from 'src/app/home/models/attendanceSwipe.Request';
|
|
|
|
|
import { Device } from '@ionic-native/device/ngx';
|
|
|
|
|
import { AuthenticatedUser } from '../../hmg-common/services/authentication/models/authenticated-user';
|
|
|
|
|
@ -11,7 +10,6 @@ import { TranslatorService } from 'src/app/hmg-common/services/translator/transl
|
|
|
|
|
import { Platform } from "@ionic/angular";
|
|
|
|
|
import { WifiWizard2 } from "@ionic-native/wifi-wizard-2/ngx";
|
|
|
|
|
import { OpenNativeSettings } from '@ionic-native/open-native-settings/ngx';
|
|
|
|
|
import { iif } from 'rxjs';
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'app-wifi-modal',
|
|
|
|
|
@ -21,7 +19,6 @@ import { iif } from 'rxjs';
|
|
|
|
|
export class WifiModalComponent implements OnInit {
|
|
|
|
|
public userData: any = {};
|
|
|
|
|
public gifStatus = false;
|
|
|
|
|
|
|
|
|
|
private ssid = CommonService.MOHEMM_WIFI_SSID;
|
|
|
|
|
private password = CommonService.MOHEMM_WIFI_PASSWORD;
|
|
|
|
|
private algo = 'WPA';
|
|
|
|
|
@ -36,15 +33,13 @@ export class WifiModalComponent implements OnInit {
|
|
|
|
|
private wifiWizard2: WifiWizard2,
|
|
|
|
|
private openNativeSettings: OpenNativeSettings,
|
|
|
|
|
private platform: Platform,
|
|
|
|
|
private attendScanService: AttendScanService
|
|
|
|
|
) { }
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
this.userData = this.common.sharedService.getSharedData(AuthenticatedUser.SHARED_DATA, false);
|
|
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.startWifiConnection();
|
|
|
|
|
}, 1000);
|
|
|
|
|
this.startWifiConnection();
|
|
|
|
|
}, 1000);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async startWifiConnection() {
|
|
|
|
|
@ -75,7 +70,6 @@ export class WifiModalComponent implements OnInit {
|
|
|
|
|
console.debug("Wifi is not available considered your device is not in range");
|
|
|
|
|
this.showErrorInvalidWorkspace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else if (isIOS) {
|
|
|
|
|
this.wifiWizard2.iOSConnectNetwork(this.ssid,this.password).then(async (value) => {
|
|
|
|
|
let ssid_ = await this.wifiWizard2.getConnectedSSID();
|
|
|
|
|
@ -97,7 +91,6 @@ export class WifiModalComponent implements OnInit {
|
|
|
|
|
this.showWifiNotEnabled();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
showWifiNotEnabled(){
|
|
|
|
|
@ -177,7 +170,6 @@ export class WifiModalComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async isWifiAvailable(ssid:string){
|
|
|
|
|
|
|
|
|
|
let avaialble_wifi = await this.wifiWizard2.scan();
|
|
|
|
|
let find_ = avaialble_wifi.find(element => {
|
|
|
|
|
return element.SSID == ssid;
|
|
|
|
|
@ -185,5 +177,4 @@ export class WifiModalComponent implements OnInit {
|
|
|
|
|
console.log("find: " + find_.SSID);
|
|
|
|
|
return find_.SSID == ssid;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|