|
|
|
|
@ -37,7 +37,7 @@ import { TimeCardService } from '../time-card/service/time-card.service';
|
|
|
|
|
import { WorklistMainService } from '../notification/service/work-list.main.service';
|
|
|
|
|
import { isThisISOWeek } from 'date-fns';
|
|
|
|
|
import { Router } from '@angular/router';
|
|
|
|
|
import { BackgroundGeolocation } from '@ionic-native/background-geolocation/ngx';
|
|
|
|
|
// import { BackgroundGeolocation } from '@ionic-native/background-geolocation/ngx';
|
|
|
|
|
import { NFC, Ndef } from "@ionic-native/nfc/ngx"
|
|
|
|
|
import { DigitalIdComponent } from '../authentication/digital-id/digital-id.component';
|
|
|
|
|
import { FirebaseX } from '@ionic-native/firebase-x/ngx';
|
|
|
|
|
@ -170,7 +170,7 @@ export class HomePage implements OnInit {
|
|
|
|
|
public workListService: WorklistMainService,
|
|
|
|
|
public router: Router,
|
|
|
|
|
private platform: Platform,
|
|
|
|
|
public backgroundGeolocation: BackgroundGeolocation,
|
|
|
|
|
// public backgroundGeolocation: BackgroundGeolocation,
|
|
|
|
|
public modalController: ModalController,
|
|
|
|
|
private nfc: NFC,
|
|
|
|
|
public firebasex: FirebaseX
|
|
|
|
|
@ -282,22 +282,22 @@ export class HomePage implements OnInit {
|
|
|
|
|
this.permissions.requestLocationAutherization().then(granted => {
|
|
|
|
|
this.location = granted as boolean;
|
|
|
|
|
if (this.location) {
|
|
|
|
|
if (this.platform.is('android')) {
|
|
|
|
|
this.backgroundGeolocation.getCurrentLocation({ timeout: 10000, enableHighAccuracy: true, maximumAge: 3000 }).then((resp) => {
|
|
|
|
|
if (resp && (resp.latitude && resp.longitude)) {
|
|
|
|
|
if (resp.isFromMockProvider || resp.mockLocationsEnabled) {
|
|
|
|
|
this.isFakeLocationUsed = true;
|
|
|
|
|
}
|
|
|
|
|
this.lat = resp.latitude;
|
|
|
|
|
this.longt = resp.longitude;
|
|
|
|
|
this.attendance();
|
|
|
|
|
} else {
|
|
|
|
|
this.common.presentAlert(this.ts.trPK('home', 'position-error'));
|
|
|
|
|
}
|
|
|
|
|
}, (error) => {
|
|
|
|
|
this.common.presentAlert(this.ts.trPK('home', 'position-error'));
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
// if (this.platform.is('android')) {
|
|
|
|
|
// this.backgroundGeolocation.getCurrentLocation({ timeout: 10000, enableHighAccuracy: true, maximumAge: 3000 }).then((resp) => {
|
|
|
|
|
// if (resp && (resp.latitude && resp.longitude)) {
|
|
|
|
|
// if (resp.isFromMockProvider || resp.mockLocationsEnabled) {
|
|
|
|
|
// this.isFakeLocationUsed = true;
|
|
|
|
|
// }
|
|
|
|
|
// this.lat = resp.latitude;
|
|
|
|
|
// this.longt = resp.longitude;
|
|
|
|
|
// this.attendance();
|
|
|
|
|
// } else {
|
|
|
|
|
// this.common.presentAlert(this.ts.trPK('home', 'position-error'));
|
|
|
|
|
// }
|
|
|
|
|
// }, (error) => {
|
|
|
|
|
// this.common.presentAlert(this.ts.trPK('home', 'position-error'));
|
|
|
|
|
// });
|
|
|
|
|
// } else {
|
|
|
|
|
this.geolocation.getCurrentPosition({ maximumAge: 3000, timeout: 10000, enableHighAccuracy: true }).then(resp => {
|
|
|
|
|
if (resp && resp.coords.latitude && resp.coords.longitude) {
|
|
|
|
|
this.lat = resp.coords.latitude;
|
|
|
|
|
@ -309,7 +309,7 @@ export class HomePage implements OnInit {
|
|
|
|
|
}).catch(error => {
|
|
|
|
|
this.common.presentAlert(this.ts.trPK('home', 'position-error'));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|