11import EJSON from 'ejson' ;
22import { Platform } from 'react-native' ;
33
4+ import { isPushVideoConfAlreadyProcessed } from './videoConf/deduplication' ;
45import { appInit } from '../../actions/app' ;
56import { deepLinkingClickCallPush , deepLinkingOpen } from '../../actions/deepLinking' ;
67import { type INotification , SubscriptionType } from '../../definitions' ;
@@ -16,14 +17,18 @@ interface IEjson {
1617 messageId : string ;
1718}
1819
19- export const onNotification = ( push : INotification ) : void => {
20+ export const onNotification = async ( push : INotification ) : Promise < void > => {
2021 const identifier = String ( push ?. payload ?. action ?. identifier ) ;
2122
2223 // Handle video conf notification actions (Accept/Decline buttons)
2324 if ( identifier === 'ACCEPT_ACTION' || identifier === 'DECLINE_ACTION' ) {
2425 if ( push ?. payload ?. ejson ) {
2526 try {
2627 const notification = EJSON . parse ( push . payload . ejson ) ;
28+ const currentId = push . identifier || push . payload ?. notId ;
29+ if ( await isPushVideoConfAlreadyProcessed ( currentId ) ) {
30+ return ;
31+ }
2732 store . dispatch (
2833 deepLinkingClickCallPush ( { ...notification , event : identifier === 'ACCEPT_ACTION' ? 'accept' : 'decline' } )
2934 ) ;
@@ -40,6 +45,10 @@ export const onNotification = (push: INotification): void => {
4045
4146 // Handle video conf notification tap (default action) - treat as accept
4247 if ( notification ?. notificationType === 'videoconf' ) {
48+ const currentId = push . identifier || push . payload ?. notId ;
49+ if ( await isPushVideoConfAlreadyProcessed ( currentId ) ) {
50+ return ;
51+ }
4352 store . dispatch ( deepLinkingClickCallPush ( { ...notification , event : 'accept' } ) ) ;
4453 return ;
4554 }
@@ -122,7 +131,10 @@ export const checkPendingNotification = async (): Promise<void> => {
122131 } ,
123132 identifier : notificationData . notId || ''
124133 } ;
125- onNotification ( notification ) ;
134+ const result = onNotification ( notification ) ;
135+ if ( result ?. catch ) {
136+ result . catch ( e => console . warn ( '[notifications/index.ts] onNotification error:' , e ) ) ;
137+ }
126138 } catch ( e ) {
127139 console . warn ( '[notifications/index.ts] Failed to parse pending notification:' , e ) ;
128140 }
0 commit comments