Pushwoosh / pushwoosh-react-native-plugin

Other
57 stars 43 forks source link

Universal links not being handled properly #78

Closed GioLogist closed 5 years ago

GioLogist commented 5 years ago

We have universal links (iOS) set up to handle deep linking.

With our current setup, we can open a link from anywhere and it'll open and be properly routed in-app. However, if a URL is sent via Pushwoosh, it will not reach our listeners (IE: Linking.addEventListener or DeviceEventEmitter.addListener). Instead, the link will trigger our app to open and then launch Safari to open the link.

Expected behavior A URL is passed to Pushwoosh's push notification, we are able to attach listeners to handle the URL.

Actual behavior A URL is passed to Pushwoosh's push notification, our app is launched and Pushwoosh in turn opens safari instead.

Note: This happens whether we use "Deep Link" or "URL" in Pushwoosh GUI

wfhm commented 5 years ago

Hello,

Checking it!

wfhm commented 5 years ago

Hi @GioLogist,

It is possible to perform by passing your URL in a push payload. Use iOS Custom Data for this purpose, {"key":value} format.

After that, you can get a push payload from the pushOpened method. Your key/value will be in the "u" parameter of push payload.

u = “{\“key\“:\“value\“}”;

Take a look at our article from the Knowledge Base to find more detailed information about the payload parameters:

https://help.pushwoosh.com/hc/en-us/articles/360020536252-Push-Notification-payload-keys

Once you have obtained the corresponding parameter, you can handle a link according to your purposes

GioLogist commented 5 years ago

That doesn't seem to be the expected solution. Even in your GUI for Pushwoosh, you guys advertise deep links and allow us to register them. Yet, even after registering, they still open safari as oppose to simply passing the app the data 😬

wfhm commented 5 years ago

@GioLogist,

There is a difference between deep links and universal links. Deep links are using custom schemes, while universal links use HTTPS scheme. When a HTTPS link is opened from a push notification, Pushwoosh SDK opens this URL in Safari (using openURL:). By default, if the link is Universal link, Safari should immediately bounce the user to the app this link is referring.

However, It’s important to understand that if the app uses openURL: to open a universal link to your website, the link does not open in your app. In this scenario, iOS recognizes that the call originates from your app and therefore should not be handled as a universal link by your app.

This is the way Pushwoosh SDK works, so the only way to work around it is to pass your URL outside of "link" parameter, and iOS root params or custom data are the ways to do it.