Skip to content

Commit 1929d3f

Browse files
authored
Merge pull request #227 from bluntbrain/feat/mobile
feat: mobile app first version complete
2 parents d08b459 + 7f272a8 commit 1929d3f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+5064
-0
lines changed

mobile/.gitignore

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files
2+
3+
# dependencies
4+
node_modules/
5+
6+
# Expo
7+
.expo/
8+
dist/
9+
web-build/
10+
expo-env.d.ts
11+
12+
# Native
13+
.kotlin/
14+
*.orig.*
15+
*.jks
16+
*.p8
17+
*.p12
18+
*.key
19+
*.mobileprovision
20+
21+
# Metro
22+
.metro-health-check*
23+
24+
# debug
25+
npm-debug.*
26+
yarn-debug.*
27+
yarn-error.*
28+
29+
# macOS
30+
.DS_Store
31+
*.pem
32+
33+
# local env files
34+
.env*.local
35+
36+
# typescript
37+
*.tsbuildinfo

mobile/App.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import 'react-native-gesture-handler';
2+
import { ExpoRoot } from 'expo-router';
3+
4+
// Must be exported or Fast Refresh won't update the context
5+
export default function App() {
6+
const ctx = require.context('./app');
7+
return <ExpoRoot context={ctx} />;
8+
}

mobile/README.md

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
# 1ai Mobile App
2+
3+
React Native mobile app for the 1ai multi-model AI chat platform.
4+
5+
## Tech Stack
6+
7+
- **Framework**: React Native with Expo SDK 54
8+
- **Navigation**: Expo Router (file-based)
9+
- **Runtime**: Bun
10+
- **Language**: TypeScript
11+
- **Styling**: StyleSheet (no external CSS framework)
12+
- **State**: React hooks + Context API
13+
- **Authentication**: JWT with Expo SecureStore
14+
- **UI Components**: Custom components + Ionicons
15+
16+
## Project Structure
17+
18+
```
19+
mobile/
20+
├── app/ # Expo Router pages
21+
│ ├── (auth)/ # Authentication flow
22+
│ │ ├── signin.tsx # Email input
23+
│ │ └── otp.tsx # OTP verification
24+
│ ├── (main)/ # Main app screens
25+
│ │ ├── chat.tsx # Chat interface
26+
│ │ ├── apps/ # AI applications
27+
│ │ ├── pricing.tsx # Subscription plans
28+
│ │ ├── settings.tsx # User settings
29+
│ │ └── webview.tsx # External links
30+
│ ├── home.tsx # Landing page
31+
│ ├── index.tsx # Auth check & routing
32+
│ └── _layout.tsx # Root layout
33+
├── src/
34+
│ ├── components/ # Reusable components
35+
│ │ ├── ui/ # Basic UI components
36+
│ │ └── chat/ # Chat-specific components
37+
│ ├── screens/ # Screen implementations
38+
│ ├── services/ # API client
39+
│ ├── contexts/ # React contexts
40+
│ ├── constants/ # Theme & spacing
41+
│ ├── utils/ # Utilities & data
42+
│ └── types/ # TypeScript types
43+
└── assets/ # Images & icons
44+
```
45+
46+
## Development Commands
47+
48+
### Setup
49+
```bash
50+
bun install # Install dependencies
51+
```
52+
53+
### Development
54+
```bash
55+
bun run start # Start Expo dev server
56+
bun run ios # Launch on iOS device/simulator
57+
bun run android # Launch on Android device/emulator
58+
bun run web # Launch web version
59+
```
60+
61+
### Expo Commands
62+
```bash
63+
bunx expo install --fix # Fix SDK compatibility
64+
bunx expo run:ios # Build and run on iOS
65+
bunx expo run:android # Build and run on Android
66+
```
67+
68+
## Release Commands (EAS)
69+
70+
### Setup EAS
71+
```bash
72+
npm install -g eas-cli # Install EAS CLI
73+
eas login # Login to Expo account
74+
eas init # Initialize EAS in project
75+
eas build:configure # Create eas.json config
76+
```
77+
78+
### Development Builds
79+
```bash
80+
eas build --profile development --platform ios
81+
eas build --profile development --platform android
82+
```
83+
84+
### Production Builds
85+
```bash
86+
eas build --platform all # Build for both platforms
87+
eas build --platform ios --profile production
88+
eas build --platform android --profile production
89+
```
90+
91+
### Local Builds (for debugging)
92+
```bash
93+
eas build --platform ios --local
94+
eas build --platform android --local
95+
```
96+
97+
### App Store Submission
98+
```bash
99+
eas submit --platform ios # Submit to App Store
100+
eas submit --platform android # Submit to Google Play
101+
```
102+
103+
### Build Management
104+
```bash
105+
eas build:list # List all builds
106+
eas build:view [BUILD_ID] # View build details
107+
eas build:cancel [BUILD_ID] # Cancel running build
108+
```
109+
110+
## Key Features
111+
112+
- **Multi-Model Chat**: Access 20+ AI models (GPT, Claude, Gemini, etc.)
113+
- **Real-time Streaming**: Live AI responses via Server-Sent Events
114+
- **Authentication**: Email + OTP flow with secure token storage
115+
- **Chat History**: Full conversation history with sidebar navigation
116+
- **AI Applications**: Extensible app ecosystem (Article Summarizer)
117+
- **Theme Support**: Light/Dark mode with system integration
118+
- **Credit System**: Premium subscription with usage tracking
119+
- **Responsive Design**: Optimized for phones and tablets
120+
121+
## API Integration
122+
123+
- **Base URL**: `https://api.1ai.co`
124+
- **Provider**: OpenRouter API (not direct OpenAI)
125+
- **Authentication**: JWT Bearer tokens
126+
- **Storage**: Expo SecureStore for sensitive data
127+
128+
## Environment Requirements
129+
130+
- **iOS**: iOS 13+ (iPhone 6s and newer)
131+
- **Android**: Android 6+ (API level 23+)
132+
- **Development**:
133+
- Node.js 18+
134+
- Bun runtime
135+
- Expo CLI
136+
- iOS: Xcode 14+ (macOS only)
137+
- Android: Android Studio
138+
139+
## Release Prerequisites
140+
141+
- **iOS**: Apple Developer Program membership ($99/year)
142+
- **Android**: Google Play Developer account ($25 one-time)
143+
144+
## Configuration Files
145+
146+
- `app.json` - Expo app configuration
147+
- `eas.json` - EAS build profiles (created by `eas build:configure`)
148+
- `package.json` - Dependencies and scripts
149+
- `tsconfig.json` - TypeScript configuration

mobile/app.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"expo": {
3+
"name": "1ai",
4+
"slug": "1ai",
5+
"version": "1.0.0",
6+
"orientation": "portrait",
7+
"icon": "./assets/icon.png",
8+
"userInterfaceStyle": "light",
9+
"newArchEnabled": true,
10+
"scheme": "1ai",
11+
"splash": {
12+
"image": "./assets/splash-icon.png",
13+
"resizeMode": "contain",
14+
"backgroundColor": "#ffffff"
15+
},
16+
"ios": {
17+
"supportsTablet": true
18+
},
19+
"android": {
20+
"adaptiveIcon": {
21+
"foregroundImage": "./assets/adaptive-icon.png",
22+
"backgroundColor": "#ffffff"
23+
},
24+
"edgeToEdgeEnabled": true
25+
},
26+
"web": {
27+
"favicon": "./assets/favicon.png"
28+
},
29+
"plugins": [
30+
"expo-router",
31+
"expo-secure-store"
32+
]
33+
}
34+
}

mobile/app/(auth)/_layout.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Stack } from 'expo-router';
2+
3+
export default function AuthLayout() {
4+
return (
5+
<Stack screenOptions={{ headerShown: false }}>
6+
<Stack.Screen name="signin" />
7+
<Stack.Screen name="otp" />
8+
</Stack>
9+
);
10+
}

mobile/app/(auth)/otp.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { OtpScreen } from '../../src/screens/auth/OtpScreen';
2+
3+
export default OtpScreen;

mobile/app/(auth)/signin.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { SignInScreen } from '../../src/screens/auth/SignInScreen';
2+
3+
export default SignInScreen;

mobile/app/(main)/_layout.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { Stack } from 'expo-router';
2+
3+
export default function MainLayout() {
4+
return (
5+
<Stack
6+
screenOptions={{
7+
headerShown: false,
8+
}}
9+
>
10+
<Stack.Screen name="chat" />
11+
<Stack.Screen name="apps" />
12+
<Stack.Screen name="history" />
13+
<Stack.Screen name="pricing" />
14+
<Stack.Screen name="settings" />
15+
</Stack>
16+
);
17+
}

mobile/app/(main)/apps/_layout.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { Stack } from 'expo-router';
2+
3+
export default function AppsLayout() {
4+
return (
5+
<Stack
6+
screenOptions={{
7+
headerShown: false,
8+
}}
9+
>
10+
<Stack.Screen name="index" />
11+
<Stack.Screen name="article-summarizer" />
12+
</Stack>
13+
);
14+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { ArticleSummarizerScreen } from '../../../src/screens/apps/ArticleSummarizerScreen';
2+
3+
export default ArticleSummarizerScreen;

0 commit comments

Comments
 (0)