fixed splash issues and network issue

mohemm-issues-jan-31
umasoodch 5 years ago
parent 965229d132
commit 0a6633c74b

@ -21,11 +21,10 @@
<preference name="FadeSplashScreenDuration" value="1000" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="3000" />
<preference name="fullscreen" value="false" />
<preference name="FadeSplashScreen" value="false" />
<preference name="AutoHideSplashScreen" value="false" />
<preference name="ShowSplashScreenSpinner" value="true" />
<preference name="ShowSplashScreenSpinner" value="false" />
<preference name="orientation" value="portrait" />
<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">

@ -61,11 +61,19 @@ export class AppComponent implements OnInit {
this.initializeApp();
}
private hideSplashScreen() {
setTimeout(() => {
this.splashScreen.hide();
}, 1000);
}
public initializeApp() {
this.cs.startLoading();
this.start = false;
this.menu.enable(false);
this.lazyLoadingService.monitorLazyLoading(15, true);
this.platform.ready().then(() => {
this.hideSplashScreen();
this.ts.loadResources(() => {
this.isIOS = this.platform.is('ios') ? true : false;
this.initializeDirection();
@ -92,7 +100,6 @@ export class AppComponent implements OnInit {
}
private startReceivingPushService() {
console.log('platform.ready');
this.pushService.startReceiving();
setTimeout(() => {
console.log(' in setTimeout startReceiving');
@ -210,18 +217,14 @@ export class AppComponent implements OnInit {
this.cs.sharedService.setSharedData(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();
}

@ -100,8 +100,7 @@ export class LoginComponent implements OnInit, OnDestroy {
ngOnInit() {
this.monitorKeyboardChange();
this.currentLang = TranslatorService.getCurrentLanguageCode();
console.log(TranslatorService.CURRENT_LANGUAGE)
console.log(TranslatorService.EN)
if (TranslatorService.CURRENT_LANGUAGE == TranslatorService.EN) {
this.language = "US";
this.changeLanguage('2')
@ -109,11 +108,9 @@ export class LoginComponent implements OnInit, OnDestroy {
this.language = "AR";
this.changeLanguage('1')
}
console.log("current lang: "+this.currentLang);
this.events.subscribe('user', user => {
this.user = user;
});
this.deviceToken =this.cs.getDeviceToken();
this.events.subscribe('user', user => { this.user = user; });
this.deviceToken = this.cs.getDeviceToken();
if (this.deviceToken) {
console.log('login enabled first time: ' + this.deviceToken);
} else {

@ -1,21 +1,15 @@
import { Injectable, NgZone } from '@angular/core';
// import { Push, PushObject, PushOptions } from '@ionic-native/push/ngx';
import { CommonService } from '../common/common.service';
import { TranslatorService } from '../translator/translator.service';
import { NotificationModel } from './models/notification.model';
import { SharedDataService } from '../shared-data-service/shared-data.service';
import { ConnectorService } from '../connector/connector.service';
//import { Response } from '../models/response';
import { Response } from 'src/app/hmg-common/services/models/response';
import { RegisterAuthenticatedUserRequest } from './models/register-authenticated-user.request';
import { Platform, Events } from '@ionic/angular';
import { RegisterNormalUserRequest } from './models/register-normal-user.request';
import { AuthenticationService } from '../authentication/authentication.service';
// import { AppointmentModel } from 'src/app/eservices/appointments/service/models/appointment.model';
import { SessionModel } from './models/session.model';
import { AuthenticatedUser } from '../authentication/models/authenticated-user';
// import { NotificationsCenterService } from 'src/app/eservices/notifications-center/service/notifications-center.service';
// import { NotificationsComponent } from 'src/app/eservices/notifications-center/notifications/notifications.component';
import { FirebaseX } from '@ionic-native/firebase-x/ngx';
@Injectable({
@ -28,7 +22,6 @@ export class PushService {
public static CHANNEL_ID = '679409052782';//'815750722565';
constructor(
// public push: Push,
public cs: CommonService,
public ts: TranslatorService,
public sharedService: SharedDataService,
@ -36,72 +29,14 @@ export class PushService {
private platform: Platform,
private authService: AuthenticationService,
public ngZone: NgZone,
// public notifyService: NotificationsCenterService,
public events: Events,
public firebasex: FirebaseX,
public firebasex: FirebaseX
) { }
public startReceiving() {
console.log("startReceiving");
// this.processStartReceiving();
this.processStartReceivingWithFirebase();
}
private processStartReceiving1() {
// if (this.cs.isCordova()) {
// this.stopNotifications(() => {
// this.push.hasPermission()
// .then((res: any) => {
// if (res.isEnabled) {
// this.createChannel();
// } else {
// this.cs.presentAlert(this.ts.trPK('push', 'no-permiss'));
// }
// });
// });
// }
}
private createChannel() {
// Create a channel (Android O and above). You'll need to provide the id, description and importance properties.
// this.push.createChannel({
// id: PushService.CHANNEL_ID,
// description: 'HMG push notifications',
// importance: 3
// }).then(() => {
// this.initialize();
// });
}
private initialize() {
// const options: PushOptions = {
// android: {
// senderID: PushService.CHANNEL_ID,
// sound: true,
// forceShow: true
// },
// ios: {
// alert: true,
// badge: true,
// sound: true
// },
// windows: {},
// browser: {
// pushServiceURL: 'http://push.api.phonegap.com/v1/push'
// }
// };
// const pushObject: PushObject = this.push.init(options);
// pushObject.on('notification').subscribe((notification: any) => {
// this.processNotification(notification);
// });
// pushObject.on('registration').subscribe((data: any) => {
// this.registerInBackend(data);
// });
// pushObject.on('error').subscribe(error => console.error('Error with Push plugin', error));
}
private processNotification(data: any) {
const notification = new NotificationModel();
@ -120,12 +55,9 @@ export class PushService {
const type = Number(data.additionalData.NotificationType);
if (type === NotificationModel.TYPE_APPOINTMENT) {
this.sharedService.setSharedData(notification, NotificationModel.SHARED_DATA);
// this.ngZone.run(() => this.cs.openAppointmentDetails());
} else if (type === NotificationModel.TYPE_CONFERENCE) {
const session = data.additionalData.sessionId;
// console.log('session Id Recieved>>>>>'+ session);
this.sharedService.setSharedData( new SessionModel(session) , SessionModel.SHARED_DATA);
// this.ngZone.run( () => this.cs.openConference() );
} else {
if (type === NotificationModel.TYPE_VIDEO) {
notification.MessageType = 'video';
@ -137,28 +69,11 @@ export class PushService {
notification.MessageType = 'text';
}
this.sharedService.setSharedData(notification, NotificationModel.SHARED_DATA);
//this.ngZone.run(async () => this.cs.openNotificationDetails());
}
}
private setAsReadNotification(notification: NotificationModel) {
notification.IsRead = true;
// this.notifyService.setNotificationRead(notification, () => {
// }).subscribe((result: Response) => {
// if (this.cs.validResponse(result)) {
// this.events.publish( NotificationsCenterService.NOTIFICATIONS_COUNT_EVENT, notification.count);
// }
// });
}
public stopNotifications(done: any) {
// Delete a channel (Android O and above)
// if (this.cs.isCordova()) {
// this.push.deleteChannel(PushService.CHANNEL_ID).then(() => {
// done();
// });
// }
}
private registerInBackend(data: any) {
@ -166,14 +81,7 @@ export class PushService {
if (data) {
this.cs.sharedService.setSharedData(data, AuthenticationService.DEVICE_TOKEN);
localStorage.setItem('deviceToken', data);
}
//
// if (this.authService.isAuthenticated()) {
// this.registerAuthenticatedUser(data);
// } else {
// this.registerNotAuthenticatedUser(data);
// }
}
@ -198,7 +106,6 @@ export class PushService {
});
}
private registerNotAuthenticatedUser(deviceToken: any) {
const request = new RegisterNormalUserRequest();
this.authService.setPublicFields(request);
@ -220,26 +127,13 @@ export class PushService {
private processStartReceivingWithFirebase() {
console.log("processStartReceivingWithFirebase");
this.firebasex.getToken().then(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);
}).catch(error => console.error('Error getting token', error));
// this.firebase.getToken()
// .then(token => console.log(`The token is ${token}`))
// .catch(error => console.error('Error getting token', error));
// this.firebasex.onTokenRefresh().subscribe(token => {
// alert("token: "+ token);
// this.registerInBackend(token);
// });
}
public onPushReceived(payload: any) {
@ -253,10 +147,4 @@ export class PushService {
console.log("onPushOpened openConference");
this.processNotification(payload);
}
}

@ -172,7 +172,7 @@ export class WorkListMainItgComponent implements OnInit {
}
}
slideChanged() {
slideChanged(event: any) {
this.slides.getActiveIndex().then(index => {
this.activeSegment = this.segmentsArray[index].name;
});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 442 KiB

After

Width:  |  Height:  |  Size: 276 KiB

Loading…
Cancel
Save