| 1 | /// <reference types="node" /> |
| 2 | |
| 3 | import { existsSync } from "node:fs"; |
| 4 | import { join } from "node:path"; |
| 5 | |
| 6 | import type { ConfigContext, ExpoConfig } from "expo/config"; |
| 7 | |
| 8 | /** |
| 9 | * The phone app's configuration. `APP_VARIANT` (set by eas.json's |
| 10 | * profiles) picks an identity, so a development build, a preview build |
| 11 | * and the store build install side by side on one phone: |
| 12 | * |
| 13 | * | Variant | Android package / iOS bundle | Name | |
| 14 | * | ------------- | ---------------------------- | ----------- | |
| 15 | * | `development` | `sh.g1t.app.dev` | g1t (dev) | |
| 16 | * | `preview` | `sh.g1t.app.preview` | g1t (beta) | |
| 17 | * | production | `sh.g1t.app` | g1t | |
| 18 | * |
| 19 | * The EAS project is g1t's on expo.dev; push notifications on Android |
| 20 | * also need the Firebase credentials uploaded there (README.md). |
| 21 | */ |
| 22 | |
| 23 | /** The EAS project's id, from `eas init`. `EAS_PROJECT_ID` overrides it. */ |
| 24 | const EAS_PROJECT = "35fb457b-905c-44cd-9b35-0899e12852dd"; |
| 25 | |
| 26 | const variant = process.env.APP_VARIANT; |
| 27 | const suffix = variant === "development" ? ".dev" : variant === "preview" ? ".preview" : ""; |
| 28 | const name = variant === "development" ? "g1t (dev)" : variant === "preview" ? "g1t (beta)" : "g1t"; |
| 29 | const id = `sh.g1t.app${suffix}`; |
| 30 | const projectId = process.env.EAS_PROJECT_ID ?? EAS_PROJECT; |
| 31 | |
| 32 | /** g1t's background, dark as the site is by default (packages/theme/tokens.css `--g1t-bg`). */ |
| 33 | const BACKGROUND = "#0f0f11"; |
| 34 | /** The accent, for the notification icon's tint (`--g1t-accent`). */ |
| 35 | const ACCENT = "#b6a8ff"; |
| 36 | |
| 37 | /** |
| 38 | * Firebase's file for the Android app, which push on Android needs: from |
| 39 | * an EAS file secret in the cloud (`GOOGLE_SERVICES_JSON`), or a copy |
| 40 | * beside this file locally (ignored by git). Without one, everything but |
| 41 | * push works. |
| 42 | */ |
| 43 | const googleServices = process.env.GOOGLE_SERVICES_JSON ?? (existsSync(join(__dirname, "google-services.json")) ? "./google-services.json" : undefined); |
| 44 | |
| 45 | export default ({ config }: ConfigContext): ExpoConfig => ({ |
| 46 | ...config, |
| 47 | name, |
| 48 | slug: "g1t", |
| 49 | owner: process.env.EAS_OWNER, |
| 50 | version: "0.1.0", |
| 51 | orientation: "portrait", |
| 52 | icon: "./assets/images/icon.png", |
| 53 | // g1t:// links, as on the desktop, and where sign-in comes back to. |
| 54 | scheme: "g1t", |
| 55 | userInterfaceStyle: "automatic", |
| 56 | backgroundColor: BACKGROUND, |
| 57 | ios: { |
| 58 | bundleIdentifier: id, |
| 59 | supportsTablet: true, |
| 60 | config: { usesNonExemptEncryption: false }, |
| 61 | }, |
| 62 | android: { |
| 63 | package: id, |
| 64 | adaptiveIcon: { |
| 65 | backgroundColor: BACKGROUND, |
| 66 | foregroundImage: "./assets/images/android-icon-foreground.png", |
| 67 | monochromeImage: "./assets/images/android-icon-monochrome.png", |
| 68 | }, |
| 69 | predictiveBackGestureEnabled: true, |
| 70 | ...(googleServices ? { googleServicesFile: googleServices } : {}), |
| 71 | softwareKeyboardLayoutMode: "resize", |
| 72 | }, |
| 73 | plugins: [ |
| 74 | "expo-router", |
| 75 | "expo-secure-store", |
| 76 | "expo-web-browser", |
| 77 | [ |
| 78 | "expo-notifications", |
| 79 | { |
| 80 | icon: "./assets/images/notification-icon.png", |
| 81 | color: ACCENT, |
| 82 | defaultChannel: "messages", |
| 83 | }, |
| 84 | ], |
| 85 | [ |
| 86 | "expo-splash-screen", |
| 87 | { |
| 88 | backgroundColor: BACKGROUND, |
| 89 | image: "./assets/images/splash-icon.png", |
| 90 | imageWidth: 96, |
| 91 | }, |
| 92 | ], |
| 93 | ], |
| 94 | experiments: { |
| 95 | reactCompiler: true, |
| 96 | }, |
| 97 | runtimeVersion: { policy: "appVersion" }, |
| 98 | ...(projectId ? { updates: { url: `https://u.expo.dev/${projectId}` } } : {}), |
| 99 | extra: { |
| 100 | ...config.extra, |
| 101 | ...(projectId ? { eas: { projectId } } : {}), |
| 102 | }, |
| 103 | }); |