iOS PWA and IT Job Checklist for IT Staff view

This commit is contained in:
2026-04-11 07:40:12 +08:00
parent 5cb6561924
commit f223d1f958
18 changed files with 389 additions and 109 deletions
+27
View File
@@ -0,0 +1,27 @@
import 'dart:js_interop';
@JS('navigator.userAgent')
external String get _navigatorUserAgent;
@JS('window.matchMedia')
external _MediaQueryList _matchMedia(String query);
extension type _MediaQueryList._(JSObject _) implements JSObject {
external bool get matches;
}
/// Returns true when the user is on iOS Safari and the app has NOT been added
/// to the Home Screen (i.e., not running in standalone mode).
///
/// When this returns true, we show the "Add to Home Screen" install banner so
/// that users can unlock iOS 16.4+ web push notifications.
bool detectIosSafariNotInstalled() {
final ua = _navigatorUserAgent.toLowerCase();
final isIos =
ua.contains('iphone') || ua.contains('ipad') || ua.contains('ipod');
if (!isIos) return false;
// The PWA is "installed" if the display-mode: standalone media query matches.
final isStandalone = _matchMedia('(display-mode: standalone)').matches;
return !isStandalone;
}