android: extend support for protocol navigation to Android#815
Conversation
Extends support for the `navigate` path of the `tailscale:` protocol to Android, mirroring the existing macOS routes & pending iOS routes. All settings tabs without existing routes simply open the main settings view for now. ``` tailscale://navigate/main/devices tailscale://navigate/main/devices/<computedName or stableID> tailscale://navigate/main/exit-nodes tailscale://navigate/main/exit-nodes/<stableID> tailscale://navigate/main/exit-nodes/location/<country> tailscale://navigate/settings[/<anyTab>] ``` The complete list of registered routes can be retrieved with the added `scripts/deeplink-probe.sh` script, passing "--routes" or "-l". This script can further be used to trigger the application to navigate to a given route by passing that to it. e.g., `scripts/deeplink-probe.sh settings/about` updates tailscale/corp#41056 Signed-off-by: Will Hannah <willh@tailscale.com>
barnstar
left a comment
There was a problem hiding this comment.
Mainly, I think we need to be really conservative on performing actions with deeplinks (and perhaps audit iOS/macOS if we allow that there). Navigation is perfectly fine, but the idea that clicking a link can change what exit node I'm using has some implications we need to consider before rolling it out.
| import com.tailscale.ipn.util.TSLog | ||
| import kotlinx.coroutines.CoroutineScope | ||
|
|
||
| // URL shape (mirrors iOS / macOS): |
There was a problem hiding this comment.
Let's link this to our documentation instead.
| navController.navigate("peerDetails/${node.StableID}") | ||
| } | ||
|
|
||
| // Matches macOS: ComputedName (case-insensitive) first, then StableID. |
There was a problem hiding this comment.
Remove the macOS ref... Let's just document the scheme (somewhere).
| when { | ||
| rest.isEmpty() -> { | ||
| presentExitNodePicker() | ||
| true |
There was a problem hiding this comment.
If we do this elsewhere, I think we shouldn't. It's one thing to present the UI - it's another thing to allow changing something like an exit node via a deeplink.
| @@ -0,0 +1,100 @@ | |||
| #!/usr/bin/env bash | |||
There was a problem hiding this comment.
nit: go, not bash when we can... Maybe toss this into an llm and have it port it.
Extends support for the
navigatepath of thetailscale:protocol to Android,mirroring the existing macOS routes & pending iOS routes.
All settings tabs without existing routes simply open the main settings view
for now.
The complete list of registered routes can be retrieved with the added
scripts/deeplink-probe.shscript, passing "--routes" or "-l". Thisscript can further be used to trigger the application to navigate to a
given route by passing that to it. e.g.,
scripts/deeplink-probe.sh settings/aboutupdates tailscale/corp#41056