Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
chore(mobile): add Expo app scaffold and assets
Richie McIlroy3020100561af
diff --git a/apps/mobile/.gitignore b/apps/mobile/.gitignorenew file mode 100644index 000000000..6dd4bbef8--- /dev/null+++ b/apps/mobile/.gitignore@@ -0,0 +1,13 @@+/node_modules+.expo+/ios+/android+dist+coverage+*.tsbuildinfo++# @generated expo-cli sync-2b81b286409207a5da26e14c78851eb30d8ccbdb+# The following patterns were generated by expo-cli++expo-env.d.ts+# @end expo-cli\ No newline at end of filediff --git a/apps/mobile/app.config.js b/apps/mobile/app.config.jsnew file mode 100644index 000000000..7d6f2acd2--- /dev/null+++ b/apps/mobile/app.config.js@@ -0,0 +1,67 @@+const associatedDomains =+ process.env.CAP_MOBILE_DISABLE_ASSOCIATED_DOMAINS === "1"+ ? []+ : process.env.CAP_MOBILE_ASSOCIATED_DOMAINS+ ? process.env.CAP_MOBILE_ASSOCIATED_DOMAINS.split(",")+ .map((domain) => domain.trim())+ .filter(Boolean)+ : ["applinks:cap.so"];+const bundleIdentifier = "so.cap.mobile";+const ios = {+ bundleIdentifier,+ supportsTablet: false,+ infoPlist: {+ NSPhotoLibraryUsageDescription:+ "Cap imports videos from Photos for upload.",+ NSPhotoLibraryAddUsageDescription: "Cap saves downloaded videos to Photos.",+ UIBackgroundModes: ["processing"],+ },+};++if (associatedDomains.length > 0) {+ ios.associatedDomains = associatedDomains;+}++module.exports = ({ config }) => ({+ ...config,+ name: "Cap",+ slug: "cap-mobile",+ scheme: "cap",+ owner: "cap",+ version: "0.1.0",+ orientation: "portrait",+ platforms: ["ios"],+ userInterfaceStyle: "light",+ icon: "./assets/icon.png",+ splash: {+ image: "./assets/splash-icon.png",+ resizeMode: "contain",+ backgroundColor: "#f9f9f9",+ },+ ios,+ experiments: {+ typedRoutes: true,+ },+ plugins: [+ "expo-router",+ [+ "expo-font",+ {+ fonts: [+ "../web/public/fonts/NeueMontreal-Regular.otf",+ "../web/public/fonts/NeueMontreal-Medium.otf",+ "../web/public/fonts/NeueMontreal-Bold.otf",+ ],+ },+ ],+ [+ "expo-secure-store",+ {+ faceIDPermission: "Allow Cap to protect your account key.",+ },+ ],+ ],+ extra: {+ apiBaseUrl: process.env.EXPO_PUBLIC_CAP_WEB_URL ?? "https://cap.so",+ },+});diff --git a/apps/mobile/assets/icon.png b/apps/mobile/assets/icon.pngnew file mode 100644index 000000000..b81ddeeefBinary files /dev/null and b/apps/mobile/assets/icon.png differdiff --git a/apps/mobile/assets/icon.svg b/apps/mobile/assets/icon.svgnew file mode 100644index 000000000..5e6e35210--- /dev/null+++ b/apps/mobile/assets/icon.svg@@ -0,0 +1,6 @@+<svg width="1024" height="1024" viewBox="0 0 1024 1024" fill="none" xmlns="http://www.w3.org/2000/svg">+<rect width="1024" height="1024" fill="#F9F9F9"/>+<circle cx="512" cy="512" r="372" fill="#4785FF"/>+<circle cx="512" cy="512" r="302" fill="#ADC9FF"/>+<circle cx="512" cy="512" r="232" fill="#FFFFFF"/>+</svg>diff --git a/apps/mobile/assets/splash-icon.png b/apps/mobile/assets/splash-icon.pngnew file mode 100644index 000000000..b480ea2b8Binary files /dev/null and b/apps/mobile/assets/splash-icon.png differdiff --git a/apps/mobile/assets/splash-icon.svg b/apps/mobile/assets/splash-icon.svgnew file mode 100644index 000000000..2a3ccf247--- /dev/null+++ b/apps/mobile/assets/splash-icon.svg@@ -0,0 +1,5 @@+<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">+<circle cx="256" cy="256" r="248" fill="#4785FF"/>+<circle cx="256" cy="256" r="202" fill="#ADC9FF"/>+<circle cx="256" cy="256" r="156" fill="#FFFFFF"/>+</svg>diff --git a/apps/mobile/babel.config.js b/apps/mobile/babel.config.jsnew file mode 100644index 000000000..8f92bed32--- /dev/null+++ b/apps/mobile/babel.config.js@@ -0,0 +1,7 @@+module.exports = (api) => {+ api.cache(true);+ return {+ presets: ["babel-preset-expo"],+ plugins: ["react-native-reanimated/plugin"],+ };+};diff --git a/apps/mobile/metro.config.js b/apps/mobile/metro.config.jsnew file mode 100644index 000000000..9c8cf0a0e--- /dev/null+++ b/apps/mobile/metro.config.js@@ -0,0 +1,14 @@+const path = require("node:path");+const { getDefaultConfig } = require("expo/metro-config");++const projectRoot = __dirname;+const workspaceRoot = path.resolve(projectRoot, "../..");+const config = getDefaultConfig(projectRoot);++config.watchFolders = [workspaceRoot];+config.resolver.nodeModulesPaths = [+ path.resolve(projectRoot, "node_modules"),+ path.resolve(workspaceRoot, "node_modules"),+];++module.exports = config;diff --git a/apps/mobile/package.json b/apps/mobile/package.jsonnew file mode 100644index 000000000..868773eb4--- /dev/null+++ b/apps/mobile/package.json@@ -0,0 +1,60 @@+{+ "name": "@cap/mobile",+ "version": "0.1.0",+ "private": true,+ "main": "expo-router/entry",+ "scripts": {+ "dev": "CAP_MOBILE_DISABLE_ASSOCIATED_DOMAINS=1 node scripts/run-ios-simulator.mjs",+ "dev:device": "expo run:ios --device",+ "start": "expo start --dev-client",+ "typecheck": "tsc --noEmit",+ "test": "vitest run",+ "prebuild:ios": "expo prebuild --platform ios --no-install",+ "ios": "expo run:ios"+ },+ "dependencies": {+ "@cap/web-domain": "workspace:*",+ "@expo/config-plugins": "~55.0.9",+ "@expo/metro-runtime": "~55.0.11",+ "@shopify/flash-list": "2.0.2",+ "effect": "^3.18.4",+ "expo": "~55.0.24",+ "expo-clipboard": "~55.0.13",+ "expo-constants": "~55.0.16",+ "expo-dev-client": "~55.0.34",+ "expo-document-picker": "~55.0.13",+ "expo-file-system": "~55.0.20",+ "expo-font": "~55.0.7",+ "expo-glass-effect": "~55.0.11",+ "expo-image": "~55.0.10",+ "expo-image-picker": "~55.0.20",+ "expo-linking": "~55.0.15",+ "expo-media-library": "~55.0.17",+ "expo-modules-core": "~55.0.25",+ "expo-router": "~55.0.14",+ "expo-secure-store": "~55.0.14",+ "expo-sharing": "~55.0.19",+ "expo-symbols": "~55.0.8",+ "expo-video": "~55.0.17",+ "expo-web-browser": "~55.0.16",+ "react": "19.2.0",+ "react-dom": "19.2.0",+ "react-native": "0.83.6",+ "react-native-gesture-handler": "~2.30.0",+ "react-native-reanimated": "4.2.1",+ "react-native-safe-area-context": "~5.6.2",+ "react-native-screens": "~4.23.0",+ "react-native-svg": "15.15.5",+ "react-native-web": "~0.21.0",+ "react-native-worklets": "0.7.4"+ },+ "devDependencies": {+ "@testing-library/react-native": "^13.3.3",+ "@types/react": "19.2.14",+ "@types/react-test-renderer": "^19.1.0",+ "babel-preset-expo": "~55.0.21",+ "react-test-renderer": "19.2.0",+ "typescript": "~5.9.2",+ "vitest": "^3.2.0"+ }+}diff --git a/apps/mobile/scripts/run-ios-simulator.mjs b/apps/mobile/scripts/run-ios-simulator.mjsnew file mode 100644index 000000000..1ea40fa0d--- /dev/null+++ b/apps/mobile/scripts/run-ios-simulator.mjs@@ -0,0 +1,107 @@+import { spawnSync } from "node:child_process";+import { existsSync, readFileSync } from "node:fs";+import { join } from "node:path";++const readSimulators = () => {+ const result = spawnSync(+ "xcrun",+ ["simctl", "list", "devices", "available", "--json"],+ {+ encoding: "utf8",+ },+ );+ if (result.status !== 0) {+ throw new Error(result.stderr || "Unable to list iOS simulators");+ }++ return JSON.parse(result.stdout);+};++const findSimulator = () => {+ const requestedUdid = process.env.IOS_SIMULATOR_UDID;+ const requestedName = process.env.IOS_SIMULATOR_DEVICE;+ const data = readSimulators();+ const devices = Object.values(data.devices ?? {})+ .flat()+ .filter(+ (device) => device?.isAvailable && device?.name?.includes("iPhone"),+ );++ if (requestedUdid) {+ const requested = devices.find((device) => device.udid === requestedUdid);+ if (requested) return requested;+ throw new Error(`No available iPhone simulator found for ${requestedUdid}`);+ }++ if (requestedName) {+ const requested = devices.find((device) => device.name === requestedName);+ if (requested) return requested;+ throw new Error(`No available iPhone simulator named ${requestedName}`);+ }++ const booted = devices.find((device) => device.state === "Booted");+ if (booted) return booted;++ const preferred = devices.find((device) => device.name.includes("Pro"));+ return preferred ?? devices[0] ?? null;+};++const simulator = findSimulator();+if (!simulator) {+ throw new Error("No available iPhone simulators found");+}++const needsDevPrebuild = () => {+ if (existsSync(join(process.cwd(), "ios", "CapBroadcastExtension"))) {+ return true;+ }+ const entitlementsPath = join(+ process.cwd(),+ "ios",+ "Cap",+ "Cap.entitlements",+ );+ if (!existsSync(entitlementsPath)) return true;+ const entitlements = readFileSync(entitlementsPath, "utf8");+ return entitlements.includes("com.apple.developer.associated-domains");+};++const command = ["exec", "expo", "run:ios", "--device", simulator.udid];+console.log(`Using iOS simulator: ${simulator.name} (${simulator.udid})`);++if (process.env.CAP_MOBILE_DRY_RUN === "1") {+ console.log(`pnpm ${command.join(" ")}`);+ process.exit(0);+}++if (+ process.env.CAP_MOBILE_DISABLE_ASSOCIATED_DOMAINS === "1" &&+ needsDevPrebuild()+) {+ const prebuild = spawnSync(+ "pnpm",+ [+ "exec",+ "expo",+ "prebuild",+ "--platform",+ "ios",+ "--no-install",+ "--clean",+ ],+ {+ stdio: "inherit",+ env: process.env,+ },+ );+ if (prebuild.status !== 0) {+ process.exit(prebuild.status ?? 1);+ }+}++const result = spawnSync("pnpm", command, {+ stdio: "inherit",+ env: process.env,+});++process.exit(result.status ?? 1);diff --git a/apps/mobile/tsconfig.json b/apps/mobile/tsconfig.jsonnew file mode 100644index 000000000..495df8487--- /dev/null+++ b/apps/mobile/tsconfig.json@@ -0,0 +1,22 @@+{+ "extends": "expo/tsconfig.base",+ "compilerOptions": {+ "strict": true,+ "allowImportingTsExtensions": true,+ "baseUrl": ".",+ "paths": {+ "@/*": ["src/*"],+ "@modules/*": ["modules/*"]+ },+ "types": ["vitest/globals"]+ },+ "include": [+ "app",+ "src",+ "modules",+ "plugins",+ "expo-env.d.ts",+ "*.js",+ ".expo/types/**/*.ts"+ ]+}diff --git a/apps/mobile/vitest.config.ts b/apps/mobile/vitest.config.tsnew file mode 100644index 000000000..d60d49c3b--- /dev/null+++ b/apps/mobile/vitest.config.ts@@ -0,0 +1,14 @@+import { fileURLToPath } from "node:url";+import { defineConfig } from "vitest/config";++export default defineConfig({+ esbuild: {+ jsx: "automatic",+ jsxImportSource: "react",+ },+ resolve: {+ alias: {+ "@": fileURLToPath(new URL("./src", import.meta.url)),+ },+ },+});