From 3cbffd5423eb63040a05f6d355249b532e915e0f Mon Sep 17 00:00:00 2001 From: alexspeaker Date: Fri, 6 Nov 2026 15:50:12 +0100 Subject: [PATCH] vers. 3.0.2 - iPhone: il guscio riempie davvero lo schermo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Su iOS 26 (app installata) la finestra riportata al sito è più corta dello schermo di circa 60 punti, anche se la WebView lo copre tutto: vh, dvh e position: fixed lasciavano una fascia vuota sotto la tab bar. Ora js/app.js misura lo schermo e imposta l'altezza del guscio (--shell-h) solo su iPhone in modalità installata e a schermo intero. Player, banner PWA, finestra istruzioni, avviso offline e barra di avanzamento sono figli del guscio con position: absolute, così seguono il guscio e non il viewport. Cache del service worker v8. Co-Authored-By: Claude Fable 5.1 --- css/style.css | 16 +++++++++------- data/changelog.xml | 8 ++++++++ js/app.js | 39 ++++++++++++++++++++++++++++++++++++++- pages/app.php | 3 ++- sw.js | 2 +- 5 files changed, 58 insertions(+), 10 deletions(-) diff --git a/css/style.css b/css/style.css index 093766f..0b2cee5 100644 --- a/css/style.css +++ b/css/style.css @@ -245,11 +245,13 @@ button { /* Ancorato ai bordi dello schermo: su iOS (app installata, barra di stato trasparente) le altezze in vh/dvh possono risultare più corte dello schermo e lasciare una fascia vuota sotto la tab bar */ +/* Tutto ciò che è "fisso" (player, banner, overlay, barra di avanzamento) è figlio del guscio con position: absolute: + segue il guscio, non il viewport. Su iPhone (app installata) iOS 26 riporta un viewport più corto dello schermo: + js/app.js misura lo schermo e imposta --shell-h, che qui ha la precedenza su bottom: 0. */ .app-shell { position: fixed; inset: 0; - /* Nessuna altezza esplicita: con top e bottom impostati un'altezza avrebbe la precedenza su bottom - e riporterebbe il valore sbagliato di iOS */ + height: var(--shell-h, auto); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-areas: "top" "main" "tab"; @@ -474,7 +476,7 @@ button { /* Barra di avanzamento durante il cambio pagina */ .route-progress { - position: fixed; + position: absolute; top: 0; left: 0; height: 3px; @@ -1704,7 +1706,7 @@ iframe.contentplayer { /* Barra a tutta larghezza, agganciata in basso: sopra la tab bar su telefono, accanto alla sidebar su computer */ .player-dock { - position: fixed; + position: absolute; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-bottom)); @@ -2101,7 +2103,7 @@ iframe.contentplayer { } .pwa-install-banner { - position: fixed; + position: absolute; left: 8px; right: 8px; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 8px); @@ -2166,7 +2168,7 @@ body.has-player .pwa-install-banner { } .pwa-modal-overlay { - position: fixed; + position: absolute; inset: 0; z-index: 110000; display: flex; @@ -2291,7 +2293,7 @@ body.has-player .pwa-install-banner { /* Offline */ .offline-overlay { - position: fixed; + position: absolute; inset: 0; z-index: 999999; display: flex; diff --git a/data/changelog.xml b/data/changelog.xml index 2d512f6..a101ffd 100644 --- a/data/changelog.xml +++ b/data/changelog.xml @@ -2,6 +2,14 @@ + + 3.0.2 + + iPhone (app installata): su iOS 26 la finestra riportata al sito è più corta dello schermo e sotto la barra delle sezioni restava una fascia vuota. Ora l'app misura lo schermo e si adatta da sola; player, banner e avvisi seguono il guscio dell'app. + + + + 3.0.1 diff --git a/js/app.js b/js/app.js index ada4179..606a4c0 100644 --- a/js/app.js +++ b/js/app.js @@ -758,7 +758,7 @@ ''; - body.appendChild(overlay); + (document.getElementById('app') || body).appendChild(overlay); var btn = $('#offlineRetryBtn'); btn.addEventListener('click', function () { @@ -814,8 +814,45 @@ return true; } + /** + * iPhone, app installata: iOS 26 riporta una finestra più corta dello schermo (di circa l'altezza della barra + * di Safari) anche se la WebView copre tutto lo schermo. vh, dvh e position: fixed seguono quel valore e sotto + * la tab bar resta una fascia vuota. Qui si misura lo schermo e si dà al guscio la sua altezza vera (--shell-h). + */ + var Schermo = { + iphone: /iPhone|iPod/.test(navigator.userAgent), + standalone: function () { + return navigator.standalone === true || (window.matchMedia && window.matchMedia('(display-mode: standalone)').matches); + }, + adatta: function () { + var root = document.documentElement; + if (!this.iphone || !this.standalone()) { root.style.removeProperty('--shell-h'); return; } + var portrait = window.innerHeight >= window.innerWidth; + var screenH = portrait ? Math.max(screen.width, screen.height) : Math.min(screen.width, screen.height); + var screenW = portrait ? Math.min(screen.width, screen.height) : Math.max(screen.width, screen.height); + var h = window.innerHeight; + var differenza = screenH - h; + // Solo a schermo intero e per uno scarto "da barra" (fino a 140 pt): altrimenti si lascia fare al CSS + if (window.innerWidth === screenW && differenza > 2 && differenza <= 140) { + root.style.setProperty('--shell-h', screenH + 'px'); + } else { + root.style.removeProperty('--shell-h'); + } + }, + init: function () { + var self = this; + var aggiorna = function () { self.adatta(); }; + aggiorna(); + window.addEventListener('resize', aggiorna); + window.addEventListener('orientationchange', function () { setTimeout(aggiorna, 300); }); + window.addEventListener('pageshow', aggiorna); + if (window.visualViewport) window.visualViewport.addEventListener('resize', aggiorna); + } + }; + function init() { if (!content || gusciVecchio()) return; + Schermo.init(); Offline.init(); Player.init(); Podcast.init(); diff --git a/pages/app.php b/pages/app.php index e026398..fac5da5 100644 --- a/pages/app.php +++ b/pages/app.php @@ -120,7 +120,6 @@ $legal = rpi_legal_links(); - + + diff --git a/sw.js b/sw.js index ca0c3a2..81f598a 100644 --- a/sw.js +++ b/sw.js @@ -1,4 +1,4 @@ -const CACHE_NAME = 'rpigroupplay-v7'; +const CACHE_NAME = 'rpigroupplay-v8'; const ASSETS = [ './', './index.php',