98b83a5f75
Allow any orientation in manifest, widen content and enable dual-column mode in installed apps on tablet viewports, with iOS display-mode fallback. Co-authored-by: Cursor <cursoragent@cursor.com>
20 lines
514 B
TypeScript
20 lines
514 B
TypeScript
"use client";
|
|
|
|
import { useEffect } from "react";
|
|
|
|
/** iOS / iPad PWA 部分版本不识别 display-mode 媒体查询,用 data 属性兜底 */
|
|
export default function PwaDisplayMode() {
|
|
useEffect(() => {
|
|
const standalone =
|
|
window.matchMedia("(display-mode: standalone)").matches ||
|
|
(window.navigator as Navigator & { standalone?: boolean }).standalone ===
|
|
true;
|
|
|
|
if (standalone) {
|
|
document.documentElement.dataset.displayMode = "standalone";
|
|
}
|
|
}, []);
|
|
|
|
return null;
|
|
}
|