11import EJSON from 'ejson' ;
22import { Platform } from 'react-native' ;
3+ import AsyncStorage from '@react-native-async-storage/async-storage' ;
34
45import { appInit } from '../../actions/app' ;
56import { deepLinkingClickCallPush , deepLinkingOpen } from '../../actions/deepLinking' ;
@@ -16,14 +17,22 @@ 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 lastId = await AsyncStorage . getItem ( 'lastProcessedVideoConfNotificationId' ) ;
29+ const currentId = push . identifier || push . payload ?. notId ;
30+ if ( currentId && lastId === currentId ) {
31+ return ;
32+ }
33+ if ( currentId ) {
34+ await AsyncStorage . setItem ( 'lastProcessedVideoConfNotificationId' , currentId ) ;
35+ }
2736 store . dispatch (
2837 deepLinkingClickCallPush ( { ...notification , event : identifier === 'ACCEPT_ACTION' ? 'accept' : 'decline' } )
2938 ) ;
@@ -40,6 +49,14 @@ export const onNotification = (push: INotification): void => {
4049
4150 // Handle video conf notification tap (default action) - treat as accept
4251 if ( notification ?. notificationType === 'videoconf' ) {
52+ const lastId = await AsyncStorage . getItem ( 'lastProcessedVideoConfNotificationId' ) ;
53+ const currentId = push . identifier || push . payload ?. notId ;
54+ if ( currentId && lastId === currentId ) {
55+ return ;
56+ }
57+ if ( currentId ) {
58+ await AsyncStorage . setItem ( 'lastProcessedVideoConfNotificationId' , currentId ) ;
59+ }
4360 store . dispatch ( deepLinkingClickCallPush ( { ...notification , event : 'accept' } ) ) ;
4461 return ;
4562 }
0 commit comments