enhance login

MOHEMM-SFH-COLORS
Mohamed Mekawy 6 years ago
parent 9d4bd2f592
commit 289e5f1452

@ -15,11 +15,14 @@
<preference name="ScrollEnabled" value="false" /> <preference name="ScrollEnabled" value="false" />
<preference name="BackupWebStorage" value="none" /> <preference name="BackupWebStorage" value="none" />
<preference name="SplashMaintainAspectRatio" value="true" /> <preference name="SplashMaintainAspectRatio" value="true" />
<preference name="FadeSplashScreenDuration" value="300" /> <preference name="FadeSplashScreenDuration" value="1000" />
<preference name="SplashShowOnlyFirstTime" value="false" /> <preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="SplashScreen" value="screen" /> <preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="3000" /> <preference name="SplashScreenDelay" value="3000" />
<preference name="fullscreen" value="false" /> <preference name="fullscreen" value="false" />
<preference name="FadeSplashScreen" value="false" />
<preference name="AutoHideSplashScreen" value="false" />
<preference name="ShowSplashScreenSpinner" value="true" />
<platform name="android"> <platform name="android">
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android"> <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
<application android:networkSecurityConfig="@xml/network_security_config" /> <application android:networkSecurityConfig="@xml/network_security_config" />

@ -88,9 +88,9 @@ export class AppComponent implements OnInit, AfterViewInit {
console.log("platform.ready") console.log("platform.ready")
this.pushService.startReceiving(); this.pushService.startReceiving();
setTimeout(() => { setTimeout(() => {
console.log(" in setTimeout startReceiving");
this.getLastLoginInfo(); this.getLastLoginInfo();
},5000); },4000);
} }
subscribeEvents() { subscribeEvents() {
@ -202,8 +202,18 @@ export class AppComponent implements OnInit, AfterViewInit {
} }
getLastLoginInfo(){ getLastLoginInfo(){
this.deviceToken= localStorage.getItem('devicyeToken');
console.log("let deviceToken app" + this.deviceToken);
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) { if (this.deviceToken) {
console.log('login enabled first time: ' + this.deviceToken); console.log('login enabled first time: ' + this.deviceToken);
@ -236,8 +246,10 @@ export class AppComponent implements OnInit, AfterViewInit {
); );
this.user = true; this.user = true;
this.events.publish('user', this.user); this.events.publish('user', this.user);
setTimeout(() => {
this.splashScreen.hide();
},3000);
this.splashScreen.hide();
if(this.logoutFlage){ if(this.logoutFlage){
this.cs.openLogin(); this.cs.openLogin();
@ -247,7 +259,11 @@ export class AppComponent implements OnInit, AfterViewInit {
else{ else{
this.user = false; this.user = false;
this.events.publish('user', this.user); this.events.publish('user', this.user);
this.splashScreen.hide();
setTimeout(() => {
this.splashScreen.hide();
},3000);
if(this.logoutFlage){ if(this.logoutFlage){
this.cs.openLogin(); this.cs.openLogin();

@ -80,6 +80,7 @@ export class CommonService {
private loadingProgress: any; private loadingProgress: any;
public updateImage:boolean=false; public updateImage:boolean=false;
public setUpdateImg:any; public setUpdateImg:any;
DT: any;
constructor( constructor(
public nav: NavController, public nav: NavController,
public router: Router, public router: Router,
@ -1412,6 +1413,13 @@ public getMonthNameAr(value: number): string {
return objImg; return objImg;
} }
setDeviceToken(deviceToken){
this.DT=deviceToken;
}
getDeviceToken(){
return this.DT;
}
} }

@ -222,7 +222,12 @@ export class PushService {
this.firebasex.getToken().then(token => { this.firebasex.getToken().then(token => {
// alert("token: "+ token); // alert("token: "+ token);
this.cs.sharedService.setSharedData(token, "new-device-token");
localStorage.setItem('deviceToken', token);
this.cs.setDeviceToken(token); //last way to set the device Token to get it through getDeviceToken
this.registerInBackend(token); this.registerInBackend(token);
}).catch(error => console.error('Error getting token', error)); }).catch(error => console.error('Error getting token', error));

Loading…
Cancel
Save