react-native-onesignal icon indicating copy to clipboard operation
react-native-onesignal copied to clipboard

http/https launchUrl opens in a browser/webview instead of deep linking in iOS only

Open johnnywang opened this issue 3 years ago • 11 comments

Description:

We've managed to get deeplinks to (mostly) work in our mobile apps. The following cases all work fine:

  • Links to our website (i.e. https://app.mysite.com) deeplink correctly in both iOS and Android when tapped on in emails, messages, Slack, notes, etc, with both cold and warm starts
  • Branch links (i.e. https://mysite.app.link) also deeplink correctly in the above scenario
  • Both website and Branch links deeplink properly when specified as a Launch URL in the OneSignal web UI in Android
  • Custom schemes (i.e. mysite://) work in all scenarios

The one scenario left where this is not working is OneSignal notifications sent to iOS. Tapping on a notif with either a Branch or website link will result in our app opening as expected, but then the default browser opens the launch URL, instead of the app routing to the correct screen. However, tapping the option to open that page in the app will then route to the correct screen afterwards.

We have React Navigation set up to override getInitialUrl, but this also happens without that override. It appears that Linking.getInitialUrl (or with Branch, Branch.getLatestReferringParams) always returns null when tapping on an iOS notif set with a http(s) launch URL. However, if we specify a custom scheme instead, then while Linking.getInitialUrl still returns null, Branch will at least pick up on this link and then route properly.

Environment

  • React Native, as an ejected Expo app, running a bare workflow, with React Navigation
  • Installed "react-native-onesignal": "^4.3.5" via yarn
  • Launch URLs are either Branch links, or direct links to our site

Steps to Reproduce Issue:

I don't have a great way to repro this in a barebones app since I'm not sure how to set that up, but this is what we've done in our app:

  1. Followed the setup guide here
  2. For iOS, set up AASA file
  3. Set up React Navigation to handle our deeplinking
  4. Send a notif via the web UI with a http or https launch URL
  5. Set OneSignal_suppress_launch_urls to true in Info.plist (not necessary as this issue still happens without this, but in a webview)
  6. Observe the iOS app open first, then immediately open the default browser to the launch URL

Anything else:

While I didn't find any similar issues in this particular package, I did notice this still-open issue from the Cordova SDK that seems to point as a similar problem: https://github.com/OneSignal/OneSignal-Cordova-SDK/issues/412.

johnnywang avatar Jan 27 '22 02:01 johnnywang

Howdy, We're working on a fix for this and will have it released very soon. Thanks for your patience!

Cheers

rgomezp avatar Jan 27 '22 19:01 rgomezp

We encountered the same issue. With which version we can expect this to be resolved and when?

Cheers

BokiGaja avatar Mar 29 '22 13:03 BokiGaja

We have also encountered this problem, do you have any clues on when there will be a fix please?

Scr3nt avatar May 03 '22 16:05 Scr3nt

We have the same issue, Hope we can get this resolve soon.

Thanks

nwpnkmngm avatar Sep 22 '22 15:09 nwpnkmngm

Howdy, We're working on a fix for this and will have it released very soon. Thanks for your patience!

Cheers

Since Jan 27, are there any updates?

danieldoin avatar Oct 07 '22 08:10 danieldoin

Any updates? Facing the same issue while using deeplinks created via Firebase

sinameraji avatar Nov 13 '22 11:11 sinameraji

@rgomezp Any updates on this? @johnnywang have you found a solution for your issue? It's stuck on the webview PHOTO-2022-12-11-16-17-17

muxbert avatar Dec 11 '22 13:12 muxbert

@rgomezp Hi, have any updates? 🙏🏽

idanlevi1 avatar Dec 13 '22 06:12 idanlevi1

Hey guys! Has anyone managed to resolve the issue? We have the same issue.

CleiberReis avatar Feb 10 '23 16:02 CleiberReis

Hey guys! Has anyone managed to resolve the issue? We have the same issue.

Put this in info.plist:

	<key>OneSignal_suppress_launch_urls</key>
	<true/>

it work for me

idanlevi1 avatar Feb 11 '23 21:02 idanlevi1

We're having a similar issue where if we set a www url as the launchUrl in the push, the push opens in safari instead of using the inapp-browser. This behaviour seems configurable in the plain iOS sdk but I don't think that flag is set / exposed/ can be set by the react-native sdk. The flag seems to be OSUD_NOTIFICATION_OPEN_LAUNCH_URL / ONESIGNAL_INAPP_LAUNCH_URL

If our analysis is correct, please make that flag configurable from the react native sdk.

arneson avatar Nov 01 '23 13:11 arneson