Conversation
Co-authored-by: alebiosuf0802 <alebiosuf0802@students.bowiestate.edu>
Co-authored-by: alebiosuf0802 <alebiosuf0802@students.bowiestate.edu>
|
Cursor Agent can help with this pull request. Just |
|
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed. WalkthroughThis PR integrates OS-level push notification permission handling into the existing notification system. When enabling push notifications, the system now checks device support, requests OS permissions, and initializes notification settings based on permission outcomes. The Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant CaptureLayout
participant usePushNotifications
participant Device/OS
participant PushNotificationService
participant SettingsStorage
User->>CaptureLayout: Load app
CaptureLayout->>usePushNotifications: Call with profile?.id
usePushNotifications->>Device/OS: Request notification permission
Device/OS-->>usePushNotifications: Permission status (granted/denied)
usePushNotifications->>usePushNotifications: Update permissionStatus state
alt userId available and permission checked
usePushNotifications->>PushNotificationService: initializeNotificationSettingsFromPermission(userId, isGranted)
PushNotificationService->>SettingsStorage: Check existing settings
alt Settings don't exist
alt Permission granted
PushNotificationService->>SettingsStorage: Save ALL_NOTIFICATIONS_ON
else Permission denied
PushNotificationService->>SettingsStorage: Save ALL_NOTIFICATIONS_OFF
end
PushNotificationService-->>usePushNotifications: true (first-time init)
else Settings exist
PushNotificationService-->>usePushNotifications: false (already initialized)
end
end
usePushNotifications-->>CaptureLayout: Push notifications configured
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Creates an initial notification settings record in the database based on OS permission outcome and enforces permission checks when re-enabling push notifications to fulfill DEF-89.
The issue required saving default notification preferences (all true for granted, all false for denied) upon the first permission request. It also mandated that the "Push Notifications" toggle re-check or request OS permission before allowing the user to turn it back on, ensuring consistency between app settings and OS permissions. A refinement was made to prevent overwriting existing user preferences if the settings row already existed when the push notification toggle was re-enabled.
Linear Issue: DEF-89
Summary by CodeRabbit
Bug Fixes
Improvements
✏️ Tip: You can customize this high-level summary in your review settings.