From 0b5797249fd84b98d04168f114474180d83ff4d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20S=C3=A1nchez?= Date: Fri, 23 Jun 2023 21:40:21 +0200 Subject: [PATCH] feat(pwa): include `window-controls-overlay` in installed pwa logic (#2135) --- modules/pwa/runtime/pwa-plugin.client.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/pwa/runtime/pwa-plugin.client.ts b/modules/pwa/runtime/pwa-plugin.client.ts index 53671492..912ed0fc 100644 --- a/modules/pwa/runtime/pwa-plugin.client.ts +++ b/modules/pwa/runtime/pwa-plugin.client.ts @@ -11,7 +11,8 @@ export default defineNuxtPlugin(() => { // https://thomashunter.name/posts/2021-12-11-detecting-if-pwa-twa-is-installed const ua = navigator.userAgent const ios = ua.match(/iPhone|iPad|iPod/) - const standalone = window.matchMedia('(display-mode: standalone)').matches + const standalone = window.matchMedia('(display-mode: window-controls-overlay)').matches + || window.matchMedia('(display-mode: standalone)').matches const isInstalled = !!(standalone || (ios && !ua.match(/Safari/))) const registerPeriodicSync = (swUrl: string, r: ServiceWorkerRegistration) => {