SHPEUCF / shpeucfapp

SHPE UCF Mobile Application
https://tech.shpeucf.com
MIT License
12 stars 25 forks source link

Open links in corresponding app #136

Open idelmr opened 4 years ago

idelmr commented 4 years ago

Describe the feature

Links for Slack, Facebook, Instagram, and Email should be opened in the phone's app, if there is one. In case there isn't, a link to a browser should be opened as usual.

Describe possible solutions considered

The Linking component will be used for this and it can be done directly if we have the link to open up the app (it's usually something not straightforward). These links can be found on deeplink.me (use the WayBack Machine if broken) or on ~Google~ DuckDuckGo with a bit of research.

// Example for the SHPE Slack workspace
Linking.openURL(slack://open?team=TC61JSPUZ)

Additional comments

This should be simple, but the problem resides in Linking.canOpenURL, to check if the user's phone has the app to open it. Without checking if it can open it, the deep link will not do anything (or may even break the app). With Android, it's done pretty straightforward, but iOS is another story, since you need to add some keys into files and do additional changes.

Some stuff that may be helpful...

shpeucfapp/ios/shpeucfapp/Info.plist is the iOS file that contains the following array.

key in "LSApplicationQueriesSchemes" array

idelmr commented 3 years ago

Continued on appLinking