feat: Add iOS push notification support (iOS 16.4+)

- Platform detection utilities (is_ios, is_standalone, supports_push)
- iOS-specific meta tags and Apple touch icons
- Auto-detect iOS and show user-friendly message when not in standalone mode
- Enhanced Service Worker with iOS-compatible notification options
- Comprehensive iOS push notification documentation
- manifest.json scope for PWA compliance
- Only works when added to Home Screen (iOS Safari limitation)
This commit is contained in:
spinline
2026-02-05 23:57:08 +03:00
parent 373da566be
commit bffc72391a
7 changed files with 217 additions and 0 deletions

View File

@@ -16,6 +16,27 @@ pub fn App() -> impl IntoView {
// Wait a bit for service worker to be ready
gloo_timers::future::TimeoutFuture::new(2000).await;
// Check if running on iOS and not standalone
if let Some(ios_message) = crate::utils::platform::get_ios_notification_info() {
tracing::warn!("iOS detected: {}", ios_message);
// Show toast to inform user
if let Some(store) = use_context::<crate::store::TorrentStore>() {
crate::store::show_toast_with_signal(
store.notifications,
shared::NotificationLevel::Info,
ios_message,
);
}
return;
}
// Check if push notifications are supported
if !crate::utils::platform::supports_push_notifications() {
tracing::warn!("Push notifications not supported on this platform");
return;
}
// Check if Notification API is available and permission is granted
let window = web_sys::window().expect("window should exist");
if let Ok(notification_class) = js_sys::Reflect::get(&window, &"Notification".into()) {