Skip to content

Conversation

@sdisalvo-crd
Copy link
Contributor

@sdisalvo-crd sdisalvo-crd commented Oct 24, 2025

Pull Request: Add Push Notifications for Multi-Profile App

Description

After reviewing the push notification capabilities that Capacitor offers in this spike VT20-2077: Push notifications on the wallet, we will now move forward with implementing them in the app.

When users receive messages or updates for profiles they are not currently viewing, they will see a notification on their phone. This helps users stay connected without constantly checking the app.

Our app supports multiple profiles, like having separate accounts for work and personal use. Before this change, users would only see notifications inside the app when they were already using it. This meant they could miss important updates for other profiles. Push notifications solve this by alerting users even when the app is closed or in the background.

The system works like this:

  1. When a new message arrives for a profile, the app checks if that profile is currently active
  2. If the profile is not active, it creates a push notification with the profile name and message details
  3. The notification appears on the user's phone with a clear title and description
  4. When tapped, the notification opens the app and switches to the correct profile and notifications tab

Videos below will show:

  • Push notifications will only be displayed when the app is open (not in the background or when the app is closed).
  • The only push notifications you will receive are those from other profiles. If you receive a notification related to your current profile, it will only appear in the Notifications tab (not as a push notification).
  • The content of the notifications will match what is currently displayed in the app’s Notifications tab.
  • If the user doesn't tap on the push notification, this will be registered in the phone's notification center.
  • Tapping on a push notification belonging to profile B while you are currently on profile A at the exact time when you receive it will trigger the app to switch profile and open the Notifications tab.
  • Tapping on a previous notification listed on the phone's notification center will open the app directly on the Notifications tab of the profile associated with that notification (i.e. switch profile if needed and navigate to the Notifications tab).
  • Receiving, handling and grouping multiple push notifications, also for different profiles.

Checklist before requesting a review

Issue ticket number and link

  • This PR has a valid ticket number or issue: VT20-2085

Testing & Validation

  • This PR has been tested/validated in iOS, Android and browser.
  • Added new unit tests, if relevant.

Design Review

  • In case this PR contains changes to the UI, add some screenshots and/or videos to show the changes on relevant devices.

Permission request when you launch the app (we will add the possibility to turn it on and off from the Settings in another task)

iOS

iOS.mp4

Android

Android.mp4

@sdisalvo-crd sdisalvo-crd self-assigned this Oct 24, 2025
@sdisalvo-crd sdisalvo-crd changed the title Feat/vt20 2085 initial basic push notifications feat(ui): Initial basic push notifications Oct 24, 2025
@sdisalvo-crd sdisalvo-crd force-pushed the feat/VT20-2085-Initial-basic-push-notifications branch 2 times, most recently from 254c028 to 275df0f Compare October 24, 2025 13:25
@sdisalvo-crd sdisalvo-crd marked this pull request as ready for review October 28, 2025 15:45
@jimcase
Copy link
Contributor

jimcase commented Oct 30, 2025

We need to add this entry in the ios/App/App/Info.plist file

<key>NSUserNotificationsUsageDescription</key>
<string>We will send you notifications, alerts, and important updates.</string>

Apple requires a reason why the app needs to use notifications, sames as other protected resources like NSCameraUsageDescription.
And the place to put this reasons is Info.plist.
If not, it will work in xCode simulator but will not work in a real device(like testflight).

@sdisalvo-crd
Copy link
Contributor Author

sdisalvo-crd commented Oct 31, 2025

Things should be much simpler now @iFergal. Feel free to take a look when you have time. Next I will make some tests on how group notifications work.

(path: string, notificationId?: string) => {
window.history.pushState(null, "", path);
window.dispatchEvent(
new CustomEvent("notificationNavigation", {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I suggest we make notificationNavigation a constant somewhere

largeIcon: "res://drawable/notification_icon",
smallIcon: "res://drawable/notification_small",
iconColor: PRIMARY_COLOR,
channelId: "veridian-notifications",
Copy link
Collaborator

Choose a reason for hiding this comment

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

constant

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry, I actually meant that the channelId should be a constant somewhere. We can still keep them as separate objects like you have though.

async getActiveNotifications(): Promise<LocalNotification[]> {
const result = await LocalNotifications.getPending();
return result.notifications as LocalNotification[];
this.profileSwitcher(profileId as string);
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we still don't know if this is a string, we can change line 149 to if (!notification.extra || typeof notification.extra.profile !== "string")

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.

4 participants