правка
This commit is contained in:
gofnnp 2023-01-12 02:27:14 +04:00
parent 4d16fa4184
commit f8f2fe4673

View File

@ -23,12 +23,17 @@ export class DownloadAppDirective implements OnInit {
console.log('INSTALLED!!!'); console.log('INSTALLED!!!');
}); });
if (!((this.deviceType == 'android' && this.deferredPrompt) || this.deviceType == 'ios')) { if (!((this.deviceType == 'android' && this.deferredPrompt) || this.deviceType == 'ios')) {
console.log(this.deviceType);
console.log(this.deferredPrompt);
this.el.nativeElement.style.display = 'none' this.el.nativeElement.style.display = 'none'
} }
} }
getTypeDevice() { getTypeDevice() {
const userAgent = window.navigator.userAgent.toLowerCase(); const userAgent = window.navigator.userAgent.toLowerCase();
console.log(userAgent);
const ios = /iphone|ipod|ipad/.test(userAgent); const ios = /iphone|ipod|ipad/.test(userAgent);
this.deviceType = ios ? 'ios' : 'android'; this.deviceType = ios ? 'ios' : 'android';
} }
@ -38,6 +43,14 @@ export class DownloadAppDirective implements OnInit {
if (event) { if (event) {
event.preventDefault(); event.preventDefault();
} }
if (this.deviceType === 'ios') {
this.messageService.add({
severity: 'custom',
summary: `Для установки нажмите на кнопку поделиться в Вашем браузере и выберите пункт 'На экран «Домой»'`,
sticky: true
});
return
}
if (!this.deferredPrompt) { if (!this.deferredPrompt) {
this.messageService.add({ this.messageService.add({
severity: 'error', severity: 'error',