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