OneSignal / react-native-onesignal

React Native Library for OneSignal Push Notifications Service
Other
1.56k stars 373 forks source link

[iOS] When launchURL is set, deep link will be triggered even if the app is already in the foreground #1233

Closed markoj3s closed 3 years ago

markoj3s commented 3 years ago

Hi!

I am setting the launchUrl to get redirected to the proper screen when clicking on the push notification. It is working perfectly, however, only on iOS, it is also happening when the app is already on the foreground without clicking any notification.

FYI, I'm using below packages:

"react-native": "0.64.0"
"react-native-onesignal": "^3.9.0"
"@react-navigation/bottom-tabs": "^5.10.0"
"@react-navigation/native": "^5.7.3"
"@react-navigation/stack": "^5.10.0"

and I configured iOS deep linking based on: https://reactnavigation.org/docs/deep-linking#ios

// Add the header at the top of the file:
#import <React/RCTLinkingManager.h>

// Add this above `@end`:
- (BOOL)application:(UIApplication *)application
   openURL:(NSURL *)url
   options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
  return [RCTLinkingManager application:application openURL:url options:options];
}

Not sure if it is due to the deep linking configuration or to the react-native-onesignal package.

Thank you, Marko

markoj3s commented 3 years ago

My bad, seems like related to below issue: https://github.com/OneSignal/react-native-onesignal/issues/684 however it seems it has been abandoned.... even though it is consistently happening to several people.