Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DMAPP-115: Integrate foreground notification for channels #147

Merged
merged 6 commits into from
Dec 11, 2024

Conversation

meKushdeepSingh
Copy link
Collaborator

  • Display notification banner when the app is in the foreground state.
  • Handle data updates when the home screen is open in the foreground.
  • Implement notification banner press handling to navigate or update views as needed.
  • Fix iOS notification sound issue to ensure proper audio playback for notifications.

- Added app logo as notification icon on Android
- Display foreground notification for Channel module
- Begin handling notification events (WIP)
- Update inbox and spam feed data when a notification is received while the app is in the foreground and the home screen is open.
- Navigate to the appropriate tab and auto-select it when a notification banner is pressed.
- Added a function to root navigation to get current route params
- Updated getRecentMessageNotifications function to get already received notification data in mobile app
…d Android

- Display notification banner when the app is in the foreground state.
- Handle data updates when the home screen is open in the foreground.
- Implement notification banner press handling to navigate or update views as needed.
- Fix iOS notification sound issue to ensure proper audio playback for notifications.
@meKushdeepSingh meKushdeepSingh self-assigned this Dec 9, 2024
@meKushdeepSingh meKushdeepSingh linked an issue Dec 9, 2024 that may be closed by this pull request
@rohitmalhotra1420 rohitmalhotra1420 changed the title DMAPP-115: integrate foreground notification for channels DMAPP-115: i]ntegrate foreground notification for channels Dec 9, 2024
@rohitmalhotra1420 rohitmalhotra1420 changed the title DMAPP-115: i]ntegrate foreground notification for channels DMAPP-115: Integrate foreground notification for channels Dec 9, 2024
Comment on lines 94 to 121
await notifee.displayNotification({
id: remoteMessage.messageId,
title: remoteMessage.notification?.title,
body: remoteMessage.notification?.body,
ios: {
sound: 'default',
foregroundPresentationOptions: {
banner: true,
list: true,
badge: true,
sound: true,
},
},
android: {
channelId: 'default',
largeIcon,
smallIcon:
remoteMessage.notification?.android?.smallIcon ?? 'ic_notification',
color:
remoteMessage.notification?.android?.color ??
Globals.COLORS.IC_NOTIFICATION,
circularLargeIcon: true,
pressAction: {
id: 'default',
},
},
data: remoteMessage.data,
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

create a utility function which will accept remoteMessage and return the config

id: notification.messageId,
title: notification?.title,
body: notification?.body,
ios: {
sound: 'default',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same

type ReturnTypeHome = {home: HomeInitialState};

const initialState: HomeInitialState = {
channelInboxNotificationAcknowledgement: {
Copy link
Collaborator

Choose a reason for hiding this comment

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

we can remove channelInboxNotificationAcknowledgement

@rohitmalhotra1420 rohitmalhotra1420 self-requested a review December 9, 2024 11:58
Copy link
Collaborator

@rohitmalhotra1420 rohitmalhotra1420 left a comment

Choose a reason for hiding this comment

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

Minor fixes

- Added a utility function for displaying notifications using Notifee to streamline notification handling.
- Removed the `channelInboxNotificationAcknowledgement` object state from `homeSlice` to simplify state management
@rohitmalhotra1420 rohitmalhotra1420 merged commit 67a6250 into main Dec 11, 2024
1 check failed
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.

Integrate foreground notification for channels
2 participants