Fixed PWA on iOS 27

This commit is contained in:
dredgy committed 2026-11-05 21:43:12 +10:00
1 parent 1411cadcc9
commit c7327cac1a
2 files changed
+38 -42

No files matched your search

+37 -41
View File
@@ -4,47 +4,32 @@ import MainFooter from "@/Components/FlightsGoneBy/MainFooter.vue";
import Radar from "@/Components/FlightsGoneBy/Radar.vue";
import StatusNotifications from "@/Components/FlightsGoneBy/StatusNotifications.vue";
import ToastNotifications from "@/Components/FlightsGoneBy/ToastNotifications.vue";
import {router, usePage} from "@inertiajs/vue3";
import { router, usePage } from "@inertiajs/vue3";
import { ref } from "vue";
import NotificationListener from "@/Components/FlightsGoneBy/NotificationListener.vue";
import {SharedProps} from "@/Types/types";
import { SharedProps } from "@/Types/types";
import PushNotificationPrompt from "@/Components/PushNotificationPrompt.vue";
import CopyPageButton from "@/Components/FlightsGoneBy/CopyPageButton.vue";
const transitionKey = ref(0);
const page = usePage<SharedProps>().props
const page = usePage<SharedProps>().props;
router.on('success', () => {
router.on("success", () => {
transitionKey.value++;
});
const isIOS27PlusPWA = (() => {
const ua = navigator.userAgent;
const isStandalone =
window.matchMedia('(display-mode: standalone)').matches ||
(navigator as Navigator & { standalone?: boolean }).standalone;
if (!isStandalone) return false;
// iPhone / iPad detection
const isIOS =
/iPhone|iPad|iPod/.test(ua) ||
(navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1);
if (!isIOS) return false;
// iOS 27+ detection (Safari version token)
const version = ua.match(/Version\/(\d+)/);
return version && parseInt(version[1]) >= 27;
})();
</script>
<template>
<Radar>
<!--
A real fixed element at the top edge: Safari tints the status bar
with its colour instead of drawing the translucent blur.
(Pseudo-elements don't trigger this.)
-->
<div class="status-bar-backing" aria-hidden="true"></div>
<div class="layoutContainer">
<div v-if="isIOS27PlusPWA" class="ios-top-bar"></div>
<MainHeader :key="`header-${transitionKey}`" />
<Transition name="fade" mode="out-in">
<main id="pageContainer" :key="`main-${transitionKey}`">
@@ -56,6 +41,7 @@ const isIOS27PlusPWA = (() => {
</span>
<MainFooter :key="`footer-${transitionKey}`" />
</div>
<NotificationListener v-if="page.auth.user?.id" :user-id="page.auth.user?.id" />
<StatusNotifications />
<ToastNotifications />
@@ -64,23 +50,28 @@ const isIOS27PlusPWA = (() => {
</template>
<style scoped>
.status-bar-backing {
position: fixed;
top: 0;
left: 0;
right: 0;
height: max(10px, env(safe-area-inset-top, 0px));
background: var(--surface);
z-index: 9999;
pointer-events: none;
}
.layoutContainer {
display: flex;
flex-direction: column;
min-height: 100dvh;
color: var(--text);
overflow-y: auto;
}
.ios-top-bar {
position: fixed;
top: 0;
left: 0;
right: 0;
height: 6px;
padding-bottom: 16px;
z-index: 9999;
background: var(--surface);
box-sizing: border-box;
/* Push the header below the status bar. If Safari's solid area is taller
than the reported inset, add a few px here, e.g. calc(env(...) + 12px). */
padding-top: calc(env(safe-area-inset-top, 0px) + 16px);
padding-bottom: env(safe-area-inset-bottom, 0px);
}
header,
@@ -107,13 +98,18 @@ main {
}
.footer-share {
padding:1em;
padding: 1em;
display: flex;
justify-content: center;
}
.fade-enter-from,
.fade-leave-to { opacity: 0; }
.fade-leave-to {
opacity: 0;
}
.fade-enter-active,
.fade-leave-active { transition: opacity 0.2s ease; }
.fade-leave-active {
transition: opacity 0.2s ease;
}
</style>