Integrate service with app

This commit is contained in:
Ben Goldsworthy 2020-11-08 17:38:49 +00:00
parent 55a3f43f6c
commit 59de678e3f
2 changed files with 23 additions and 1 deletions

View file

@ -1,7 +1,19 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { MessagingService } from './service/messaging.service';
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
template: '<router-outlet></router-outlet>' template: '<router-outlet></router-outlet>'
}) })
export class AppComponent { } export class AppComponent {
title = 'push-notification';
message;
constructor(private messagingService: MessagingService) { }
ngOnInit() {
this.messagingService.requestPermission();
this.messagingService.receiveMessage();
this.message = this.messagingService.currentMessage;
}
}

View file

@ -23,6 +23,11 @@ import { OrgGuard } from './_guards/org.guard';
import { CustomerGuard } from './_guards/customer.guard'; import { CustomerGuard } from './_guards/customer.guard';
import { ApiService } from './providers/api-service'; import { ApiService } from './providers/api-service';
import { AngularFireMessagingModule } from '@angular/fire/messaging';
import { AngularFireModule } from '@angular/fire';
import { MessagingService } from './service/messaging.service';
import { AsyncPipe } from '../../node_modules/@angular/common';
import { OrgGraphsService } from './providers/org-graphs.service'; import { OrgGraphsService } from './providers/org-graphs.service';
import { CustGraphsService } from './providers/cust-graphs.service'; import { CustGraphsService } from './providers/cust-graphs.service';
import { OrgSnippetsService } from './providers/org-snippets.service'; import { OrgSnippetsService } from './providers/org-snippets.service';
@ -51,6 +56,8 @@ import { FilterPipeModule } from 'ngx-filter-pipe';
BrowserModule, BrowserModule,
HttpClientModule, HttpClientModule,
FormsModule, FormsModule,
AngularFireMessagingModule,
AngularFireModule.initializeApp(environment.firebase),
FilterPipeModule, FilterPipeModule,
ReactiveFormsModule, ReactiveFormsModule,
NgxPaginationModule, NgxPaginationModule,
@ -76,6 +83,8 @@ import { FilterPipeModule } from 'ngx-filter-pipe';
], ],
providers: [ providers: [
AuthGuard, AuthGuard,
MessagingService,
AsyncPipe,
OrgGuard, OrgGuard,
CustomerGuard, CustomerGuard,
ApiService, ApiService,
@ -92,6 +101,7 @@ import { FilterPipeModule } from 'ngx-filter-pipe';
], ],
bootstrap: [ AppComponent ] bootstrap: [ AppComponent ]
}) })
export class AppModule { export class AppModule {
constructor () { constructor () {
if (environment.enableAnalytics) { if (environment.enableAnalytics) {