The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 05:45 UTC
feat(mobile,web): copied thread links open the mobile app (#29815)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Nov 3, 2026 at 13:44 UTC
b183048a823815175fd6991691f2acec456ea176
9 files changed
+97
-8
apps/mobile/app.config.test.ts
+14
@@ -1,5 +1,9 @@
1
+import { DEFAULT_HOSTED_APP_URL } from "@t3tools/shared/connectAuth";
2
import { afterEach, expect, it, vi } from "vite-plus/test";
3
4
+import appleAppSiteAssociation from "../web/public/.well-known/apple-app-site-association.json";
5
+import assetLinks from "../web/public/.well-known/assetlinks.json";
6
+
7
// Keep config parsing independent of local env files and build credentials.
8
vi.mock("../../scripts/lib/public-config.ts", () => ({
9
loadRepoEnv: () => ({ APP_VARIANT: process.env.APP_VARIANT }),
@@ -30,4 +34,14 @@ it.each([
34
const config = await loadConfig(value);
35
expect(config.ios?.bundleIdentifier).toBe(identifier);
36
expect(config.android?.package).toBe(identifier);
37
+ // Copied thread links open this app only while app.t3.codes lists it.
38
+ const host = new URL(DEFAULT_HOSTED_APP_URL).host;
39
+ expect(config.ios?.associatedDomains).toContain(`applinks:${host}`);
40
+ expect(appleAppSiteAssociation.applinks.details[0]?.appIDs).toContain(
41
+ `${config.ios?.appleTeamId}.${identifier}`,
42
+ );
43
+ expect(config.android?.intentFilters?.[0]?.data).toEqual([
44
+ { scheme: "https", host, pathPrefix: "/threads/" },
45
+ ]);
46
+ expect(assetLinks.map((link) => link.target.package_name)).toContain(identifier);
47
});
apps/mobile/app.config.ts
+11
@@ -116,6 +116,8 @@ function resolveAppVariant(value: string | undefined): AppVariant {
116
}
117
118
const variant = VARIANT_CONFIG[APP_VARIANT];
119
+// Copied thread links open the app. app.t3.codes/.well-known lists every variant's identifiers.
120
+const HOSTED_APP_HOST = "app.t3.codes";
121
const iosBundleIdentifier = isIosPersonalTeamBuild
122
? personalTeamBundleIdentifier!
123
: variant.iosBundleIdentifier;
@@ -252,6 +254,7 @@ const config: ExpoConfig = {
254
associatedDomains: [
255
`applinks:${variant.relyingParty}`,
256
`webcredentials:${variant.relyingParty}`,
257
+ `applinks:${HOSTED_APP_HOST}`,
258
],
259
entitlements: {
260
"keychain-access-groups": [`$(AppIdentifierPrefix)${variant.iosBundleIdentifier}`],
@@ -302,6 +305,14 @@ const config: ExpoConfig = {
305
predictiveBackGestureEnabled: true,
306
// expo-sensors declares this for its pedometer, which the app does not use.
307
blockedPermissions: ["android.permission.ACTIVITY_RECOGNITION"],
308
+ intentFilters: [
309
+ {
310
+ action: "VIEW",
311
+ autoVerify: true,
312
+ data: [{ scheme: "https", host: HOSTED_APP_HOST, pathPrefix: "/threads/" }],
313
+ category: ["BROWSABLE", "DEFAULT"],
314
+ },
315
+ ],
316
},
317
web: {
318
favicon: variant.assets.appIcon,
apps/mobile/src/App.tsx
+8
-1
@@ -18,6 +18,7 @@ import {
18
type NavigationState,
19
} from "@react-navigation/native";
20
import { pipe } from "effect/Function";
21
+import { DEFAULT_HOSTED_APP_URL } from "@t3tools/shared/connectAuth";
22
23
import { RegistryContext } from "@effect/atom-react";
24
import { ProjectChipIconRasterizer } from "./native/ProjectChipIconImages";
@@ -122,7 +123,13 @@ function getAppStateFromPath(path: string, options: Parameters<typeof getStateFr
123
}
124
125
const appLinking = {
125
- prefixes: [Linking.createURL("/"), "t3code://", "t3code-dev://", "t3code-preview://"],
126
+ prefixes: [
127
+ Linking.createURL("/"),
128
+ "t3code://",
129
+ "t3code-dev://",
130
+ "t3code-preview://",
131
+ DEFAULT_HOSTED_APP_URL,
132
+ ],
133
config: { initialRouteName: "Home" },
134
filter: (url: string) => shouldHandleAppLink(url, hasCloudPublicConfig()),
135
getInitialURL: async () => (await Linking.getInitialURL()) ?? (await launchWorkspaceURL()),
apps/mobile/src/lib/appLinking.test.ts
+1
@@ -21,6 +21,7 @@ describe("shouldHandleAppLink", () => {
21
"t3code://threads/env-1/thread-1",
22
"t3code://pair?pairingUrl=x",
23
"t3code-dev://settings/usage?tab=limits",
24
+ "https://app.t3.codes/threads/env/thread?prompt=Fix%20expo-development-client%20and%20t3code://expo-sharing",
25
])("handles path-bearing URL %s", (url) => {
26
expect(shouldHandleAppLink(url, true)).toBe(true);
27
});
apps/mobile/src/lib/appLinking.ts
+5
-3
@@ -7,11 +7,13 @@ import type { NavigationState, PartialState } from "@react-navigation/native";
7
* to the NotFound wildcard route on every dev launch.
8
*/
9
export function shouldHandleAppLink(url: string, cloudConfigured: boolean): boolean {
10
+ // Only the route: a thread link's ?prompt= may mention either lifecycle URL.
11
+ const route = url.split(/[?#]/)[0] ?? "";
12
return (
11
- !url.includes("expo-development-client") &&
12
- !url.includes("://expo-sharing") &&
13
+ !route.includes("expo-development-client") &&
14
+ !route.includes("://expo-sharing") &&
15
!/^t3code(-dev|-preview)?:\/*$/.test(url) &&
14
- (cloudConfigured || !CLOUD_ONLY_LINK_PATH.test(url.split(/[?#]/)[0] ?? ""))
16
+ (cloudConfigured || !CLOUD_ONLY_LINK_PATH.test(route))
17
);
18
}
19
apps/web/public/.well-known/apple-app-site-association.json
new
+14
@@ -0,0 +1,14 @@
1
+{
2
+ "applinks": {
3
+ "details": [
4
+ {
5
+ "appIDs": [
6
+ "ARK85ZXQ4Z.com.t3tools.t3code",
7
+ "ARK85ZXQ4Z.com.t3tools.t3code.preview",
8
+ "ARK85ZXQ4Z.com.t3tools.t3code.dev"
9
+ ],
10
+ "components": [{ "/": "/threads/*" }]
11
+ }
12
+ ]
13
+ }
14
+}
apps/web/public/.well-known/assetlinks.json
new
+32
@@ -0,0 +1,32 @@
1
+[
2
+ {
3
+ "relation": ["delegate_permission/common.handle_all_urls"],
4
+ "target": {
5
+ "namespace": "android_app",
6
+ "package_name": "com.t3tools.t3code",
7
+ "sha256_cert_fingerprints": [
8
+ "B9:F5:1E:D5:A7:6C:D1:86:C9:51:08:F2:19:91:B7:D5:3A:58:FD:A9:83:12:A9:E3:53:E2:1A:59:B2:42:03:B6"
9
+ ]
10
+ }
11
+ },
12
+ {
13
+ "relation": ["delegate_permission/common.handle_all_urls"],
14
+ "target": {
15
+ "namespace": "android_app",
16
+ "package_name": "com.t3tools.t3code.preview",
17
+ "sha256_cert_fingerprints": [
18
+ "BE:B8:BD:67:53:2F:12:95:0A:30:62:88:91:C1:2F:D0:CF:20:28:C3:81:5D:6D:31:45:E7:5A:AF:24:A2:8F:18"
19
+ ]
20
+ }
21
+ },
22
+ {
23
+ "relation": ["delegate_permission/common.handle_all_urls"],
24
+ "target": {
25
+ "namespace": "android_app",
26
+ "package_name": "com.t3tools.t3code.dev",
27
+ "sha256_cert_fingerprints": [
28
+ "FA:C6:17:45:DC:09:03:78:6F:B9:ED:E6:2A:96:2B:39:9F:73:48:F0:BB:6F:89:9B:83:32:66:75:91:03:3B:9C"
29
+ ]
30
+ }
31
+ }
32
+]
apps/web/vercel.ts
+8
-1
@@ -62,5 +62,12 @@ export const config: VercelConfig = {
62
dest: `${LATEST_ORIGIN}/$1`,
63
},
64
],
65
- rewrites: [routes.rewrite("/(.*)", "/index.html")],
65
+ rewrites: [
66
+ // Apple fetches it without an extension; the .json file is served as application/json.
67
+ routes.rewrite(
68
+ "/.well-known/apple-app-site-association",
69
+ "/.well-known/apple-app-site-association.json",
70
+ ),
71
+ routes.rewrite("/(.*)", "/index.html"),
72
+ ],
73
};
docs/user/prompt-links.md
+4
-3
@@ -58,6 +58,7 @@ malicious.
58
## Share a thread
59
60
**Copy thread** copies a link such as `https://app.t3.codes/threads/<environment>/<thread>`. Paste
61
-it anywhere, such as Slack, a GitHub comment, or your notes. Opening it asks where to open it, like
62
-a prompt link, then opens the thread. Only someone connected to the machine that runs the thread
63
-can see it. In T3 Code, a thread link in a message opens the thread in the app.
61
+it anywhere, such as Slack, a GitHub comment, or your notes. On a phone with T3 Code installed, it
62
+opens the thread in the app. Elsewhere, opening it asks where to open it, like a prompt link, then
63
+opens the thread. Only someone connected to the machine that runs the thread can see it. In T3 Code,
64
+a thread link in a message opens the thread in the app.