parent
475e02b5fc
commit
534fdda325
@ -1,7 +1,7 @@
|
|||||||
<div class="footer-buttons-container">
|
<div class="footer-buttons-container">
|
||||||
<!-- *ngIf="deferredPrompt && token?.length" -->
|
<!-- *ngIf="deferredPrompt && token?.length" -->
|
||||||
<button
|
<button
|
||||||
*ngIf="token?.length"
|
*ngIf="((deviceType == 'android' && deferredPrompt) || deviceType == 'ios') && token?.length"
|
||||||
class="footer-buttons-container__button download"
|
class="footer-buttons-container__button download"
|
||||||
(click)="downloadPWA()"
|
(click)="downloadPWA()"
|
||||||
>
|
>
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||||
|
import { MessageService } from 'primeng/api';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-footer-buttons',
|
selector: 'app-footer-buttons',
|
||||||
@ -11,15 +12,30 @@ export class FooterButtonsComponent implements OnInit {
|
|||||||
@Input() isPermissionNotifications!: boolean;
|
@Input() isPermissionNotifications!: boolean;
|
||||||
@Output() downloadingPWA = new EventEmitter<null>();
|
@Output() downloadingPWA = new EventEmitter<null>();
|
||||||
@Output() requestingPermission = new EventEmitter<null>();
|
@Output() requestingPermission = new EventEmitter<null>();
|
||||||
|
public deviceType: 'ios' | 'android' | null = null;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
private messageService: MessageService,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
this.getTypeDevice()
|
||||||
|
}
|
||||||
|
|
||||||
|
getTypeDevice() {
|
||||||
|
const userAgent = window.navigator.userAgent.toLowerCase()
|
||||||
|
const ios = /iphone|ipod|ipad/.test( userAgent );
|
||||||
|
this.deviceType = ios ? 'ios' : 'android'
|
||||||
}
|
}
|
||||||
|
|
||||||
downloadPWA() {
|
downloadPWA() {
|
||||||
|
if (this.deviceType === 'ios') {
|
||||||
|
this.messageService.add({
|
||||||
|
severity: 'custom',
|
||||||
|
summary: "Для установки нажмите на кнопку поделиться в Вашем браузере и выберите пункт 'Добавить на главный экран'",
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
this.downloadingPWA.emit(null)
|
this.downloadingPWA.emit(null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user