Commit a1baadb8 authored by Libin Lu's avatar Libin Lu

add opened_from_tray flag

parent 3d94f3b9
...@@ -129,6 +129,7 @@ public class FIRMessagingModule extends ReactContextBaseJavaModule implements Li ...@@ -129,6 +129,7 @@ public class FIRMessagingModule extends ReactContextBaseJavaModule implements Li
} }
WritableMap fcm = Arguments.createMap(); WritableMap fcm = Arguments.createMap();
fcm.putString("action", intent.getAction()); fcm.putString("action", intent.getAction());
fcm.putInt("opened_from_tray", 1);
params.putMap("fcm", fcm); params.putMap("fcm", fcm);
return params; return params;
} }
......
...@@ -118,8 +118,10 @@ RCT_EXPORT_METHOD(unsubscribeFromTopic: (NSString*) topic) ...@@ -118,8 +118,10 @@ RCT_EXPORT_METHOD(unsubscribeFromTopic: (NSString*) topic)
- (void)handleRemoteNotificationReceived:(NSNotification *)notification - (void)handleRemoteNotificationReceived:(NSNotification *)notification
{ {
NSMutableDictionary *data = [[NSMutableDictionary alloc]initWithDictionary: notification.userInfo];
[data setValue:@(RCTSharedApplication().applicationState == UIApplicationStateInactive) forKey:@"opened_from_tray"];
[_bridge.eventDispatcher sendDeviceEventWithName:FCMNotificationReceived [_bridge.eventDispatcher sendDeviceEventWithName:FCMNotificationReceived
body:notification.userInfo]; body:data];
} }
@end @end
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