push notification added

MOHEMM-Q3-DEV-LATEST
Sultan Khan 3 years ago
parent 9ad53b9857
commit b309efb375

@ -8,6 +8,7 @@ const routes: Routes = [
path: 'authentication', loadChildren: './authentication/authentication.module#AuthenticationPageModule' path: 'authentication', loadChildren: './authentication/authentication.module#AuthenticationPageModule'
}, },
{ path: 'home', loadChildren: './home/home.module#HomePageModule' }, { path: 'home', loadChildren: './home/home.module#HomePageModule' },
{ path: 'profile', loadChildren: './profile/profile.module#ProfilePageModule' }, { path: 'profile', loadChildren: './profile/profile.module#ProfilePageModule' },
{ path: 'vacation-rule', loadChildren: './vacation-rule/vacation-rule.module#VacationRulePageModule' }, { path: 'vacation-rule', loadChildren: './vacation-rule/vacation-rule.module#VacationRulePageModule' },
{ path: 'accrual-balances', loadChildren: './accrual-balances/accrual-balances.module#AccrualBalancesPageModule' }, { path: 'accrual-balances', loadChildren: './accrual-balances/accrual-balances.module#AccrualBalancesPageModule' },
@ -29,7 +30,9 @@ const routes: Routes = [
{ path: 'reports', loadChildren: './reports/reports.module#ReportsPageModule' }, { path: 'reports', loadChildren: './reports/reports.module#ReportsPageModule' },
{ path: 'termination', loadChildren: './termination/termination.module#TerminationPageModule' }, { path: 'termination', loadChildren: './termination/termination.module#TerminationPageModule' },
{ path: 'pending-transaction', loadChildren: './pending-transaction/pending-transaction.module#PendingTransactionPageModule' } { path: 'pending-transaction', loadChildren: './pending-transaction/pending-transaction.module#PendingTransactionPageModule' },
{ path: 'notification-center', loadChildren: './notification-center/notification-center.module#NotificationCenterPageModule' }

@ -19,6 +19,7 @@ h1{
span { span {
font-weight: bold; font-weight: bold;
} }
.button-login { .button-login {
--background: var(--newgreen) !important; --background: var(--newgreen) !important;
@ -57,9 +58,10 @@ ion-input {
transition: all .2s ease-in-out; transition: all .2s ease-in-out;
border-radius: 3px; border-radius: 3px;
display: inline-block; display: inline-block;
&:focus { &:focus {
border-color: var(--ion-color-secondary) !important; border-color: var(--ion-color-secondary) !important;
box-shadow: 0 0 5px var(--ion-color-secondary) !important inset; box-shadow: 0 0 5px var(--ion-color-secondary) !important;
} }
&::selection { &::selection {

@ -1430,7 +1430,9 @@ export class CommonService {
public openLogin() { public openLogin() {
this.nav.navigateRoot(['/authentication/login']); this.nav.navigateRoot(['/authentication/login']);
} }
public openNotificationCenter() {
this.nav.navigateRoot(['/notification-center']);
}
public openUserForgot() { public openUserForgot() {
this.nav.navigateForward(['/authentication/checkuser']); this.nav.navigateForward(['/authentication/checkuser']);
} }

@ -45,7 +45,7 @@ export class PushService {
this.processStartReceivingWithFirebase(); this.processStartReceivingWithFirebase();
} }
}); });
} }
private processNotification(data: any) { private processNotification(data: any) {
@ -144,6 +144,18 @@ export class PushService {
this.cs.setDeviceToken(token); //last way to set the device Token to get it through getDeviceToken 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));
this.firebasex.onMessageReceived().subscribe(data => {
console.log("onMessageReceived");
console.log(data);
this.firebasex.clearAllNotifications();
if (data.notification_type == 3) {
this.cs.sharedService.setSharedData(data, NotificationModel.SHARED_DATA);
this.cs.openNotificationCenter();
}
});
} }
public onPushReceived(payload: any) { public onPushReceived(payload: any) {

@ -0,0 +1,29 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { Routes, RouterModule } from '@angular/router';
import { IonicModule } from '@ionic/angular';
import { NotificationCenterPage } from './notification-center.page';
import { DetailComponent } from './notification-detail/detail.component';
import { HmgCommonModule } from '../hmg-common/hmg-common.module';
const routes: Routes = [
{
path: '',
component: DetailComponent
}
];
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
HmgCommonModule,
RouterModule.forChild(routes)
],
declarations: [NotificationCenterPage, DetailComponent]
})
export class NotificationCenterPageModule { }

@ -0,0 +1,6 @@
<ion-content>
<ion-router-outlet></ion-router-outlet>
</ion-content>

@ -0,0 +1,27 @@
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NotificationCenterPage } from './notification-center.page';
describe('NotificationCenterPage', () => {
let component: NotificationCenterPage;
let fixture: ComponentFixture<NotificationCenterPage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ NotificationCenterPage ],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(NotificationCenterPage);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-notification-center',
templateUrl: './notification-center.page.html',
styleUrls: ['./notification-center.page.scss'],
})
export class NotificationCenterPage implements OnInit {
constructor() { }
ngOnInit() {
}
}

@ -0,0 +1,30 @@
<ion-header>
<ion-toolbar>
<nav-buttons backLink="/authentication/login"></nav-buttons>
<ion-title >{{ 'worklistMain,notfDetails' | translate }} </ion-title>
<!-- <ion-title *ngIf="notification.NotificationType != 11"> {{ 'notifications,details' | translate }}</ion-title>
<ion-title *ngIf="notification.NotificationType == 11"> {{ 'family,instrucion' | translate }}</ion-title>
-->
</ion-toolbar>
</ion-header>
<ion-content class="item-background" padding>
<ion-grid>
<ion-row class="ion-justify-content-center">
<ion-col [size]="11">
<p>{{data.image_Text}}</p>
</ion-col>
</ion-row>
<ion-row class="ion-justify-content-center">
<ion-col [size]="11">
<img [src]="data.image_URL" class="full-width">
</ion-col>
</ion-row>
</ion-grid>
<page-trailer></page-trailer>
</ion-content>

@ -0,0 +1,61 @@
.vertical_space {
height: 0.5cm;
width: 100%;
}
.title {
font-size: 0.38cm;
font-weight: bold;
}
.info-icon ion-icon {
font-size: 90px;
margin: 10px auto;
display: block;
margin-bottom: 0;
color: var(--ion-color-danger);
}
.info-icon h1 {
margin: auto;
font-size: 22px;
text-align: center;
margin-top: 10%;
}
.info-icon {
padding: 20px;
background: #fff;
margin: 20px;
margin-top: 15%;
border-radius: 15px;
}
.info-icon .line {
width: 100%;
height: 1px;
background: #ccddcc;
margin: 15px auto;
}
.info-icon .instruction p {
display: block;
margin: 0px;
margin-top: 7%;
color: #000;
text-align: center;
}
.info-icon b {
bottom: 11px;
margin: 18px;
color: var(--ion-color-danger);
}
.instruction b {
color: var(--ion-color-danger);
font-weight: bolder;
}
.stop-icon {
display: flex;
margin: 10px auto;
width: 45%;
margin-top: 40px;
}
p.otherwise {
font-size: 20px !important;
}

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { DetailComponent } from './detail.component';
describe('DetailComponent', () => {
let component: DetailComponent;
let fixture: ComponentFixture<DetailComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DetailComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(DetailComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -0,0 +1,78 @@
import { Component, OnInit } from '@angular/core';
import { NotificationModel } from 'src/app/hmg-common/services/push/models/notification.model';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
import { SharedDataService } from 'src/app/hmg-common/services/shared-data-service/shared-data.service';
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
// import { NotificationsCenterService } from '../service/notifications-center.service';
import { Route, Router, ActivatedRoute, ActivationEnd } from '@angular/router';
import { SafeResourceUrl, DomSanitizer } from '@angular/platform-browser';
@Component({
selector: 'app-detail',
templateUrl: './detail.component.html',
styleUrls: ['./detail.component.scss']
})
export class DetailComponent implements OnInit {
public notification: NotificationModel;
public video_link: string;
public trustedVideoUrl: SafeResourceUrl;
public direction: any;
public data: any;
constructor(
public cs: CommonService,
public ts: TranslatorService,
public sharedData: SharedDataService,
// public notifyService: NotificationsCenterService,
public router: Router,
private domSanitizer: DomSanitizer,
public route: ActivatedRoute
) {
}
ngOnInit() {
this.direction = TranslatorService.getCurrentDirection();
this.data = this.sharedData.getSharedData(NotificationModel.SHARED_DATA, true);
}
// this.initialize();
// if (this.notification.MessageType == "image") {
// }
// if (this.notification.MessageType == "video") {
// var url = this.notification.MessageTypeData;
// var v_id = url.substr(url.lastIndexOf("?v=") + 3, url.length);
// this.trustedVideoUrl = this.domSanitizer.bypassSecurityTrustResourceUrl("https://www.youtube.com/embed/" + v_id);
// }
// else {
// }
// }
// private initialize() {
// // this.notifyService.decreaseBadgeCount();
// this.notification = this.sharedData.getSharedData(NotificationModel.SHARED_DATA, true);
// if (!this.notification) {
// this.cs.back();
// }
// if (this.notification.MessageType == "image") {
// }
// if (this.notification.MessageType == "video") {
// var url = this.notification.MessageTypeData;
// var v_id = url.substr(url.lastIndexOf("?v=") + 3, url.length);
// this.trustedVideoUrl = this.domSanitizer.bypassSecurityTrustResourceUrl("https://www.youtube.com/embed/" + v_id);
// } else {
// }
// }
// public isHtml5VideoSupported(): boolean {
// return this.cs.isHtml5VideoSupported();
// }
// public playNativeVideo() {
// this.cs.openBrowser(this.notification.MessageTypeData);
// }
}

@ -1290,7 +1290,7 @@ export class WorklistMainComponent implements OnInit {
showLoading(notificationList) { showLoading(notificationList) {
if (notificationList.length < 0) { if (notificationList.length < 0) {
return true; return true;
} else if (notificationList === []) { } else if (notificationList.length == 0) {
return false; return false;
} else { return true; } } else { return true; }
} }

Loading…
Cancel
Save