From 417331837923ba56d77318632462ef670693c6a0 Mon Sep 17 00:00:00 2001 From: Chris Bianca Date: Thu, 22 Mar 2018 14:56:15 +0000 Subject: [PATCH] [links] Tweak links event name --- ios/RNFirebase/RNFirebaseEvents.h | 8 ++++---- ios/RNFirebase/links/RNFirebaseLinks.m | 20 +++++++++----------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/ios/RNFirebase/RNFirebaseEvents.h b/ios/RNFirebase/RNFirebaseEvents.h index 82564b28..ef8b7c79 100644 --- a/ios/RNFirebase/RNFirebaseEvents.h +++ b/ios/RNFirebase/RNFirebaseEvents.h @@ -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_TOKEN_REFRESHED = @"messaging_token_refreshed"; -// TODO: Remove -static NSString *const MESSAGING_NOTIFICATION_RECEIVED = @"messaging_notification_received"; - // Notifications static NSString *const NOTIFICATIONS_NOTIFICATION_DISPLAYED = @"notifications_notification_displayed"; 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"; // 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 diff --git a/ios/RNFirebase/links/RNFirebaseLinks.m b/ios/RNFirebase/links/RNFirebaseLinks.m index 067b6169..0251e8d6 100644 --- a/ios/RNFirebase/links/RNFirebaseLinks.m +++ b/ios/RNFirebase/links/RNFirebaseLinks.m @@ -7,7 +7,7 @@ static void sendDynamicLink(NSURL *url, id sender) { if (url) { - [[NSNotificationCenter defaultCenter] postNotificationName:LINKS_DYNAMIC_LINK_RECEIVED + [[NSNotificationCenter defaultCenter] postNotificationName:LINKS_LINK_RECEIVED object:sender userInfo:@{@"url": url.absoluteString}]; NSLog(@"sendDynamicLink Success: %@", url.absoluteString); @@ -31,7 +31,7 @@ RCT_EXPORT_MODULE(); // Set up internal listener to send notification over bridge [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sendDynamicLinkEvent:) - name:LINKS_DYNAMIC_LINK_RECEIVED + name:LINKS_LINK_RECEIVED object:nil]; } @@ -83,11 +83,11 @@ continueUserActivity:(NSUserActivity *)userActivity } - (NSArray *)supportedEvents { - return @[LINKS_DYNAMIC_LINK_RECEIVED]; + return @[LINKS_LINK_RECEIVED]; } - (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 { @@ -126,7 +126,7 @@ RCT_EXPORT_METHOD(getInitialLink:(RCTPromiseResolveBlock)resolve rejecter:(RCTPr if (self.bridge.launchOptions[UIApplicationLaunchOptionsURLKey]) { NSURL* url = (NSURL*)self.bridge.launchOptions[UIApplicationLaunchOptionsURLKey]; [self handleInitialLinkFromCustomSchemeURL:url resolver:resolve rejecter:reject]; - + } else { NSDictionary *userActivityDictionary = self.bridge.launchOptions[UIApplicationLaunchOptionsUserActivityDictionaryKey]; @@ -137,7 +137,7 @@ RCT_EXPORT_METHOD(getInitialLink:(RCTPromiseResolveBlock)resolve rejecter:(RCTPr RCT_EXPORT_METHOD(createDynamicLink: (NSDictionary *) metadata resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) { @try { FIRDynamicLinkComponents *components = [self getDynamicLinkComponentsFromMetadata:metadata]; - + if (components == nil) { reject(@"links/failure", @"Failed to create Dynamic Link", nil); } else { @@ -181,11 +181,11 @@ RCT_EXPORT_METHOD(createShortDynamicLink: (NSDictionary *) metadata resolver:(RC NSURL *link = [NSURL URLWithString:metadata[@"link"]]; FIRDynamicLinkComponents *components = [FIRDynamicLinkComponents componentsWithLink:link domain:metadata[@"dynamicLinkDomain"]]; - + [self setAndroidParameters:metadata components:components]; [self setIosParameters:metadata components:components]; [self setSocialMetaTagParameters:metadata components:components]; - + return components; } @catch(NSException * e) { @@ -200,7 +200,7 @@ RCT_EXPORT_METHOD(createShortDynamicLink: (NSDictionary *) metadata resolver:(RC if (androidParametersDict) { FIRDynamicLinkAndroidParameters *androidParams = [FIRDynamicLinkAndroidParameters parametersWithPackageName: androidParametersDict[@"androidPackageName"]]; - + if (androidParametersDict[@"androidFallbackLink"]) { androidParams.fallbackURL = [NSURL URLWithString:androidParametersDict[@"androidFallbackLink"]]; } @@ -283,5 +283,3 @@ RCT_EXPORT_METHOD(createShortDynamicLink: (NSDictionary *) metadata resolver:(RC @implementation RNFirebaseLinks @end #endif - -