diff --git a/ios/RNFIRMessaging.h b/ios/RNFIRMessaging.h index 0e73704c2f247ff47226aa080c1e2124e9c4f947..702c1ee33cc74683c91b0eb5887450978d47640b 100644 --- a/ios/RNFIRMessaging.h +++ b/ios/RNFIRMessaging.h @@ -8,7 +8,6 @@ extern NSString *const FCMNotificationReceived; -extern NSString *const FCMLocalNotificationReceived; @interface RNFIRMessaging : NSObject diff --git a/ios/RNFIRMesssaging.m b/ios/RNFIRMesssaging.m index 1676bbda0c961eb4bfe59ab5ac5bccbd610cf4b5..68c2ca852e039ceeb8d9da88ab1a68b28e5aa92a 100644 --- a/ios/RNFIRMesssaging.m +++ b/ios/RNFIRMesssaging.m @@ -18,7 +18,6 @@ #endif NSString *const FCMNotificationReceived = @"FCMNotificationReceived"; -NSString *const FCMLocalNotificationReceived = @"FCMLocalNotificationReceived"; @implementation RCTConvert (NSCalendarUnit) @@ -84,7 +83,7 @@ RCT_EXPORT_MODULE() _bridge = bridge; [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(handleRemoteNotificationReceived:) + selector:@selector(handleNotificationReceived:) name:FCMNotificationReceived object:nil]; @@ -97,10 +96,6 @@ RCT_EXPORT_MODULE() name:UIApplicationDidBecomeActiveNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(handleFCMLocalNotificationReceived:) - name:FCMLocalNotificationReceived - object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onTokenRefresh) name:kFIRInstanceIDTokenRefreshNotification object:nil]; @@ -279,14 +274,7 @@ RCT_EXPORT_METHOD(getBadgeNumber: (RCTPromiseResolveBlock)resolve rejecter:(RCTP resolve(@([RCTSharedApplication() applicationIconBadgeNumber])); } -- (void)handleFCMLocalNotificationReceived:(UILocalNotification *)notification -{ - NSMutableDictionary *data = [[NSMutableDictionary alloc]initWithDictionary: notification.userInfo]; - [data setValue:@(RCTSharedApplication().applicationState == UIApplicationStateInactive) forKey:@"opened_from_tray"]; - [_bridge.eventDispatcher sendDeviceEventWithName:FCMLocalNotificationReceived body:data]; -} - -- (void)handleRemoteNotificationReceived:(NSNotification *)notification +- (void)handleNotificationReceived:(NSNotification *)notification { NSMutableDictionary *data = [[NSMutableDictionary alloc]initWithDictionary: notification.userInfo]; [data setValue:@(RCTSharedApplication().applicationState == UIApplicationStateInactive) forKey:@"opened_from_tray"];