Enable links to in-app routes from chat messages
If you havenβt already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
cc @marcaaron
Problem
While working on https://github.com/Expensify/Expensify/issues/176355, we have found out there is currently no way how to add a link to chat message, which would navigate to some other view of the App (without reloading or opening new window).
We want to add a link to Concierge message, which would open the RHN with Guide calls for easier setup.
Potentially in future, there could be more usecases, where we will need this option (ie someone sharing a link like new.expensify.com/workspace/foo with someone else).
Solution
As per this Slack thread, we have decided to create a new component for AnchorForCommentsOnly which would be something along the lines of InternalAnchorForCommentsOnly.
Here, we will treat any anchor, whose href attribute starts with / as internal link and prevent default usage of <a> tag (which forces the page to reload) and use in-app system of navigation: Navigation.navigate().
- Check if the href starts with
/.- If no, process the link as we do now.
- If yes, check if the route matches any in app
ROUTES - If yes again, make sure to create Pressable Text with same styling as a link which will use
Navigation.navigate()on press.
@marcaaron I have added Planning label here for now as we can still think of some improvements. Please free to chime in if you want to specify something a bit more.
I think it should be Internal if we want to have it done faster. Also not sure if External contributor could test this as there are not concierge messages starting with / and they cannot create such a message from chat.
I like the solution - seems pretty straight forward to me. Only I'm not sure we should call this InternalAnchorForCommentsOnly or if we really need a new component. We can just check the href here then return the alternate style of link with a navigate method.
@marcaaron I totally agree with you, we can just check for it without creating a new component and then potentially refactor if it gets more complex over time.
π Deployed to staging by @marcaaron in version: 1.0.95-3 π
| platform | result |
|---|---|
| π€ android π€ | success β |
| π₯ desktop π₯ | success β |
| π iOS π | failure β |
| πΈ web πΈ | success β |
π Deployed to production by @roryabraham in version: 1.0.96-0 π
| platform | result |
|---|---|
| π€ android π€ | success β |
| π₯ desktop π₯ | success β |
| π iOS π | success β |
| πΈ web πΈ | success β |