Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/ios/WEGWebEngageBridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

NSString * const DATE_FORMAT = @"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
int const DATE_FORMAT_LENGTH = 24;
bool hasListeners = NO;
bool hasListenersBool = NO;

@implementation WEGWebEngageBridge

Expand Down Expand Up @@ -252,7 +252,7 @@ - (void)notificationShown:(NSMutableDictionary *)inAppNotificationData {
-(void)WEGHandleDeeplink:(NSString *)deeplink userData:(NSDictionary *)data{
RCTLogInfo(@"webengageBridge: push notification clicked with deeplink: %@", deeplink);
NSDictionary *pushData = @{@"deeplink":deeplink, @"userData":data};
if (hasListeners) {
if (hasListenersBool) {
[self sendEventWithName:@"pushNotificationClicked" body:pushData];
} else {
if (self.pendingEventsDict == nil) {
Expand All @@ -267,7 +267,7 @@ -(void)WEGHandleDeeplink:(NSString *)deeplink userData:(NSDictionary *)data{
- (void)sendUniversalLinkLocation:(NSString *)location{
RCTLogInfo(@"webengageBridge: universal link clicked with location: %@", location);
NSDictionary *data = @{@"location":location};
if (hasListeners) {
if (hasListenersBool) {
[self sendEventWithName:@"universalLinkClicked" body:data];
} else {
if (self.pendingEventsDict == nil) {
Expand All @@ -281,7 +281,7 @@ - (void)sendUniversalLinkLocation:(NSString *)location{

// Will be called when this module's first listener is added.
- (void) startObserving {
hasListeners = YES;
hasListenersBool = YES;
if (self.pendingEventsDict != nil) {
for (id key in self.pendingEventsDict) {
[self sendEventWithName:key body:self.pendingEventsDict[key]];
Expand All @@ -291,6 +291,6 @@ - (void) startObserving {
}

- (void)stopObserving {
hasListeners = NO;
hasListenersBool = NO;
}
@end