App icon indicating copy to clipboard operation
App copied to clipboard

Enable links to in-app routes from chat messages

Open mountiny opened this issue 5 years ago β€’ 5 comments

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().

  1. Check if the href starts with /.
    • If no, process the link as we do now.
  2. If yes, check if the route matches any in app ROUTES
  3. If yes again, make sure to create Pressable Text with same styling as a link which will use Navigation.navigate() on press.

mountiny avatar Sep 09 '21 13:09 mountiny

@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.

mountiny avatar Sep 09 '21 14:09 mountiny

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 avatar Sep 09 '21 17:09 marcaaron

@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.

mountiny avatar Sep 09 '21 18:09 mountiny

πŸš€ Deployed to staging by @marcaaron in version: 1.0.95-3 πŸš€

platform result
πŸ€– android πŸ€– success βœ…
πŸ–₯ desktop πŸ–₯ success βœ…
🍎 iOS 🍎 failure ❌
πŸ•Έ web πŸ•Έ success βœ…

botify avatar Sep 10 '21 03:09 botify

πŸš€ Deployed to production by @roryabraham in version: 1.0.96-0 πŸš€

platform result
πŸ€– android πŸ€– success βœ…
πŸ–₯ desktop πŸ–₯ success βœ…
🍎 iOS 🍎 success βœ…
πŸ•Έ web πŸ•Έ success βœ…

botify avatar Sep 10 '21 19:09 botify