-
Notifications
You must be signed in to change notification settings - Fork 14
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
Conversation
meKushdeepSingh
commented
Dec 9, 2024
- 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.
src/helpers/NotificationHelper.ts
Outdated
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, | ||
}); |
There was a problem hiding this comment.
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
src/helpers/NotificationHelper.ts
Outdated
id: notification.messageId, | ||
title: notification?.title, | ||
body: notification?.body, | ||
ios: { | ||
sound: 'default', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
src/redux/homeSlice.ts
Outdated
type ReturnTypeHome = {home: HomeInitialState}; | ||
|
||
const initialState: HomeInitialState = { | ||
channelInboxNotificationAcknowledgement: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can remove channelInboxNotificationAcknowledgement
There was a problem hiding this 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