Skip to content

Handle user actions on notifications#5297

Open
dgboss wants to merge 9 commits intomainfrom
task/handle-notification-action/5185
Open

Handle user actions on notifications#5297
dgboss wants to merge 9 commits intomainfrom
task/handle-notification-action/5185

Conversation

@dgboss
Copy link
Copy Markdown
Collaborator

@dgboss dgboss commented Apr 13, 2026

  • adds a data package to push notifications on the back-end
  • front-end receives this package in a push notification and sets state based on the content
  • adds status bar icon for notifications on Android
  • adds @capacitor/local-notifications to handle notifications when app is in the foreground on Android
  • fixes inconsistent styling on SideNavigationListItem component

Closes: #5185

Testing

  1. Edit dataSliceUtils.ts and set today = 2025-07-02 or to something in the past with advisory/warning data
  2. Build and install the app
  3. Create a test push notification in the FCM console/dashboard with a data package of:
    {advisory_date: 2025-07-02, fire_centre_id: 1, fire_zone_unit: 5 }
  4. Test scenarios:
    a. Send the notification when the app is in the foreground
    b. Send the notification when the app is in the background
    c. Send the notification when the app is not running
  5. In all cases you should be taken to the Advisories tab with K5 selected.
  6. Try changing the advisory_date in the data package to something other than the today date in dataSliceUtils. The push notification should be received, but opening the notification should not bring you to the advisory tab (unless you're there already) or set the fire centre or fire zone unit.

Test Links:

Landing Page
MoreCast
Percentile Calculator
C-Haines
FireCalc
FireCalc bookmark
Auto Spatial Advisory (ASA)
HFI Calculator
SFMS Insights
Fire Watch
Weather Toolkit

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 13, 2026

Codecov Report

❌ Patch coverage is 90.90909% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.30%. Comparing base (94a8d85) to head (9929df7).

Files with missing lines Patch % Lines
mobile/asa-go/src/hooks/usePushNotifications.ts 83.33% 0 Missing and 2 partials ⚠️
mobile/asa-go/src/App.tsx 96.00% 0 Missing and 1 partial ⚠️
mobile/asa-go/src/slices/pushNotificationSlice.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5297      +/-   ##
============================================
+ Coverage     67.78%   68.30%   +0.52%     
- Complexity        0       26      +26     
============================================
  Files           358      451      +93     
  Lines         15615    17865    +2250     
  Branches       1739     2118     +379     
============================================
+ Hits          10584    12202    +1618     
- Misses         4501     5045     +544     
- Partials        530      618      +88     
Flag Coverage Δ
android 24.68% <ø> (?)
asa_go 79.59% <90.24%> (?)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dgboss dgboss changed the title Handle NotificationActionPerformedEvent Handle user actions on notifications Apr 14, 2026
@sonarqubecloud
Copy link
Copy Markdown

@dgboss dgboss requested review from brettedw and conbrad April 14, 2026 20:57
const notificationDateKey = advisoryDate.toISODate();
const todayKey = today.toISODate();

// Only process notifications whose date matches today
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once we have some sort of in app status/warning UI we should consider popping a message if someone tries to open a stale notification. For now the app will just open up.

Copy link
Copy Markdown
Collaborator

@conbrad conbrad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, is local notifications only required for Android? Also do we need to hook up the new icons for iOS?

@dgboss
Copy link
Copy Markdown
Collaborator Author

dgboss commented Apr 14, 2026

Looks good, is local notifications only required for Android? Also do we need to hook up the new icons for iOS?

Local Notifications are only for Android, iOS always shows push notifications, even if the app is running in the foreground.

The icon is only necessary for Android from what I can tell. I don't think iOS ever displays a notification icon in its status bar.

Copy link
Copy Markdown
Collaborator

@brettedw brettedw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, works great!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ASA Go: Notification Deep Linking

3 participants