OneSignal / react-native-onesignal

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

[iOS] Notification does not deeplink when app is in closed state #1016

Closed stu-dev closed 3 years ago

stu-dev commented 4 years ago

Description:

Apologies in advance for not following proper issue-reporting procedures. I had previously commented on another issue but I'm guessing contributors aren't notified on closed issues.

Below is a matrix to help describe my issue:

                                     Android | iOS
              Deep link (app in bg):    ✅   |  ✅
             Deep link (app closed):    ✅   |  ✅
 Notification Deep link (app in bg):    ✅   |  ✅
Notification Deep link (app closed):    ✅   |  ❌

Linking.getInitialURL() returns undefined only when deep linking on iOS from a onesignal push alert in an app-closed state. (Returns a value for all other scenarios)

I'm no iOS developer so I wouldn't know where to start but is there not some native code that could solve this? Adding a listener in the JS seems like an unnecessary/hacky solution when it's only needed to solve 1 in 4 onesignal deep link scenarios.

Environment

"react-native": "0.62.2",
"react-native-onesignal": "3.8.1"
rgomezp commented 4 years ago

Howdy, Thanks for your patience.

Take a look at this thread for a workaround on this issue. Hopefully RN resolves this soon.

Cheers

ghost commented 3 years ago

I'm not sure where the problem is, but when I try to open my app via xcrun it works properly. In other way when I try it from a Push Notification it doesn't.

xcrun simctl openurl booted "app://deeplink.url"

@stu-dev Did you find out how to fix it?

rgomezp commented 3 years ago

Howdy, I will close this issue in this repository since it is not a OneSignal-related problem. Please continue tracking the issue in the above linked thread.

Thank you

ghost commented 3 years ago

I'm not a 100% sure about that @rgomezp. Because when I use xcrun to run my closed app with a link, it works perfectly.

ghost commented 3 years ago

Any news on this?

rgomezp commented 3 years ago

Howdy @emilioheinz , If this is indeed a OneSignal problem, it may be fixed by a small change that we recently made to the way the notification open handler works. It will be included in the next major-release version of the SDK. If you could please test your issue with that version when it is released that would be great.

Take a look at our mobile SDK migration guides for more info.

Thank you for your patience and cooperation.

ghost commented 3 years ago

Ok, I will do so. Have you any expectation about when the next major-release version of the SDK will be available?

tomwhale commented 3 years ago

Hi all, Is there an update on this issue? Surely having deep linking working is quite a major part of OneSignal's offering?

ghost commented 3 years ago

@tomwhale I'm not sure if it is an OneSignal or React Native bug. Do you have any idea?

stu-dev commented 3 years ago

Yep it definitely is, prior to #1140 being "resolved" deep linking was working fine in all cases (but you had an alert that popped up asking you to "Open website" which is not ideal).

Then #1140 was fixed but this resulted in a regression of the deep linking (now no longer works from closed state). So now we are back to where we started.

Edit: if you read the SDK issue that this started in (https://github.com/OneSignal/OneSignal-iOS-SDK/issues/777) it seems clear that there has been a miscommunication between the issue from a RN perspective vs a native iOS perspective. The iOS devs wanted the "Open website" functionality removed (including auto deeplinking) so they could handle it manually themselves. Whereas the RN issue just wanted it to skip the "Open website" and auto-deeplink.

azai91 commented 3 years ago

Any update on this issue?

dzpt commented 3 years ago

Any update, notification deeplink doesn't work

canpoyrazoglu commented 3 years ago

Yup, this bug is preventing from us from going into production (as we use deeplinks in pushes to launch in-app chat and that confirmation dialog is bummer). Any updates at least on what causes it so that we can try to find a workaround/manually patch until an official fix is released?

marclester-tang commented 3 years ago

Same issue with flutter's sdk on deep linking

rgomezp commented 3 years ago

Please update to version 4.0.6

Enjoy!

canpoyrazoglu commented 3 years ago

Tried. I confirm that it's fixed on 4.0.6. Thank you!

rgomezp commented 3 years ago

For visibility: related workaround for deep linking problems - https://documentation.onesignal.com/docs/react-native-sdk#setnotificationopenedhandler-function

oliviercperrier commented 1 week ago

Im getting this same error using Expo SDK 51 with expo router.