Fixed PWA on iOS 27
This commit is contained in:
1 parent
1411cadcc9
commit
c7327cac1a
2 files changed
+35
-39
No files matched your search
@@ -10,41 +10,26 @@ import NotificationListener from "@/Components/FlightsGoneBy/NotificationListene
|
||||
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,
|
||||
@@ -113,7 +104,12 @@ main {
|
||||
}
|
||||
|
||||
.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>
|
||||
@@ -2,7 +2,7 @@
|
||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
<meta name="app-name" content="{{ config('app.name') }}">
|
||||
<title inertia>{{ config('app.name', 'Laravel') }}</title>
|
||||
|
||||
Reference in new issue
Block a user