[links] Tweak links event name

This commit is contained in:
Chris Bianca 2018-03-22 14:56:15 +00:00
parent 2891027f25
commit 4173318379
2 changed files with 13 additions and 15 deletions

View File

@ -36,9 +36,6 @@ static NSString *const STORAGE_DOWNLOAD_FAILURE = @"download_failure";
static NSString *const MESSAGING_MESSAGE_RECEIVED = @"messaging_message_received"; static NSString *const MESSAGING_MESSAGE_RECEIVED = @"messaging_message_received";
static NSString *const MESSAGING_TOKEN_REFRESHED = @"messaging_token_refreshed"; static NSString *const MESSAGING_TOKEN_REFRESHED = @"messaging_token_refreshed";
// TODO: Remove
static NSString *const MESSAGING_NOTIFICATION_RECEIVED = @"messaging_notification_received";
// Notifications // Notifications
static NSString *const NOTIFICATIONS_NOTIFICATION_DISPLAYED = @"notifications_notification_displayed"; static NSString *const NOTIFICATIONS_NOTIFICATION_DISPLAYED = @"notifications_notification_displayed";
static NSString *const NOTIFICATIONS_NOTIFICATION_OPENED = @"notifications_notification_opened"; static NSString *const NOTIFICATIONS_NOTIFICATION_OPENED = @"notifications_notification_opened";
@ -49,6 +46,9 @@ static NSString *const ADMOB_INTERSTITIAL_EVENT = @"interstitial_event";
static NSString *const ADMOB_REWARDED_VIDEO_EVENT = @"rewarded_video_event"; static NSString *const ADMOB_REWARDED_VIDEO_EVENT = @"rewarded_video_event";
// Links // Links
static NSString *const LINKS_DYNAMIC_LINK_RECEIVED = @"links_link_received"; static NSString *const LINKS_LINK_RECEIVED = @"links_link_received";
// Invites
static NSString *const INVITES_INVITATION_RECEIVED = @"invites_invitation_received";
#endif #endif

View File

@ -7,7 +7,7 @@
static void sendDynamicLink(NSURL *url, id sender) { static void sendDynamicLink(NSURL *url, id sender) {
if (url) { if (url) {
[[NSNotificationCenter defaultCenter] postNotificationName:LINKS_DYNAMIC_LINK_RECEIVED [[NSNotificationCenter defaultCenter] postNotificationName:LINKS_LINK_RECEIVED
object:sender object:sender
userInfo:@{@"url": url.absoluteString}]; userInfo:@{@"url": url.absoluteString}];
NSLog(@"sendDynamicLink Success: %@", url.absoluteString); NSLog(@"sendDynamicLink Success: %@", url.absoluteString);
@ -31,7 +31,7 @@ RCT_EXPORT_MODULE();
// Set up internal listener to send notification over bridge // Set up internal listener to send notification over bridge
[[NSNotificationCenter defaultCenter] addObserver:self [[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(sendDynamicLinkEvent:) selector:@selector(sendDynamicLinkEvent:)
name:LINKS_DYNAMIC_LINK_RECEIVED name:LINKS_LINK_RECEIVED
object:nil]; object:nil];
} }
@ -83,11 +83,11 @@ continueUserActivity:(NSUserActivity *)userActivity
} }
- (NSArray<NSString *> *)supportedEvents { - (NSArray<NSString *> *)supportedEvents {
return @[LINKS_DYNAMIC_LINK_RECEIVED]; return @[LINKS_LINK_RECEIVED];
} }
- (void)sendDynamicLinkEvent:(NSNotification *)notification { - (void)sendDynamicLinkEvent:(NSNotification *)notification {
[self sendEventWithName:LINKS_DYNAMIC_LINK_RECEIVED body:notification.userInfo[@"url"]]; [self sendEventWithName:LINKS_LINK_RECEIVED body:notification.userInfo[@"url"]];
} }
-(void)handleInitialLinkFromCustomSchemeURL:(NSURL*)url resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject { -(void)handleInitialLinkFromCustomSchemeURL:(NSURL*)url resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject {
@ -283,5 +283,3 @@ RCT_EXPORT_METHOD(createShortDynamicLink: (NSDictionary *) metadata resolver:(RC
@implementation RNFirebaseLinks @implementation RNFirebaseLinks
@end @end
#endif #endif