From fcdb3d8fc72e1a436eac78d45334801c0a05be88 Mon Sep 17 00:00:00 2001 From: nikolay Date: Thu, 22 Jun 2023 11:35:06 +0400 Subject: [PATCH] =?UTF-8?q?dev=20#14384=20=D0=9F=D1=80=D0=B0=D0=B2=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BE=D0=BA=20=D0=BE=D1=82?= =?UTF-8?q?=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8=D1=8F=20WPA=20?= =?UTF-8?q?=D0=9A=D0=BE=D1=84=D0=B5=D0=9B=D0=B0=D0=B9=D0=BA:=20add=20getIn?= =?UTF-8?q?stalledrelatedApps=20log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- angular/src/app/directives/.#download-app.directive.ts | 1 + .../default-option/components/navbar/navbar.component.ts | 4 +++- angular/src/app/utils.ts | 8 ++++++++ angular/src/manifest.webmanifest | 6 +++++- 4 files changed, 17 insertions(+), 2 deletions(-) create mode 120000 angular/src/app/directives/.#download-app.directive.ts diff --git a/angular/src/app/directives/.#download-app.directive.ts b/angular/src/app/directives/.#download-app.directive.ts new file mode 120000 index 0000000..0a3f76c --- /dev/null +++ b/angular/src/app/directives/.#download-app.directive.ts @@ -0,0 +1 @@ +nikolay@arch.3860:1687414554 \ No newline at end of file diff --git a/angular/src/app/presentation-options/default-option/components/navbar/navbar.component.ts b/angular/src/app/presentation-options/default-option/components/navbar/navbar.component.ts index 14e3362..94862ca 100644 --- a/angular/src/app/presentation-options/default-option/components/navbar/navbar.component.ts +++ b/angular/src/app/presentation-options/default-option/components/navbar/navbar.component.ts @@ -1,6 +1,6 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { MessagingService } from 'src/app/services/messaging.service'; -import { getTypeDevice, DeviceType } from 'src/app/utils'; +import { getTypeDevice, DeviceType, pwaInstalled } from 'src/app/utils'; import { AppleWalletService } from 'src/app/services/apple-wallet.service'; import { CookiesService } from 'src/app/services/cookies.service'; import { MatBottomSheet } from '@angular/material/bottom-sheet'; @@ -40,6 +40,8 @@ export class NavbarComponent implements OnInit { const deviceType = getTypeDevice(); this.showMenu = deviceType === DeviceType.ios; + + pwaInstalled(); } toggleMenu() { diff --git a/angular/src/app/utils.ts b/angular/src/app/utils.ts index 1dc860b..f0c03f4 100644 --- a/angular/src/app/utils.ts +++ b/angular/src/app/utils.ts @@ -8,3 +8,11 @@ export function getTypeDevice(): DeviceType { const ios = /iphone|ipod|ipad/.test(userAgent); return ios ? DeviceType.ios : DeviceType.android; } + +export async function pwaInstalled(): Promise { + if ("getInstalledRelatedApps" in navigator) { + const apps = await (window.navigator as any).getInstalledRelatedApps(); + console.log(apps) + } + return false; +} diff --git a/angular/src/manifest.webmanifest b/angular/src/manifest.webmanifest index ec39bf6..9cb6598 100644 --- a/angular/src/manifest.webmanifest +++ b/angular/src/manifest.webmanifest @@ -50,5 +50,9 @@ "purpose": "maskable any" } ], - "gcm_sender_id": "99855572145" + "gcm_sender_id": "99855572145", + "related_applications": [{ + "platform": "webapp", + "url": "https://coffee-like-test.lk.crm4retail.ru/manifest.webmanifest" + }] }