forked from Mirrors/elk
feat(pwa): include window-controls-overlay
in installed pwa logic (#2135)
This commit is contained in:
parent
e453a316f7
commit
0b5797249f
1 changed files with 2 additions and 1 deletions
|
@ -11,7 +11,8 @@ export default defineNuxtPlugin(() => {
|
||||||
// https://thomashunter.name/posts/2021-12-11-detecting-if-pwa-twa-is-installed
|
// https://thomashunter.name/posts/2021-12-11-detecting-if-pwa-twa-is-installed
|
||||||
const ua = navigator.userAgent
|
const ua = navigator.userAgent
|
||||||
const ios = ua.match(/iPhone|iPad|iPod/)
|
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 isInstalled = !!(standalone || (ios && !ua.match(/Safari/)))
|
||||||
|
|
||||||
const registerPeriodicSync = (swUrl: string, r: ServiceWorkerRegistration) => {
|
const registerPeriodicSync = (swUrl: string, r: ServiceWorkerRegistration) => {
|
||||||
|
|
Loading…
Reference in a new issue