From 3369853c06c3825c38d3c643611b0d11939448bf Mon Sep 17 00:00:00 2001 From: spinline Date: Fri, 6 Feb 2026 00:33:52 +0300 Subject: [PATCH] fix: attempt push notification subscription when permission is default on iOS --- frontend/src/app.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend/src/app.rs b/frontend/src/app.rs index 6fbf6e7..1d5586b 100644 --- a/frontend/src/app.rs +++ b/frontend/src/app.rs @@ -37,17 +37,19 @@ pub fn App() -> impl IntoView { return; } - // Check if Notification API is available and permission is granted + // Check if Notification API is available let window = web_sys::window().expect("window should exist"); if let Ok(notification_class) = js_sys::Reflect::get(&window, &"Notification".into()) { if !notification_class.is_undefined() { if let Ok(permission) = js_sys::Reflect::get(¬ification_class, &"permission".into()) { if let Some(perm_str) = permission.as_string() { - if perm_str == "granted" { - log::info!("Notification permission granted, subscribing to push..."); + // Subscribe if permission is granted or default (not denied) + // The browser will show permission prompt if needed + if perm_str != "denied" { + log::info!("Subscribing to push notifications (permission: {})", perm_str); crate::store::subscribe_to_push_notifications().await; } else { - log::info!("Notification permission not granted yet: {}", perm_str); + log::info!("Notification permission denied"); } } }