export function isPWA() { const displayModeStandalone = window.matchMedia("(display-mode: standalone)").matches; const iosStandalone = (navigator as any).standalone === true; const result = displayModeStandalone || iosStandalone; return result; } export function isIOSDevice(): boolean { return /iphone|ipad|ipod/i.test(navigator.userAgent); } function hasWebPushAPIs() { return typeof navigator !== "undefined" && typeof window !== "undefined" && "serviceWorker" in navigator && "PushManager" in window && "Notification" in window; } export function supportsWebPush(): boolean { if (!hasWebPushAPIs()) return false; // iOS quirk: only allow push for installed web apps if (isIOSDevice() && !isPWA()) return false; return true; }