From 485333abcc8519bc1bd87f4b49282297b584b0ee Mon Sep 17 00:00:00 2001 From: Libin Lu Date: Sun, 29 Jan 2017 17:13:35 -0500 Subject: [PATCH] update method type --- ios/RNFIRMessaging.h | 10 +++++++--- ios/RNFIRMesssaging.m | 10 +++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ios/RNFIRMessaging.h b/ios/RNFIRMessaging.h index 80f03c8..0a07e04 100644 --- a/ios/RNFIRMessaging.h +++ b/ios/RNFIRMessaging.h @@ -9,13 +9,17 @@ @interface RNFIRMessaging : NSObject +typedef void (^RCTRemoteNotificationCallback)(UIBackgroundFetchResult result); +typedef void (^RCTWillPresentNotificationCallback)(UNNotificationPresentationOptions result); +typedef void (^RCTNotificationResponseCallback)(); + @property (nonatomic, assign) bool connectedToFCM; #if !TARGET_OS_TV -+ (void)didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler; ++ (void)didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo fetchCompletionHandler:(nonnull RCTRemoteNotificationCallback)completionHandler; + (void)didReceiveLocalNotification:(nonnull UILocalNotification *)notification; -+ (void)didReceiveNotificationResponse:(nonnull UNNotificationResponse *)response withCompletionHandler:(nonnull void (^)())completionHandler; -+ (void)willPresentNotification:(nonnull UNNotification *)notification withCompletionHandler:(nonnull void (^)(UNNotificationPresentationOptions))completionHandler; ++ (void)didReceiveNotificationResponse:(nonnull UNNotificationResponse *)response withCompletionHandler:(nonnull RCTNotificationResponseCallback)completionHandler; ++ (void)willPresentNotification:(nonnull UNNotification *)notification withCompletionHandler:(nonnull RCTWillPresentNotificationCallback)completionHandler; #endif @end diff --git a/ios/RNFIRMesssaging.m b/ios/RNFIRMesssaging.m index cf5b9d2..4cd92c7 100644 --- a/ios/RNFIRMesssaging.m +++ b/ios/RNFIRMesssaging.m @@ -18,10 +18,6 @@ #endif -typedef void (^RCTRemoteNotificationCallback)(UIBackgroundFetchResult result); -typedef void (^RCTWillPresentNotificationCallback)(UNNotificationPresentationOptions result); -typedef void (^RCTNotificationResponseCallback)(); - NSString *const FCMNotificationReceived = @"FCMNotificationReceived"; @implementation RCTConvert (NSCalendarUnit) @@ -142,7 +138,7 @@ RCT_EXPORT_MODULE() @synthesize bridge = _bridge; -+ (void)didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo fetchCompletionHandler:(RCTRemoteNotificationCallback)completionHandler { ++ (void)didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo fetchCompletionHandler:(nonnull RCTRemoteNotificationCallback)completionHandler { NSMutableDictionary* data = [[NSMutableDictionary alloc] initWithDictionary: userInfo]; [data setValue:@"remote_notification" forKey:@"_notificationType"]; [data setValue:@(RCTSharedApplication().applicationState == UIApplicationStateInactive) forKey:@"opened_from_tray"]; @@ -155,7 +151,7 @@ RCT_EXPORT_MODULE() [[NSNotificationCenter defaultCenter] postNotificationName:FCMNotificationReceived object:self userInfo:data]; } -+ (void)didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(RCTNotificationResponseCallback)completionHandler ++ (void)didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(nonnull RCTNotificationResponseCallback)completionHandler { NSMutableDictionary* data = [[NSMutableDictionary alloc] initWithDictionary: response.notification.request.content.userInfo]; [data setValue:@"notification_response" forKey:@"_notificationType"]; @@ -163,7 +159,7 @@ RCT_EXPORT_MODULE() [[NSNotificationCenter defaultCenter] postNotificationName:FCMNotificationReceived object:self userInfo:@{@"data": data, @"completionHandler": completionHandler}]; } -+ (void)willPresentNotification:(UNNotification *)notification withCompletionHandler:(RCTWillPresentNotificationCallback)completionHandler ++ (void)willPresentNotification:(UNNotification *)notification withCompletionHandler:(nonnull RCTWillPresentNotificationCallback)completionHandler { NSMutableDictionary* data = [[NSMutableDictionary alloc] initWithDictionary: notification.request.content.userInfo]; [data setValue:@"will_present_notification" forKey:@"_notificationType"]; -- 2.26.2