Open History to see the last commit
1# T3 Code Mobile
2
3> [!WARNING]
4> T3 Code Mobile is currently in development and is not distributed yet. If you want to try it out, you can build it from source.
5
6## Quickstart
7
8> [!NOTE]
9> Uses native modules so using Expo Go is not supported. You need to use the Expo Dev Client.
10
11This app has three variants:
12
13- `development`: Expo dev client, installable side-by-side as `T3 Code Dev`
14- `preview`: persistent internal preview build, installable side-by-side as `T3 Code Preview`
15- `production`: store/release build as `T3 Code`
16
17Run commands from `apps/mobile`.
18
19T3 Connect is optional and disabled in a fresh clone. Public configuration belongs in the
20repository-root `.env` or `.env.local`, not an `apps/mobile/.env` file. See
21[`../../.env.example`](../../.env.example).
22
23## Development
24
25Start Metro for the dev client:
26
27```bash
28vp run dev:client
29```
30
31Metro keeps its transform cache between ordinary starts. If the cache itself is causing stale or
32invalid output, clear it for one development-client start:
33
34```bash
35vp run dev:client:reset
36```
37
38Run that reset once after installing or changing the Uniwind dependency patch. Cached transforms
39can otherwise reference its previous pnpm package path. Ordinary Metro starts still keep the cache.
40
41Component edits use Fast Refresh. See [mobile development lifecycle](../../docs/internals/mobile-development.md)
42before changing runtime ownership or refresh behavior.
43
44Build and run the local iOS dev client:
45
46```bash
47vp run ios:dev
48```
49
50After changing a native dependency patch, rerun CocoaPods before rebuilding an existing iOS
51project. pnpm gives each patch hash a new package path; Pods can otherwise keep compiling the
52previous directory.
53
54If your Xcode account only has a Personal Team, use a bundle identifier you control and opt into the
55reduced-capability local build. Personal Team builds omit the widget and share extensions, push
56entitlement, and native Sign in with Apple entitlement; builds without this opt-in are unchanged.
57
58```bash
59T3CODE_IOS_PERSONAL_TEAM=1 \
60T3CODE_IOS_PERSONAL_TEAM_BUNDLE_ID=com.example.t3code.dev \
61vp run ios:dev
62```
63
64Build and install a self-contained Release app that does not need Metro:
65
66```bash
67vp run ios:release
68```
69
70The Personal Team equivalent also needs a unique bundle identifier:
71
72```bash
73T3CODE_IOS_PERSONAL_TEAM=1 \
74T3CODE_IOS_PERSONAL_TEAM_BUNDLE_ID=com.example.t3code \
75vp run ios:release
76```
77
78Build and run the local iOS preview app:
79
80```bash
81vp run ios:preview
82```
83
84Force the review diff highlighter engine:
85
86```bash
87EXPO_PUBLIC_REVIEW_HIGHLIGHTER_ENGINE=javascript vp run ios:dev
88```
89
90`javascript` is the default and recommended setting for the review diff screen. Set `EXPO_PUBLIC_REVIEW_HIGHLIGHTER_ENGINE=native` only when you explicitly want to test the native Shiki engine.
91
92Inspect the resolved Expo config for a variant:
93
94```bash
95vp run config:dev
96vp run config:preview
97```
98
99Run static checks for mobile native code:
100
101```bash
102node ../../scripts/mobile-native-static-check.ts
103```
104
105The native lint task runs SwiftLint for Swift plus ktlint and detekt for Kotlin. Missing native tools are reported as warnings and skipped locally. CI installs the default toolset from `apps/mobile/Brewfile` before running the native checks.
106
107## EAS Builds
108
109Preview and production variants use Expo fingerprinting so OTA updates only reach binaries with matching native dependencies, config plugins, and patches. CI uses the `preview:dev` profile to reuse a compatible native build when possible.
110
111The development variant uses `appVersion` to avoid recalculating the native fingerprint for each Metro launch manifest. `MOBILE_VERSION_POLICY` can override either default. If you distribute a custom Release build with the development identity and publish OTA updates to it, set `MOBILE_VERSION_POLICY=fingerprint` for both its build and updates. Changing the runtime policy requires a native rebuild for OTA matching; an existing dev client can still load local Metro bundles.
112
113For preview or production EAS environments, set `T3CODE_CLERK_PUBLISHABLE_KEY`,
114`T3CODE_CLERK_JWT_TEMPLATE`, and `T3CODE_RELAY_URL`
115as EAS environment variables. Expo config maps the canonical values into the mobile build.
116
117Create a PR preview dev-client build manually:
118
119```bash
120vp run eas:ios:preview:dev
121```
122
123Create a cloud dev-client build:
124
125```bash
126vp run eas:ios:dev
127```
128
129Create a persistent preview build:
130
131```bash
132vp run eas:ios:preview
133```
134
135Android equivalents:
136
137```bash
138vp run eas:android:dev
139vp run eas:android:preview:dev
140vp run eas:android:preview
141```