|
|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
import { Component, OnInit, NgZone, OnDestroy } from '@angular/core';
|
|
|
|
|
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
|
|
|
|
|
import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
|
|
|
|
|
import { Router } from '@angular/router';
|
|
|
|
|
import { ActivatedRoute, Router } from '@angular/router';
|
|
|
|
|
import { AlertController, Platform, Events } from '@ionic/angular';
|
|
|
|
|
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
|
|
|
|
|
import { CheckUserAuthenticationResponse } from 'src/app/hmg-common/services/authentication/models/check-user-auth.response';
|
|
|
|
|
@ -22,6 +22,7 @@ import { ModalController } from '@ionic/angular';
|
|
|
|
|
import { DigitalIdComponent } from '../digital-id/digital-id.component';
|
|
|
|
|
import { AppUpdateComponent } from '../app-update/app-update.component';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'login',
|
|
|
|
|
templateUrl: './login.component.html',
|
|
|
|
|
@ -47,7 +48,9 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|
|
|
|
public plt: Platform,
|
|
|
|
|
public pushService: PushService,
|
|
|
|
|
public keyboardService: KeyboardService,
|
|
|
|
|
public modalController: ModalController
|
|
|
|
|
public modalController: ModalController,
|
|
|
|
|
public route:ActivatedRoute,
|
|
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
this.events.subscribe('logoutFlage', logoutFlage => {
|
|
|
|
|
console.log('login compont logoutFlage: ' + logoutFlage);
|
|
|
|
|
@ -68,6 +71,13 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|
|
|
|
} else {
|
|
|
|
|
this.user = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// this.route
|
|
|
|
|
//.params.subscribe(val => {
|
|
|
|
|
|
|
|
|
|
console.log("login page called init...")
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
appLang = 1;
|
|
|
|
|
@ -103,20 +113,25 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|
|
|
|
private checkUserResult: CheckUserAuthenticationResponse;
|
|
|
|
|
public inputType = "password";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
this.monitorKeyboardChange();
|
|
|
|
|
this.userInfo = JSON.parse(localStorage.getItem('digitalIDUser'));
|
|
|
|
|
// this.currentLang = TranslatorService.getCurrentLanguageCode();
|
|
|
|
|
this.currentLang = 2;
|
|
|
|
|
this.ts.setCurrentLanguage('en');
|
|
|
|
|
// if (this.currentLang == 2) {
|
|
|
|
|
// this.language = "US";
|
|
|
|
|
// this.changeLanguage('2')
|
|
|
|
|
// } else {
|
|
|
|
|
// this.language = "AR";
|
|
|
|
|
// this.changeLanguage('1')
|
|
|
|
|
// }
|
|
|
|
|
document.getElementById('lang').lang = this.currentLang == 1 ? 'ar' : 'en';
|
|
|
|
|
|
|
|
|
|
console.log("login page called...");
|
|
|
|
|
|
|
|
|
|
var previousLanguage= localStorage.getItem(TranslatorService.LNG_KEY);
|
|
|
|
|
if(previousLanguage){
|
|
|
|
|
this.currentLang = previousLanguage =='en' ? 2 : 1;
|
|
|
|
|
}else{
|
|
|
|
|
document.getElementById('lang').lang = 'en';
|
|
|
|
|
TranslatorService.CURRENT_LANGUAGE = TranslatorService.EN;
|
|
|
|
|
this.currentLang =2;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.events.subscribe('user', user => { this.user = user; });
|
|
|
|
|
this.deviceToken = this.cs.getDeviceToken();
|
|
|
|
|
if (this.deviceToken) {
|
|
|
|
|
@ -143,7 +158,9 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|
|
|
|
start() {
|
|
|
|
|
this.cs.startLoading();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ngAfterViewInit(){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public changeLanguage(langNumber) {
|
|
|
|
|
console.log("current lang: " + this.currentLang)
|
|
|
|
|
console.log("click lang: " + langNumber)
|
|
|
|
|
@ -345,6 +362,14 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|
|
|
|
if (anotherUser) {
|
|
|
|
|
this.username = '';
|
|
|
|
|
this.password = '';
|
|
|
|
|
var previousLanguage= localStorage.getItem(TranslatorService.LNG_KEY);
|
|
|
|
|
if(previousLanguage){
|
|
|
|
|
this.currentLang = previousLanguage =='en' ? 2 : 1;
|
|
|
|
|
}else{
|
|
|
|
|
document.getElementById('lang').lang = 'en';
|
|
|
|
|
TranslatorService.CURRENT_LANGUAGE = TranslatorService.EN;
|
|
|
|
|
this.currentLang =2;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
console.log('login emit');
|
|
|
|
|
console.log('login');
|
|
|
|
|
@ -355,6 +380,14 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|
|
|
|
|
|
|
|
|
loginWithUser() {
|
|
|
|
|
console.log('loginWithUser');
|
|
|
|
|
var previousLanguage= localStorage.getItem(TranslatorService.LNG_KEY);
|
|
|
|
|
if(previousLanguage){
|
|
|
|
|
this.currentLang = previousLanguage =='en' ? 2 : 1;
|
|
|
|
|
}else{
|
|
|
|
|
document.getElementById('lang').lang = 'en';
|
|
|
|
|
TranslatorService.CURRENT_LANGUAGE = TranslatorService.EN;
|
|
|
|
|
this.currentLang =2;
|
|
|
|
|
};
|
|
|
|
|
this.cs.openConfirmLoginPage();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|