diff --git a/android/react-native-fcm.iml b/android/react-native-fcm.iml index be7ba28ccf5a5a33a2ca529e1b60dd277956e087..02e9551d664bdd53a12a6e8e9b5fd4c6f8dbccd5 100644 --- a/android/react-native-fcm.iml +++ b/android/react-native-fcm.iml @@ -65,14 +65,6 @@ - - - - - - - - @@ -81,6 +73,14 @@ + + + + + + + + @@ -99,7 +99,7 @@ - + @@ -110,14 +110,14 @@ - + - + diff --git a/android/src/main/java/com/evollu/react/fcm/FIRLocalMessagingHelper.java b/android/src/main/java/com/evollu/react/fcm/FIRLocalMessagingHelper.java index b818b1328512b54c2dd9da73f0e2c1d9c366da7a..ec47475d4f656794ad130a9a737951a7c72003b2 100644 --- a/android/src/main/java/com/evollu/react/fcm/FIRLocalMessagingHelper.java +++ b/android/src/main/java/com/evollu/react/fcm/FIRLocalMessagingHelper.java @@ -160,7 +160,9 @@ public class FIRLocalMessagingHelper { Intent i = new Intent("com.evollu.react.fcm.ReceiveLocalNotification"); i.putExtras(bundle); mContext.sendOrderedBroadcast(i, null); - }else{ + } + + if(!mIsForeground || bundle.getBoolean("show_in_foreground")){ Intent intent = new Intent(mContext, intentClass); intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); intent.putExtras(bundle); diff --git a/ios/RNFIRMessaging.xcodeproj/xcuserdata/LLu.xcuserdatad/xcschemes/xcschememanagement.plist b/ios/RNFIRMessaging.xcodeproj/xcuserdata/LLu.xcuserdatad/xcschemes/xcschememanagement.plist index 54a603d8ac5b1683e4f2ba069f502117aa1f998a..a3337cbe077330c0627edc840d49af67d735c5e5 100644 --- a/ios/RNFIRMessaging.xcodeproj/xcuserdata/LLu.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/ios/RNFIRMessaging.xcodeproj/xcuserdata/LLu.xcuserdatad/xcschemes/xcschememanagement.plist @@ -7,7 +7,7 @@ RNFIRMessaging.xcscheme orderHint - 7 + 9 SuppressBuildableAutocreation diff --git a/ios/RNFIRMesssaging.m b/ios/RNFIRMesssaging.m index 68c2ca852e039ceeb8d9da88ab1a68b28e5aa92a..05ce587e8542f321052e9b10631fe213caa96f57 100644 --- a/ios/RNFIRMesssaging.m +++ b/ios/RNFIRMesssaging.m @@ -276,9 +276,14 @@ RCT_EXPORT_METHOD(getBadgeNumber: (RCTPromiseResolveBlock)resolve rejecter:(RCTP - (void)handleNotificationReceived:(NSNotification *)notification { - NSMutableDictionary *data = [[NSMutableDictionary alloc]initWithDictionary: notification.userInfo]; - [data setValue:@(RCTSharedApplication().applicationState == UIApplicationStateInactive) forKey:@"opened_from_tray"]; - [_bridge.eventDispatcher sendDeviceEventWithName:FCMNotificationReceived body:data]; + if([notification.userInfo valueForKey:@"opened_from_tray"] == nil){ + NSMutableDictionary *data = [[NSMutableDictionary alloc]initWithDictionary: notification.userInfo]; + [data setValue:@(RCTSharedApplication().applicationState == UIApplicationStateInactive) forKey:@"opened_from_tray"]; + [_bridge.eventDispatcher sendDeviceEventWithName:FCMNotificationReceived body:data]; + }else{ + [_bridge.eventDispatcher sendDeviceEventWithName:FCMNotificationReceived body:notification.userInfo]; + } + } @end