инструкция для скачивания на айфон
This commit is contained in:
gofnnp 2022-09-20 12:50:42 +04:00
parent 475e02b5fc
commit 534fdda325
2 changed files with 18 additions and 2 deletions

View File

@ -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()"
>

View File

@ -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)
}