|
|
|
|
@ -6,7 +6,6 @@ import { AlertController } from '@ionic/angular';
|
|
|
|
|
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
|
|
|
|
|
import { CheckUserAuthenticationRequest } from 'src/app/hmg-common/services/authentication/models/check-user-auth.request';
|
|
|
|
|
import { CheckUserAuthenticationResponse } from 'src/app/hmg-common/services/authentication/models/check-user-auth.response';
|
|
|
|
|
import { CheckActivationCodeRequest } from 'src/app/hmg-common/services/authentication/models/check-activation-code.request';
|
|
|
|
|
import { CheckActivationCodeResponse } from 'src/app/hmg-common/services/authentication/models/check-activation-code.response';
|
|
|
|
|
import { SmsReaderService } from 'src/app/hmg-common/services/sms/sms-reader.service';
|
|
|
|
|
import { AuthenticatedUser } from 'src/app/hmg-common/services/authentication/models/authenticated-user';
|
|
|
|
|
@ -16,8 +15,8 @@ import { GetLoginInfoRequest } from 'src/app/hmg-common/services/authentication/
|
|
|
|
|
import { GetLoginInfoResponse } from 'src/app/hmg-common/services/authentication/models/get-login-info.response';
|
|
|
|
|
import { Device } from '@ionic-native/device/ngx';
|
|
|
|
|
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
|
|
|
|
|
import { CountryCode } from 'src/app/hmg-common/ui/mobile-number/international-mobile/models/country-code.model';
|
|
|
|
|
import { SMSService } from 'src/app/hmg-common/ui/sms/service/smsservice';
|
|
|
|
|
import { SharedDataService } from 'src/app/hmg-common/services/shared-data-service/shared-data.service';
|
|
|
|
|
import { LoginModel } from '../models/LoginModel';
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'login',
|
|
|
|
|
@ -36,6 +35,12 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|
|
|
|
private language: string;
|
|
|
|
|
private username : string;
|
|
|
|
|
|
|
|
|
|
private currentLang : any;
|
|
|
|
|
private patientOutSA: boolean;
|
|
|
|
|
private loginTokenID: string;
|
|
|
|
|
private isMobileFingerPrint: boolean;
|
|
|
|
|
private FingerPrintPatientIdentificationID: string;
|
|
|
|
|
private loginData = new LoginModel();
|
|
|
|
|
constructor(
|
|
|
|
|
public cs: CommonService,
|
|
|
|
|
public authService: AuthenticationService,
|
|
|
|
|
@ -46,7 +51,8 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|
|
|
|
private faio: FingerprintAIO,
|
|
|
|
|
public ngZone: NgZone,
|
|
|
|
|
public device: Device,
|
|
|
|
|
public splash: SplashScreen
|
|
|
|
|
public splash: SplashScreen,
|
|
|
|
|
public sharedData: SharedDataService
|
|
|
|
|
) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -56,6 +62,7 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|
|
|
|
this.checkIfLoggedInBefore();
|
|
|
|
|
// this.splash.hide();
|
|
|
|
|
}, 100);
|
|
|
|
|
this.currentLang = TranslatorService.getCurrentLanguageCode();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ngOnDestroy(): void {
|
|
|
|
|
@ -71,6 +78,8 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|
|
|
|
else{
|
|
|
|
|
this.language = "AR";
|
|
|
|
|
}
|
|
|
|
|
this.currentLang = TranslatorService.getCurrentLanguageCode();
|
|
|
|
|
console.log(this.currentLang);
|
|
|
|
|
}
|
|
|
|
|
private checkIfLoggedInBefore() {
|
|
|
|
|
this.cs.startLoading();
|
|
|
|
|
@ -357,18 +366,10 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|
|
|
|
() => {
|
|
|
|
|
}, this.ts.trPK('general', 'ok')).subscribe((result: CheckUserAuthenticationResponse) => {
|
|
|
|
|
if (this.cs.validResponse(result)) {
|
|
|
|
|
console.log(result);
|
|
|
|
|
console.log(result);
|
|
|
|
|
this.loginData.LogInTokenID = result.LogInTokenID;
|
|
|
|
|
this.sharedData.setSharedData(this.loginData, "logindata");
|
|
|
|
|
this.cs.openSMSPage();
|
|
|
|
|
this.loginTokenID = result.LogInTokenID;
|
|
|
|
|
this.patientOutSA = result.PatientOutSA;
|
|
|
|
|
this.isMobileFingerPrint = false;
|
|
|
|
|
this.FingerPrintPatientIdentificationID = '';
|
|
|
|
|
if (result.isSMSSent) {
|
|
|
|
|
this.startListeneingForSMS();
|
|
|
|
|
} else {
|
|
|
|
|
this.smsService.stopSMSMonitoring();
|
|
|
|
|
this.checkActivationCode();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
@ -397,11 +398,6 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|
|
|
|
}, null, title);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private patientOutSA: boolean;
|
|
|
|
|
private loginTokenID: string;
|
|
|
|
|
private isMobileFingerPrint: boolean;
|
|
|
|
|
private FingerPrintPatientIdentificationID: string;
|
|
|
|
|
|
|
|
|
|
private checkActivationCode(readedCode?) {
|
|
|
|
|
/*const request = new CheckActivationCodeRequest();
|
|
|
|
|
request.IsMobileFingerPrint = this.isMobileFingerPrint;
|
|
|
|
|
@ -445,7 +441,7 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|
|
|
|
if (this.authService.isAgreedBefore()) {
|
|
|
|
|
this.cs.openHome();
|
|
|
|
|
} else {
|
|
|
|
|
//this.cs.openAgreement();
|
|
|
|
|
// this.cs.openAgreement();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|