As a reader, I want to tap an hm:// link anywhere on my phone and have Seed open that document, so that links people send me lead straight to the page.
Situation
Someone sent me a Hypermedia link, or I saved one in a note. It starts with "hm://". Seed is installed on my iPhone. It may be closed or already open on something else.
What I do
Tap the hm:// link in the other app.
Let the phone switch to Seed.
Read the document that opens.
Tap Back to return to what Seed was showing before.
What I should see
My phone offers Seed for hm:// links and opens it.
The linked document opens in Seed's reader with its title, body and discussion, like any other page.
If Seed was closed, it starts directly on the linked document.
If Seed was already open on Read, the document opens on top of what I was reading, and Back returns there.
A link to an account with no page after it opens that account's home document.
A link that carries a version or points at one paragraph still opens the document.
The document is read from the server I chose in Me.
From the opened document, links, the directory, the authors and the discussion all work as usual.
While the document loads, the title reads "Document" and a spinner shows.
When something goes wrong
A link that is not a Hypermedia document shows "This link is not a Hypermedia document." with "Retry". Back returns to what I was reading.
A document my server does not have shows "This document doesn't exist on this server." I can go Back, or choose another server in Me and open the link again.
With no connection I see "Couldn't reach the server." and "Retry", which loads the page once I am online.
Not included
Ordinary web links to a Seed site (https://) do not open the app from outside. I paste them into Open site instead (Deep links and URL handling).
The link's version is ignored: I see the latest version.
A link to one paragraph does not scroll to that paragraph.
What happens when a link arrives while I am on the Activity, Agents or Me tab has not been confirmed (Moving between tabs and into the app).
Trace
Story US-READ-05, status Shipped. These links are kept in step with the traceability matrix and with the "User stories" section of every page listed here.
Design
Page | Part it plays |
|---|---|
Links into the app: the hm scheme, what the tests cover, what is not verified | |
The screen a deep link lands on, pushed over what Read showed | |
The linked document is pushed; Back returns | |
The doc route "/d/:ref" that every link resolves to | |
An hm link is read from the configured server | |
Read is the tab that shows documents | |
Deep links arrive through the same handler as in-app links | |
The failure line for a link that is not a document | |
Loading and failure of the landed document | |
What enters and leaves the app | |
A link that is not a document says so |
Implementation
Page | Part it plays |
|---|---|
The hm protocol handler, the URL-as-ref form, resolveLink and what is not handled | |
The doc route, follow as the warm-link handler, go | |
main navigate=follow | |
linkOfRef, refFromUrl, parseRef: a ref that is a whole URL | |
buildPage resolves the link, then loads the document | |
readDocs receives the URL ref | |
readRefs takes the doc route parameter as is | |
DocScreen for the landed document | |
/api/Resource for the document, /hm/api/config for site URLs | |
The framework whose iOS host registers the hm scheme declared in app.json | |
type "app" "<location>" delivers a deep link in tests | |
deep-links.test.ts | |
Platform limits around links |
Code
File | What |
|---|---|
protocolhandlers: hm → /d/%s | |
route doc "/d/:ref" | |
follow: the handler a warm link fires | |
main navigate=follow | |
readScopedHref leaves a ref that is already a URL untouched | |
linkOfRef: a route parameter that is a whole URL, decoded once | |
refFromUrl: version and block fragment dropped | |
resolveLink | |
buildPage: link resolution and "This link is not a Hypermedia document." | |
failedPage for a link that cannot be read |
Tests
File | What it checks |
|---|---|
an hm deep link opens its document in Read, over the home | |
a site URL deep link resolves through the site's home account | |
a deep link that is not a document says so | |
a doc route parameter that is a whole URL is a link, decoded once when encoded | |
deep links resolve: hm and gateway URLs directly, site pages through the site home | |
a deep-linked document page keeps the URL as its ref and shows the resolved document | |
hm and gateway URLs become refs; others are not documents |
Delivery
Delivered by #1470.
Do you like what you are reading? Subscribe to receive updates.
Unsubscribe anytime