tradle / tim

mobile and web app that talks to Tradle backend infrastructure and the blockchain. Tim stands for Trust in Motion
GNU General Public License v3.0
20 stars 12 forks source link

Improve deep-linking #29

Open martinheidegger opened 2 years ago

martinheidegger commented 2 years ago

The current links in tim-web are very cryptic and it would be good if they are more useful, particularly with a deep state.

urbien commented 2 years ago

the problem with deep links is not that they are cryptic the problem is user experience if I recall correctly (@spwilko, please correct me), deep link does not work when app is already started and is in the background. E.g., deep link instead of going to /chat, goes to Tradle app's main page. But I do not recall whether this bug was showing up on iOS and Android.

Background:

  1. Deep links are a messy tech as native apps on both iOS and Android did not have any hyperlinks like web had from day one (hail Tim Berners Lee!), and when the links were finally implemented in native apps, they were implemented badly by the iOS, and the Android followed with the same bad design (they used URL schema://). This approach Then both switched to the mechanism where native registers a normal URL and when user clicks on it in the browser, the OS intercepts and invokes the app instead.

To complicate things for us developers, both iOS and Android Implementations are super buggy. Different versions of those OSes introduced different bugs.

So a startup Branch has built a business of layering on top of these buggy OS implementations, covering 1000 or more of the various edge cases.

To complicate things, clicking links in WhatsApp, Gmail and browsers have different results. Links are reencode by gmail if I recall (so we had to encode them ourselves to avoid being mangled)

  1. Deferred deep links. They work like this: users clicks on the URL in the browser (or WhatsApp, email) and app's page in appstore opens up for download. When app starts it receives the parameters from the URL, on which user clicked. Branch SDK gives us an indication that parameters were passed on the first app invocation.

Note that for deferred links Branch is using a redirect via its own site. This is of course terrible as becomes a dependency and a leakage point, but is unavoidable. We never bought the subscription from Branch as they give some small amount of deep links clicks for free. But we have an account and created an API key. @mvayngrib please give admin rights to @martinheidegger

In all my research (albeit last time a year ago) I did not find a decent open source equivalent to Branch. I think this is inevitably going to emerge, especially since all the old buggy iOS and Android versions will some day (if not already) will disappear from the market.

  1. Tradle app today does not have URL based navigation. But to be honest native apps do not usually have it, as they do not use URLs internally unlike web apps, only for deep links. But since we use React Native Web, this makes our Web app deficient, as one can't share a link to a page. We were planning this rewrite and @pgmemk tried a number of times to implement this, but it requires a switch to new Navigator component and React Native guys botched this component a couple of times, creating different new Navigators all with various deficiencies. Community also made a number of attempts at the Navigator. So we waited until they decide what they finally want to use as a standard Navigator. This also meant we had to upgrade to a new version of React Native, which by itself is a medium size project. So we implemented instead 3-4 URLs, like /chat, /profile and something else. And these are sufficient for posting links on the web site, twitter, etc. so that customers can click and load Tradle app and open on the page desired by the marketing department. Most common is to open Tradle app in the chat channel of the bank (under the hood, when user clicks such /chat link, Tradle app adds a new channel, and places the user in that channel and user receives the first message in it greeting them. What complicates the picture here is that before user is sent to the chat, banks want to ask user to agree to some terms and conditions, specific to their channel, and also send them to the guided tour. I think one of the bugs we still have with the deep links is for one of those 2 scenarios (search issued please and talk to @spwilko ).