diff --git a/apps/mobile/README.md b/apps/mobile/README.md new file mode 100644 index 0000000000..c1bf5b4064 --- /dev/null +++ b/apps/mobile/README.md @@ -0,0 +1,65 @@ +# T3 Code Mobile + +> [!WARNING] +> 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. + +## Quickstart + +> [!NOTE] +> Uses native modules so using Expo Go is not supported. You need to use the Expo Dev Client. + +This app has three variants: + +- `development`: Expo dev client, installable side-by-side as `T3 Code Dev` +- `preview`: persistent internal preview build, installable side-by-side as `T3 Code Preview` +- `production`: store/release build as `T3 Code` + +Run commands from `apps/mobile`. + +## Development + +Start Metro for the dev client: + +```bash +bun run dev:client +``` + +Build and run the local iOS dev client: + +```bash +bun run ios:dev +``` + +Build and run the local iOS preview app: + +```bash +bun run ios:preview +``` + +Inspect the resolved Expo config for a variant: + +```bash +bun run config:dev +bun run config:preview +``` + +## EAS Builds + +Create a cloud dev-client build: + +```bash +bun run eas:ios:dev +``` + +Create a persistent preview build: + +```bash +bun run eas:ios:preview +``` + +Android equivalents: + +```bash +bun run eas:android:dev +bun run eas:android:preview +``` diff --git a/apps/mobile/TODO.md b/apps/mobile/TODO.md deleted file mode 100644 index d2401d531c..0000000000 --- a/apps/mobile/TODO.md +++ /dev/null @@ -1,15 +0,0 @@ -- Expo Router for navigation - - / (Home, list of recent threads) - - /connections (Connections, list of connected environments) - - /connections/new (Add backend, QR code scanner, manual input) - - /new (New thread) - - /new (Sheet, select project) - - /draft (New thread, prompt, select model, environment, workspace etc) - These two is 2 pages in one sheet with sliding animation between them -- effect/rpc for typed rpc -- Uniwind? -- Theme it like the desktop app -- Share more code between web and mobile using @t3tools/client-runtime -- Make sure model list, options etc are server authorative and not hardcoded in the client -- Fix bug where sheet content doesn't scroll -- Allow pasting images into text input diff --git a/apps/mobile/app.config.ts b/apps/mobile/app.config.ts new file mode 100644 index 0000000000..00a667391e --- /dev/null +++ b/apps/mobile/app.config.ts @@ -0,0 +1,130 @@ +import type { ExpoConfig } from "expo/config"; + +type AppVariant = "development" | "preview" | "production"; + +const APP_VARIANT = resolveAppVariant(process.env.APP_VARIANT); + +const VARIANT_CONFIG: Record< + AppVariant, + { + readonly appName: string; + readonly iosIcon: string; + readonly iosBundleIdentifier: string; + readonly androidPackage: string; + } +> = { + development: { + appName: "T3 Code Dev", + iosIcon: "./assets/icon-composer-dev.icon", + iosBundleIdentifier: "com.t3tools.t3code.dev", + androidPackage: "com.t3tools.t3code.dev", + }, + preview: { + appName: "T3 Code Preview", + iosIcon: "./assets/icon-composer-prod.icon", + iosBundleIdentifier: "com.t3tools.t3code.preview", + androidPackage: "com.t3tools.t3code.preview", + }, + production: { + appName: "T3 Code", + iosIcon: "./assets/icon-composer-prod.icon", + iosBundleIdentifier: "com.t3tools.t3code", + androidPackage: "com.t3tools.t3code", + }, +}; + +function resolveAppVariant(value: string | undefined): AppVariant { + switch (value) { + case "development": + case "preview": + case "production": + return value; + default: + return "production"; + } +} + +const variant = VARIANT_CONFIG[APP_VARIANT]; + +const config: ExpoConfig = { + name: variant.appName, + slug: "t3-code", + scheme: "t3code", + version: "0.1.0", + runtimeVersion: { + policy: "appVersion", + }, + orientation: "portrait", + icon: "./assets/icon.png", + userInterfaceStyle: "automatic", + updates: { + enabled: true, + url: "https://u.expo.dev/d763fcb8-d37c-41ea-a773-b54a0ab4a454", + checkAutomatically: "ON_LOAD", + fallbackToCacheTimeout: 0, + }, + splash: { + image: "./assets/splash-icon.png", + resizeMode: "contain", + backgroundColor: "#ffffff", + }, + ios: { + icon: variant.iosIcon, + supportsTablet: true, + bundleIdentifier: variant.iosBundleIdentifier, + infoPlist: { + NSAppTransportSecurity: { + NSAllowsArbitraryLoads: true, + }, + ITSAppUsesNonExemptEncryption: false, + }, + }, + android: { + icon: "./assets/icon.png", + package: variant.androidPackage, + adaptiveIcon: { + backgroundColor: "#E6F4FE", + foregroundImage: "./assets/android-icon-foreground.png", + backgroundImage: "./assets/android-icon-background.png", + monochromeImage: "./assets/android-icon-monochrome.png", + }, + predictiveBackGestureEnabled: false, + }, + web: { + favicon: "./assets/favicon.png", + }, + plugins: [ + [ + "expo-camera", + { + cameraPermission: "Allow T3 Code to access your camera so you can scan pairing QR codes.", + barcodeScannerEnabled: true, + }, + ], + [ + "expo-splash-screen", + { + image: "./assets/splash-icon.png", + resizeMode: "contain", + backgroundColor: "#ffffff", + imageWidth: 220, + dark: { + image: "./assets/splash-icon.png", + backgroundColor: "#0a0a0a", + }, + }, + ], + "expo-secure-store", + "expo-router", + "./plugins/withAndroidCleartextTraffic.cjs", + ], + extra: { + appVariant: APP_VARIANT, + eas: { + projectId: "d763fcb8-d37c-41ea-a773-b54a0ab4a454", + }, + }, + owner: "pingdotgg", +}; + +export default config; diff --git a/apps/mobile/app.json b/apps/mobile/app.json deleted file mode 100644 index 1d0ab48653..0000000000 --- a/apps/mobile/app.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "expo": { - "name": "T3 Code", - "slug": "t3-code", - "scheme": "t3code", - "version": "0.1.0", - "runtimeVersion": { - "policy": "appVersion" - }, - "orientation": "portrait", - "icon": "./assets/icon.png", - "userInterfaceStyle": "automatic", - "updates": { - "enabled": true, - "url": "https://u.expo.dev/d763fcb8-d37c-41ea-a773-b54a0ab4a454", - "checkAutomatically": "ON_LOAD", - "fallbackToCacheTimeout": 0 - }, - "splash": { - "image": "./assets/splash-icon.png", - "resizeMode": "contain", - "backgroundColor": "#ffffff" - }, - "ios": { - "icon": "./assets/icon.png", - "supportsTablet": true, - "bundleIdentifier": "com.t3tools.t3code", - "infoPlist": { - "NSAppTransportSecurity": { - "NSAllowsArbitraryLoads": true - }, - "ITSAppUsesNonExemptEncryption": false - } - }, - "android": { - "icon": "./assets/icon.png", - "package": "com.t3tools.t3code", - "adaptiveIcon": { - "backgroundColor": "#E6F4FE", - "foregroundImage": "./assets/android-icon-foreground.png", - "backgroundImage": "./assets/android-icon-background.png", - "monochromeImage": "./assets/android-icon-monochrome.png" - }, - "predictiveBackGestureEnabled": false - }, - "web": { - "favicon": "./assets/favicon.png" - }, - "plugins": [ - [ - "expo-camera", - { - "cameraPermission": "Allow T3 Code to access your camera so you can scan pairing QR codes.", - "barcodeScannerEnabled": true - } - ], - [ - "expo-splash-screen", - { - "image": "./assets/splash-icon.png", - "resizeMode": "contain", - "backgroundColor": "#ffffff", - "imageWidth": 220, - "dark": { - "image": "./assets/splash-icon.png", - "backgroundColor": "#0a0a0a" - } - } - ], - "expo-secure-store", - "expo-router", - "./plugins/withAndroidCleartextTraffic.cjs" - ], - "extra": { - "eas": { - "projectId": "d763fcb8-d37c-41ea-a773-b54a0ab4a454" - } - }, - "owner": "pingdotgg" - } -} diff --git a/apps/mobile/assets/icon-composer-dev.icon/Assets/T3.svg b/apps/mobile/assets/icon-composer-dev.icon/Assets/T3.svg new file mode 100644 index 0000000000..b12706fdfc --- /dev/null +++ b/apps/mobile/assets/icon-composer-dev.icon/Assets/T3.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/mobile/assets/icon-composer-dev.icon/Assets/Texturelabs_Paper_381XL.jpg b/apps/mobile/assets/icon-composer-dev.icon/Assets/Texturelabs_Paper_381XL.jpg new file mode 100644 index 0000000000..d98c41a4e3 Binary files /dev/null and b/apps/mobile/assets/icon-composer-dev.icon/Assets/Texturelabs_Paper_381XL.jpg differ diff --git a/apps/mobile/assets/icon-composer-dev.icon/Assets/gpt-image-1.5-jd70szmrd03p36z4zv48ycsbax81egvr.png b/apps/mobile/assets/icon-composer-dev.icon/Assets/gpt-image-1.5-jd70szmrd03p36z4zv48ycsbax81egvr.png new file mode 100644 index 0000000000..de5a82d8c4 Binary files /dev/null and b/apps/mobile/assets/icon-composer-dev.icon/Assets/gpt-image-1.5-jd70szmrd03p36z4zv48ycsbax81egvr.png differ diff --git a/apps/mobile/assets/icon-composer-dev.icon/icon.json b/apps/mobile/assets/icon-composer-dev.icon/icon.json new file mode 100644 index 0000000000..fd3fb6819a --- /dev/null +++ b/apps/mobile/assets/icon-composer-dev.icon/icon.json @@ -0,0 +1,45 @@ +{ + "fill": { + "solid": "display-p3:0.00000,0.00000,0.00000,1.00000" + }, + "groups": [ + { + "layers": [ + { + "hidden": false, + "image-name": "gpt-image-1.5-jd70szmrd03p36z4zv48ycsbax81egvr.png", + "name": "gpt-image-1.5-jd70szmrd03p36z4zv48ycsbax81egvr", + "position": { + "scale": 1.1, + "translation-in-points": [0, 0] + } + }, + { + "image-name": "T3.svg", + "name": "T3", + "position": { + "scale": 10, + "translation-in-points": [0, 0] + } + }, + { + "hidden": true, + "image-name": "Texturelabs_Paper_381XL.jpg", + "name": "Texturelabs_Paper_381XL" + } + ], + "shadow": { + "kind": "neutral", + "opacity": 0.5 + }, + "translucency": { + "enabled": true, + "value": 0.5 + } + } + ], + "supported-platforms": { + "circles": ["watchOS"], + "squares": "shared" + } +} diff --git a/apps/mobile/assets/icon-composer-prod.icon/Assets/T3.svg b/apps/mobile/assets/icon-composer-prod.icon/Assets/T3.svg new file mode 100644 index 0000000000..b12706fdfc --- /dev/null +++ b/apps/mobile/assets/icon-composer-prod.icon/Assets/T3.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/mobile/assets/icon-composer-prod.icon/icon.json b/apps/mobile/assets/icon-composer-prod.icon/icon.json new file mode 100644 index 0000000000..8f7579311f --- /dev/null +++ b/apps/mobile/assets/icon-composer-prod.icon/icon.json @@ -0,0 +1,31 @@ +{ + "fill": { + "solid": "display-p3:0.00000,0.00000,0.00000,1.00000" + }, + "groups": [ + { + "layers": [ + { + "image-name": "T3.svg", + "name": "T3", + "position": { + "scale": 10, + "translation-in-points": [0, 0] + } + } + ], + "shadow": { + "kind": "neutral", + "opacity": 0.5 + }, + "translucency": { + "enabled": true, + "value": 0.5 + } + } + ], + "supported-platforms": { + "circles": ["watchOS"], + "squares": "shared" + } +} diff --git a/apps/mobile/eas.json b/apps/mobile/eas.json index 6cbe93d497..cb0075613b 100644 --- a/apps/mobile/eas.json +++ b/apps/mobile/eas.json @@ -5,15 +5,24 @@ }, "build": { "development": { + "env": { + "APP_VARIANT": "development" + }, "channel": "development", "developmentClient": true, "distribution": "internal" }, "preview": { + "env": { + "APP_VARIANT": "preview" + }, "channel": "preview", "distribution": "internal" }, "production": { + "env": { + "APP_VARIANT": "production" + }, "channel": "production", "autoIncrement": true } diff --git a/apps/mobile/package.json b/apps/mobile/package.json index 6c4215d879..6904143b67 100644 --- a/apps/mobile/package.json +++ b/apps/mobile/package.json @@ -5,10 +5,31 @@ "main": "index.ts", "scripts": { "dev": "expo start --clear", + "dev:client": "APP_VARIANT=development expo start --dev-client --clear", "start": "expo start", + "start:dev": "APP_VARIANT=development expo start", + "start:preview": "APP_VARIANT=preview expo start", + "start:prod": "APP_VARIANT=production expo start", "android": "EXPO_NO_GIT_STATUS=1 expo prebuild --clean --platform android && expo run:android", + "android:dev": "APP_VARIANT=development EXPO_NO_GIT_STATUS=1 expo prebuild --clean --platform android && expo run:android", + "android:preview": "APP_VARIANT=preview EXPO_NO_GIT_STATUS=1 expo prebuild --clean --platform android && expo run:android", + "android:prod": "APP_VARIANT=production EXPO_NO_GIT_STATUS=1 expo prebuild --clean --platform android && expo run:android", + "eas:android:dev": "eas build --profile development -p android", + "eas:android:preview": "eas build --profile preview -p android", + "eas:android:prod": "eas build --profile production -p android", "ios": "EXPO_NO_GIT_STATUS=1 expo prebuild --clean --platform ios && expo run:ios", - "web": "expo start --web", + "ios:dev": "APP_VARIANT=development EXPO_NO_GIT_STATUS=1 expo prebuild --clean --platform ios && expo run:ios", + "ios:preview": "APP_VARIANT=preview EXPO_NO_GIT_STATUS=1 expo prebuild --clean --platform ios && expo run:ios", + "ios:prod": "APP_VARIANT=production EXPO_NO_GIT_STATUS=1 expo prebuild --clean --platform ios && expo run:ios", + "eas:ios:dev": "eas build --profile development -p ios", + "eas:ios:preview": "eas build --profile preview -p ios", + "eas:ios:prod": "eas build --profile production -p ios", + "eas:dev": "eas build --profile development", + "eas:preview": "eas build --profile preview", + "eas:prod": "eas build --profile production", + "config:dev": "APP_VARIANT=development expo config", + "config:preview": "APP_VARIANT=preview expo config", + "config:prod": "APP_VARIANT=production expo config", "typecheck": "tsc --noEmit" }, "dependencies": { @@ -39,6 +60,7 @@ "expo-splash-screen": "~55.0.13", "expo-symbols": "~55.0.5", "expo-updates": "~55.0.16", + "punycode": "^2.3.1", "react": "19.2.5", "react-dom": "19.2.5", "react-native": "0.83.4", diff --git a/bun.lock b/bun.lock index ceffd10c30..a046fadbf6 100644 --- a/bun.lock +++ b/bun.lock @@ -71,6 +71,7 @@ "expo-splash-screen": "~55.0.13", "expo-symbols": "~55.0.5", "expo-updates": "~55.0.16", + "punycode": "^2.3.1", "react": "19.2.5", "react-dom": "19.2.5", "react-native": "0.83.4", @@ -2297,6 +2298,8 @@ "pump": ["pump@3.0.4", "", { "dependencies": { "end-of-stream": "^1.1.0", "once": "^1.3.1" } }, "sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA=="], + "punycode": ["punycode@2.3.1", "", {}, "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg=="], + "pure-rand": ["pure-rand@8.4.0", "", {}, "sha512-IoM8YF/jY0hiugFo/wOWqfmarlE6J0wc6fDK1PhftMk7MGhVZl88sZimmqBBFomLOCSmcCCpsfj7wXASCpvK9A=="], "quansync": ["quansync@1.0.0", "", {}, "sha512-5xZacEEufv3HSTPQuchrvV6soaiACMFnq1H8wkVioctoH3TRha9Sz66lOxRwPK/qZj7HPiSveih9yAyh98gvqA=="],