fixed issues

master
umasoodch 6 years ago
parent 74c2d4c6ca
commit 06226c89e7

@ -12,7 +12,8 @@ import { LazyLoadingService } from './hmg-common/services/lazy-loading/lazy-load
import { DomSanitizer } from '@angular/platform-browser';
// import { SplashScreen } from '@ionic-native/splash-screen';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { Router } from '@angular/router';
import { rejects } from 'assert';
@Component({
selector: 'app-root',
@ -50,8 +51,8 @@ export class AppComponent implements OnInit, AfterViewInit {
private authService: AuthenticationService,
private sanitizer: DomSanitizer,
public pushService: PushService,
private splashScreen: SplashScreen
private splashScreen: SplashScreen,
public router: Router,
) {
this.events.subscribe('img-change', displayImg => {
console.log('app compont: ' + displayImg);
@ -63,8 +64,6 @@ export class AppComponent implements OnInit, AfterViewInit {
}
ngOnInit() {
this.initializeApp();
}
ngAfterViewInit() {}
initializeApp() {
@ -94,6 +93,12 @@ export class AppComponent implements OnInit, AfterViewInit {
}
subscribeEvents() {
this.platform.backButton.subscribe(() => {
if (this.router.isActive('/authentication/login', true)) {
// tslint:disable-next-line: no-string-literal
navigator['app'].exitApp();
}
});
this.events.subscribe('setMenu', () => {
const user = this.authService
.loadAuthenticatedUser()
@ -204,83 +209,57 @@ export class AppComponent implements OnInit, AfterViewInit {
}
getLastLoginInfo() {
console.log(' getLastLoginInfo');
console.log('get method :' + this.cs.getDeviceToken());
this.deviceToken = this.cs.getDeviceToken();
// this.cs.sharedService.getSharedData("new-device-token",false);// localStorage.getItem('devicyeToken');
console.log('let deviceToken app' + this.cs.sharedService.getSharedData('new-device-token', false));
console.log('localStorage.getItem app' + localStorage.getItem('devicyeToken'));
console.log('sheard DEVICE_TOKEN' + this.cs.sharedService.getSharedData(AuthenticationService.DEVICE_TOKEN, false));
if (this.deviceToken) {
console.log('login enabled first time: ' + this.deviceToken);
} else {
console.log('no deviceToken' );
this.pushService.startReceiving();
setTimeout(() => {
this.deviceToken = localStorage.getItem('deviceToken');
console.log('login enabled second time: ' + this.deviceToken);
}, 1000);
}
console.log('login enabled first time: ' + this.deviceToken);
} else {
this.pushService.startReceiving();
setTimeout(() => {
this.deviceToken = localStorage.getItem('deviceToken');
}, 1000);
}
this.requestGetLoginInfo = {
DeviceType: this.cs.getDeviceType(), // 'Android',
DeviceToken: this.deviceToken// "5ca8a69cf1804db55264c349edffb99b9d63acd9fa9b6b18956bcb2ad3f2ba36"//this.deviceToken
};
this.authService.getLoginInfo(this.requestGetLoginInfo, () => {}, this.ts.trPK('general', 'ok')).subscribe(res => {
this.authService.getLoginInfo(this.requestGetLoginInfo, () => {}, this.ts.trPK('general', 'ok')).subscribe(res => {
if (this.cs.validResponse(res)) {
if (res.Mohemm_GetMobileLoginInfoList.length > 0) {
this.cs.sharedService.setSharedData(
// res.Patient_SELECTDeviceIMEIbyIMEIList[0],
res.Mohemm_GetMobileLoginInfoList[0],
AuthenticationService.IMEI_USER_DATA
);
this.user = true;
this.events.publish('user', this.user);
setTimeout(() => {
this.splashScreen.hide();
}, 3000);
if (this.logoutFlage) {
this.cs.openLogin();
}
} else {
this.user = false;
this.events.publish('user', this.user);
setTimeout(() => {
this.splashScreen.hide();
}, 3000);
if (this.logoutFlage) {
this.cs.openLogin();
}
}
} else {
// this.user = false;
// this.splashScreen.hide();
// if(this.logoutFlage){
// this.cs.openLogin();
// }
}
this.cs.sharedService.setSharedData(
// res.Patient_SELECTDeviceIMEIbyIMEIList[0],
res.Mohemm_GetMobileLoginInfoList[0],
AuthenticationService.IMEI_USER_DATA
);
this.user = true;
this.events.publish('user', this.user);
setTimeout(() => {
this.splashScreen.hide();
}, 3000);
if (this.logoutFlage) {
this.cs.openLogin();
}
} else {
this.user = false;
this.events.publish('user', this.user);
setTimeout(() => {
this.splashScreen.hide();
}, 3000);
if (this.logoutFlage) {
this.cs.openLogin();
}
}
} else {
// this.user = false;
// this.splashScreen.hide();
// if(this.logoutFlage){
// this.cs.openLogin();
// }
}
});
}

@ -8,7 +8,7 @@ import { LoginComponent } from './login/login.component';
import { ForgotComponent } from './forgot/forgot.component';
import { HmgCommonModule } from '../hmg-common/hmg-common.module';
import { SelectButtonModule } from 'primeng/selectbutton';
//import { AgreementComponent } from './agreement/agreement.component';
// import { AgreementComponent } from './agreement/agreement.component';
import { FingerprintAIO } from '@ionic-native/fingerprint-aio/ngx';
import { Device } from '@ionic-native/device/ngx';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';

@ -96,16 +96,8 @@ export class LoginComponent implements OnInit, OnDestroy {
private checkUserResult: CheckUserAuthenticationResponse;
ionViewWillEnter(){
console.log("ionViewWillEnter");
}
ngOnInit() {
// if(!this.cs.getIsTimeSessionOut()){
// this.getlastlogin = this.cs.sharedService.getSharedData(
// AuthenticationService.IMEI_USER_DATA,
// false

@ -16,31 +16,23 @@ export class GenericHeaderComponent implements OnInit {
@Input() updateDirection = false;
@Input() headerText = '';
@Input() backLink: string;
@Output() trigger= new EventEmitter();
@Output() trigger = new EventEmitter();
public close = 'assets/imgs/cancel.png';
constructor(public common: CommonService) { }
ngOnInit() {
console.log(this.updateDirection);
console.log(this.showClose);
console.log(this.showBack);
if(this.updateDirection){
this.showBack=false;
}else{
if (this.updateDirection) {
this.showBack = false;
}
}
openProfilePage() {
this.common.openEditProfile();
}
closeModal(){
console.log("closeModal");
this.trigger.emit();
closeModal() {
this.trigger.emit();
}
}

@ -1,7 +1,7 @@
import { EitService } from './../eit/services/eit.service';
import { Component, OnInit } from '@angular/core';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
import { MenuController, Events, ActionSheetController } from '@ionic/angular';
import { Platform, MenuController, Events, ActionSheetController } from '@ionic/angular';
import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
import { AuthenticatedUser } from 'src/app/hmg-common/services/authentication/models/authenticated-user';
import { MenuService } from 'src/app/hmg-common/services/menu/menuservice.service';
@ -35,6 +35,7 @@ import { AccrualService } from '../accrual-balances/services/accrual.service';
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';
@Component({
selector: 'app-home',
@ -148,7 +149,9 @@ export class HomePage implements OnInit {
public DS: DashboredService,
public accrualService: AccrualService,
public timeCardService: TimeCardService,
public workListService: WorklistMainService
public workListService: WorklistMainService,
public router: Router,
private platform: Platform,
) {
this.events.subscribe('img-change', displayImg => {
this.userImage = this.sanitizer.bypassSecurityTrustUrl(
@ -158,6 +161,11 @@ export class HomePage implements OnInit {
}
ngOnInit() {
this.platform.backButton.subscribeWithPriority(9999, () => {
if (this.router.isActive('/home', true)) {
this.common.openHome();
}
});
// this.getUserDetails();
// this.getCount();
// this.events.subscribe('getNotCount', badge => {
@ -181,6 +189,14 @@ export class HomePage implements OnInit {
this.getUserDetails();
}
// ionViewDidEnter() {
// // tslint:disable-next-line: only-arrow-functions
// document.addEventListener('backbutton', function(e) {
// e.preventDefault();
// e.stopPropagation();
// }, false);
// }
initTimer() {
this.runTimer = false;
this.hasStarted = false;

Loading…
Cancel
Save