|
|
|
|
@ -45,7 +45,7 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|
|
|
|
public loginDiv:boolean =true;
|
|
|
|
|
public welcomeBack:boolean =false;
|
|
|
|
|
public logo = "assets/icon/login/password.png";
|
|
|
|
|
deviceToken: any;
|
|
|
|
|
deviceToken: any="";
|
|
|
|
|
user: boolean =false;
|
|
|
|
|
DeviceType: string;
|
|
|
|
|
requestGetLoginInfo:any;
|
|
|
|
|
@ -67,10 +67,35 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|
|
|
|
) { }
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
this.deviceToken= this.cs.sharedService.getSharedData(AuthenticationService.DEVICE_TOKEN, false);
|
|
|
|
|
console.log("get deviceToken login"+ this.deviceToken)
|
|
|
|
|
// this.deviceToken= this.cs.sharedService.getSharedData(AuthenticationService.DEVICE_TOKEN, false);
|
|
|
|
|
// console.log("get deviceToken login"+ this.deviceToken)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.deviceToken= localStorage.getItem('devicyeToken');
|
|
|
|
|
console.log("let deviceToken" + this.deviceToken);
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
|
|
|
|
this.getLastLoginInfo();
|
|
|
|
|
},5000);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.getLastLoginInfo();
|
|
|
|
|
|
|
|
|
|
//here will delete below part and depdding on user (response from getMobileInfo)
|
|
|
|
|
this.username = localStorage.getItem("user");
|
|
|
|
|
this.password = localStorage.getItem("password"); //****//
|
|
|
|
|
@ -143,20 +168,20 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|
|
|
|
// this.checkAppUpdated();
|
|
|
|
|
// this.checkUserAuthentication();
|
|
|
|
|
|
|
|
|
|
let deviceToken = localStorage.getItem('deviceToken');
|
|
|
|
|
console.log("let deviceToken" + deviceToken);
|
|
|
|
|
this.deviceToken = localStorage.getItem('deviceToken');
|
|
|
|
|
console.log("let deviceToken" + this.deviceToken);
|
|
|
|
|
|
|
|
|
|
if (deviceToken) {
|
|
|
|
|
console.log('login enabled first time: ' + deviceToken);
|
|
|
|
|
if (this.deviceToken) {
|
|
|
|
|
console.log('login enabled first time: ' + this.deviceToken);
|
|
|
|
|
this.checkAppUpdated();
|
|
|
|
|
} else {
|
|
|
|
|
console.log("no deviceToken" );
|
|
|
|
|
|
|
|
|
|
this.pushService.startReceiving();
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
deviceToken = localStorage.getItem('deviceToken');
|
|
|
|
|
this.deviceToken = localStorage.getItem('deviceToken');
|
|
|
|
|
this.checkAppUpdated();
|
|
|
|
|
console.log('login enabled second time: ' + deviceToken);
|
|
|
|
|
console.log('login enabled second time: ' + this.deviceToken);
|
|
|
|
|
}, 1000);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -329,7 +354,6 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|
|
|
|
///
|
|
|
|
|
|
|
|
|
|
getLastLoginInfo(){
|
|
|
|
|
this.deviceToken
|
|
|
|
|
this.requestGetLoginInfo= {
|
|
|
|
|
DeviceType:this.cs.getDeviceType(),
|
|
|
|
|
DeviceToken:this.deviceToken//"5ca8a69cf1804db55264c349edffb99b9d63acd9fa9b6b18956bcb2ad3f2ba36"//this.deviceToken
|
|
|
|
|
|