Commit 28381c89 authored by Libin Lu's avatar Libin Lu
parents bdcdcd1f 7035c08f
...@@ -313,7 +313,9 @@ RCT_EXPORT_MODULE(); ...@@ -313,7 +313,9 @@ RCT_EXPORT_MODULE();
} }
-(void) addListener:(NSString *)eventName { -(void) addListener:(NSString *)eventName {
if([super respondsToSelector:@selector(addListener:)]){
[super addListener:eventName]; [super addListener:eventName];
}
if([eventName isEqualToString:FCMNotificationReceived] && initialNotificationActionResponse) { if([eventName isEqualToString:FCMNotificationReceived] && initialNotificationActionResponse) {
[[NSNotificationCenter defaultCenter] postNotificationName:FCMNotificationReceived object:self userInfo:[initialNotificationActionResponse copy]]; [[NSNotificationCenter defaultCenter] postNotificationName:FCMNotificationReceived object:self userInfo:[initialNotificationActionResponse copy]];
...@@ -332,16 +334,22 @@ RCT_EXPORT_METHOD(isDirectChannelEstablished:(RCTPromiseResolveBlock)resolve rej ...@@ -332,16 +334,22 @@ RCT_EXPORT_METHOD(isDirectChannelEstablished:(RCTPromiseResolveBlock)resolve rej
RCT_EXPORT_METHOD(getInitialNotification:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) RCT_EXPORT_METHOD(getInitialNotification:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
{ {
UILocalNotification *localUserInfo = self.bridge.launchOptions[UIApplicationLaunchOptionsLocalNotificationKey]; NSDictionary* initialNotif;
if (localUserInfo) { NSDictionary *localUserInfo = [[self.bridge.launchOptions[UIApplicationLaunchOptionsLocalNotificationKey] userInfo] mutableCopy];
resolve([[localUserInfo userInfo] copy]); NSDictionary *remoteUserInfo = [self.bridge.launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey] mutableCopy];
if(localUserInfo){
initialNotif = localUserInfo;
} else if (remoteUserInfo) {
initialNotif = remoteUserInfo;
}
if (initialNotif) {
[initialNotif setValue:@YES forKey:@"opened_from_tray"];
resolve(initialNotif);
} else { } else {
resolve([self.bridge.launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey] copy]); resolve(nil);
} }
} }
RCT_EXPORT_METHOD(getAPNSToken:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) RCT_EXPORT_METHOD(getAPNSToken:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
{ {
NSData * deviceToken = [FIRMessaging messaging].APNSToken; NSData * deviceToken = [FIRMessaging messaging].APNSToken;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment