From d2045776ba6d7192f50db96c30354ce6f780c19c Mon Sep 17 00:00:00 2001 From: umasoodch Date: Sun, 3 Oct 2021 17:24:21 +0300 Subject: [PATCH] fixed wifi issue --- Mohem/src/app/hmg-common/hmg_utils.ts | 9 +++- .../services/connector/connector.service.ts | 4 +- .../home/wifi-model/wifi-modal.component.ts | 48 ++++++++++++++----- 3 files changed, 45 insertions(+), 16 deletions(-) diff --git a/Mohem/src/app/hmg-common/hmg_utils.ts b/Mohem/src/app/hmg-common/hmg_utils.ts index b5133350..3c7c5b6c 100644 --- a/Mohem/src/app/hmg-common/hmg_utils.ts +++ b/Mohem/src/app/hmg-common/hmg_utils.ts @@ -70,9 +70,16 @@ export class HMGUtils { const location = _res.split(',') console.log(location); if (location.length == 3) { + let mock = false; const lat = Number(_res.split(',')[0]); const long = Number(_res.split(',')[1]); - const mock = Boolean(_res.split(',')[2]); + const mockValue = _res.split(',')[2]; + + if (mockValue == 'true') { + mock = true; + } else { + mock = false; + } callBack({"latitude":lat, "longitude":long, "isfake":mock}) } else { this.common.presentAlert(this.ts.trPK('general', 'invalid-huawei-location')); diff --git a/Mohem/src/app/hmg-common/services/connector/connector.service.ts b/Mohem/src/app/hmg-common/services/connector/connector.service.ts index c869c5ef..dc119ce4 100644 --- a/Mohem/src/app/hmg-common/services/connector/connector.service.ts +++ b/Mohem/src/app/hmg-common/services/connector/connector.service.ts @@ -27,8 +27,8 @@ export class ConnectorService { public static retryTimes = 0; public static timeOut = 120 * 1000; - public static host = 'https://uat.hmgwebservices.com/'; - // public static host = 'https://hmgwebservices.com/'; + // public static host = 'https://uat.hmgwebservices.com/'; + public static host = 'https://hmgwebservices.com/'; constructor(public httpClient: HttpClient, public cs: CommonService, diff --git a/Mohem/src/app/home/wifi-model/wifi-modal.component.ts b/Mohem/src/app/home/wifi-model/wifi-modal.component.ts index 196f8eee..cd90f7ce 100644 --- a/Mohem/src/app/home/wifi-model/wifi-modal.component.ts +++ b/Mohem/src/app/home/wifi-model/wifi-modal.component.ts @@ -26,6 +26,14 @@ export class WifiModalComponent implements OnInit { public enableLocationWIFI: boolean; public lat: number; public longt: number; + public failedObjectWIFI = { + modeOfAttendance: 0, + messageStatus: 0, + transactionID: 0, + userID: '', + pointID: 0, + branchDescription: 0 + } constructor( public common: CommonService, @@ -153,25 +161,39 @@ export class WifiModalComponent implements OnInit { this.attendance_service .attendanceSwipeScanner(request, () => { - console.debug("Error inside in swipe attendance"); + if (enableFirestore) { + this.failedObjectWIFI.userID = this.userData.EMPLOYEE_NUMBER; + this.attendScanService.processFirebaseDocument(isPlatformValue, this.failedObjectWIFI); + } this.closeModal(); this.disconnectWifi(); - }) - .subscribe((result: Response) => { + }).subscribe((result: Response) => { if (enableFirestore) { this.attendScanService.processFirebaseDocument(isPlatformValue, result); } - this.disconnectWifi(); + // this.disconnectWifi(); if (this.common.validResponse(result)) { - this.ngZone.run(() => { - this.gifStatus = true; - }); - setTimeout(() => { - this.closeModal(); - // this.common.openAttenTrackingpage(); - }, 4000); - }else{ - console.debug(result); + if (result.MessageStatus && result.MessageStatus === 1) { + this.ngZone.run(() => { + this.gifStatus = true; + }); + setTimeout(() => { + this.closeModal(); + }, 4000); + this.disconnectWifi(); + } else { + if (enableFirestore) { + this.failedObjectWIFI.userID = this.userData.EMPLOYEE_NUMBER; + this.attendScanService.processFirebaseDocument(isPlatformValue, this.failedObjectWIFI); + } + this.disconnectWifi(); + } + } else { + if (enableFirestore) { + this.failedObjectWIFI.userID = this.userData.EMPLOYEE_NUMBER; + this.attendScanService.processFirebaseDocument(isPlatformValue, this.failedObjectWIFI); + } + this.disconnectWifi(); this.closeModal(); } });