dev #14537 Добавить кнопку подписки на уведомления CL

This commit is contained in:
nikolay 2023-06-19 10:04:45 +04:00
parent 0ca219c7fa
commit d66f72dc2e
5 changed files with 28 additions and 4 deletions

View File

@ -2,5 +2,15 @@
<mat-icon style="cursor: pointer;" aria-hidden="false" aria-label="Назад" fontIcon="arrow_back_ios" class="back-arrow" (click)="back()"></mat-icon>
<h1 class="title">{{title}}</h1>
<!-- <div class="plug"></div> -->
<button mat-stroked-button appDownloadApp>Установить</button>
<div class="wrapper">
<button
mat-button
*ngIf="!messagingService.checkRequestPermission()"
(click)="messagingService.requestPermission()"
class="notification"
>
<img src="./assets/notification.svg" alt="notification" />
</button>
<button mat-stroked-button appDownloadApp>Установить</button>
</div>
</div>

View File

@ -1,5 +1,12 @@
:host {
width: 100%;
width: 100%;
.notification {
img {
width: 28px;
height: 28px;
}
}
}
.container {
@ -31,4 +38,9 @@
line-height: 22px;
margin: 0;
}
.wrapper {
display: flex;
align-items: center;
gap: 10px;
}
}

View File

@ -1,4 +1,5 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { MessagingService } from 'src/app/services/messaging.service';
@Component({
selector: 'app-navbar[title]',
@ -9,7 +10,7 @@ export class NavbarComponent implements OnInit {
@Input() title: string = 'Название не задано'
@Output() backEvent = new EventEmitter<null>();
constructor() { }
constructor(public messagingService: MessagingService) { }
ngOnInit(): void {
}
@ -18,4 +19,5 @@ export class NavbarComponent implements OnInit {
this.backEvent.emit(null)
}
}

View File

@ -76,7 +76,6 @@ export class GuestCardComponent implements OnInit {
} else {
//FIREBASE HERE
this.messagingService.requestPermission();
this.messagingService.receiveMessage();
// this.message = this.messagingService.currentMessage;
}
}

View File

@ -78,6 +78,7 @@ export class MessagingService {
this.angularFireMessaging.requestToken.subscribe({
next: (token) => {
this.updateToken(token);
this.receiveMessage();
},
error: (e) => console.error(e),
});