@@ -252,7 +252,16 @@ - (void)notificationShown:(NSMutableDictionary *)inAppNotificationData {
252252-(void )WEGHandleDeeplink : (NSString *)deeplink userData : (NSDictionary *)data {
253253 RCTLogInfo (@" webengageBridge: push notification clicked with deeplink: %@ " , deeplink);
254254 NSDictionary *pushData = @{@" deeplink" :deeplink, @" userData" :data};
255- [self sendEventWithName: @" pushNotificationClicked" body: pushData];
255+ if (hasListeners) {
256+ [self sendEventWithName: @" pushNotificationClicked" body: pushData];
257+ } else {
258+ if (self.pendingEventsDict == nil ) {
259+ self.pendingEventsDict = [NSMutableDictionary dictionary ];
260+ self.pendingEventsDict [@" pushNotificationClicked" ] = pushData;
261+ } else {
262+ self.pendingEventsDict [@" pushNotificationClicked" ] = pushData;
263+ }
264+ }
256265}
257266
258267- (void )sendUniversalLinkLocation : (NSString *)location {
@@ -264,6 +273,8 @@ - (void)sendUniversalLinkLocation:(NSString *)location{
264273 if (self.pendingEventsDict == nil ) {
265274 self.pendingEventsDict = [NSMutableDictionary dictionary ];
266275 self.pendingEventsDict [@" universalLinkClicked" ] = data;
276+ } else {
277+ self.pendingEventsDict [@" universalLinkClicked" ] = data;
267278 }
268279 }
269280}
@@ -274,6 +285,7 @@ - (void) startObserving {
274285 if (self.pendingEventsDict != nil ) {
275286 for (id key in self.pendingEventsDict ) {
276287 [self sendEventWithName: key body: self .pendingEventsDict[key]];
288+ [self .pendingEventsDict removeObjectForKey: key];
277289 }
278290 }
279291}
0 commit comments