diff --git a/frontend/src/app.rs b/frontend/src/app.rs index ca6c952..7d5703a 100644 --- a/frontend/src/app.rs +++ b/frontend/src/app.rs @@ -37,7 +37,21 @@ pub fn App() -> impl IntoView { return; } - // Attempt to subscribe - this will request permission if needed + // Safari requires user gesture for notification permission + // Don't auto-request on Safari - user should click a button + if crate::utils::platform::is_safari() { + log::info!("Safari detected - notification permission requires user interaction. Please click notification settings."); + if let Some(store) = use_context::() { + crate::store::show_toast_with_signal( + store.notifications, + shared::NotificationLevel::Info, + "Bildirim izni için lütfen ayarlara gidin ve izin verin.".to_string(), + ); + } + return; + } + + // For non-Safari browsers (Chrome, Firefox, Edge), attempt auto-subscribe log::info!("Attempting to subscribe to push notifications..."); crate::store::subscribe_to_push_notifications().await; }); diff --git a/frontend/src/store.rs b/frontend/src/store.rs index 0480c6d..bf831a9 100644 --- a/frontend/src/store.rs +++ b/frontend/src/store.rs @@ -362,9 +362,14 @@ pub async fn subscribe_to_push_notifications() { } }; + log::info!("VAPID public key from backend: {} (len: {})", public_key, public_key.len()); + // Convert VAPID public key to Uint8Array let public_key_array = match url_base64_to_uint8array(public_key) { - Ok(arr) => arr, + Ok(arr) => { + log::info!("VAPID key converted to Uint8Array (length: {})", arr.length()); + arr + } Err(e) => { log::error!("Failed to convert VAPID key: {:?}", e); return;