Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| The phone app's scaffolding, in apps/mobile: Expo SDK 57 with Expo Router, Android first, with Chat, Code and Customize. It signs in with g1t's own OAuth 2.1 (PKCE, a client id that encodes "g1t for Android" and g1t://oauth/callback, so nothing is registered), keeps the server and credentials in the phone's keystore, refreshes the 30-day token a minute early and shares the single-use refresh between requests. A personal access token is the other way in, and a self-hosted g1t the other server. | 1 | import { router, useLocalSearchParams } from "expo-router"; |
| 2 | import * as WebBrowser from "expo-web-browser"; | |
| 3 | import { useEffect } from "react"; | |
| 4 | ||
| 5 | import { Loading, Screen } from "@/components/ui"; | |
| 6 | import { useSession } from "@/lib/session"; | |
| 7 | import { siteUrl } from "@/lib/server"; | |
| 8 | ||
| 9 | /** | |
| 10 | * A link to a page the app has no screen for: it opens on the site, in | |
| 11 | * the system's browser, and the app goes back to where it was. | |
| 12 | */ | |
| 13 | export default function Open() { | |
| 14 | const { path } = useLocalSearchParams<{ path?: string }>(); | |
| 15 | const { state } = useSession(); | |
| 16 | ||
| 17 | useEffect(() => { | |
| 18 | const server = state.server; | |
| 19 | if (!server) return; | |
| 20 | const safe = path && path.startsWith("/") ? path : "/"; | |
| 21 | void WebBrowser.openBrowserAsync(siteUrl(server, safe)).finally(() => { | |
| 22 | if (router.canGoBack()) router.back(); | |
| 23 | else router.replace("/"); | |
| 24 | }); | |
| 25 | }, [path, state.server]); | |
| 26 | ||
| 27 | return ( | |
| 28 | <Screen> | |
| 29 | <Loading /> | |
| 30 | </Screen> | |
| 31 | ); | |
| 32 | } |