Skip to content

Commit 0ed16fb

Browse files
authored
Merge pull request #51 from LPK98/isira
Enhance UI, implement new features, and fix various issues
2 parents 03969e3 + 122788f commit 0ed16fb

49 files changed

Lines changed: 6917 additions & 1887 deletions

Some content is hidden

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

.github/workflows/codeql.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ on:
44
push:
55
branches:
66
- main
7+
- dev
78
pull_request:
89
branches:
910
- main
11+
- dev
1012
schedule:
1113
- cron: "0 3 * * 1"
1214

.github/workflows/eas-build.yml

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
name: EAS Build
2-
32
on:
43
push:
54
branches:
@@ -15,31 +14,25 @@ on:
1514
options:
1615
- preview
1716
- production
18-
1917
jobs:
2018
build:
2119
name: EAS Build
2220
runs-on: ubuntu-latest
23-
2421
steps:
2522
- name: Checkout repository
2623
uses: actions/checkout@v4
27-
2824
- name: Setup Node.js
2925
uses: actions/setup-node@v4
3026
with:
3127
node-version: 20
3228
cache: "npm"
33-
3429
- name: Install dependencies
3530
run: npm ci
36-
3731
- name: Setup Expo and EAS
3832
uses: expo/expo-github-action@v8
3933
with:
4034
eas-version: latest
41-
token: ${{ secrets.EXPO_TOKEN }}
42-
35+
token: ${{ secrets.EXPO_ROBOT_TOKEN }} # 👈 Changed
4336
- name: Set build profile and environment
4437
id: config
4538
run: |
@@ -50,9 +43,7 @@ jobs:
5043
else
5144
PROFILE=preview
5245
fi
53-
5446
echo "profile=$PROFILE" >> $GITHUB_OUTPUT
55-
5647
# Set API_URL based on profile
5748
if [ "$PROFILE" == "production" ]; then
5849
echo "API_URL=${{ secrets.PROD_API_URL }}" >> $GITHUB_ENV
@@ -61,21 +52,17 @@ jobs:
6152
echo "API_URL=${{ secrets.PREVIEW_API_URL }}" >> $GITHUB_ENV
6253
echo "APP_ENV=preview" >> $GITHUB_ENV
6354
fi
64-
6555
- name: Create .env file
6656
run: |
6757
echo "API_URL=${{ env.API_URL }}" >> .env.${{ env.APP_ENV }}
6858
echo "APP_ENV=${{ env.APP_ENV }}" >> .env.${{ env.APP_ENV }}
69-
7059
- name: Build on EAS
7160
run: eas build --platform android --profile ${{ steps.config.outputs.profile }} --non-interactive
72-
7361
- name: Notify success
7462
if: success()
7563
run: |
7664
echo "✅ Build succeeded for profile: ${{ steps.config.outputs.profile }}"
7765
echo "🔗 Check your build at https://expo.dev"
78-
7966
- name: Notify failure
8067
if: failure()
8168
run: |

README.md

Lines changed: 154 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,175 @@
1-
# Welcome to your Expo app 👋
1+
# CrimeLink Analyzer Mobile App
22

3-
This is an [Expo](https://expo.dev) project created with [`create-expo-app`](https://www.npmjs.com/package/create-expo-app).
3+
React Native + Expo mobile client for the CrimeLink Analyzer platform.
44

5-
## Get started
5+
This app connects to:
66

7-
1. Install dependencies
7+
- CrimeLink backend APIs (authentication, duty, leave, announcements, safety zones, weapon requests, officer location)
8+
- Firebase (chat/auth-related integrations)
9+
- Google Maps services (map and location features)
810

9-
```bash
10-
npm install
11-
```
11+
## Tech stack
1212

13-
2. Start the app
13+
- Expo SDK 54
14+
- React Native 0.81
15+
- Expo Router (file-based routing)
16+
- TypeScript
17+
- NativeWind
18+
- Axios
19+
- Firebase
1420

15-
```bash
16-
npx expo start
17-
```
21+
## Prerequisites
1822

19-
In the output, you'll find options to open the app in a
23+
Install the following before running:
2024

21-
- [development build](https://docs.expo.dev/develop/development-builds/introduction/)
22-
- [Android emulator](https://docs.expo.dev/workflow/android-studio-emulator/)
23-
- [iOS simulator](https://docs.expo.dev/workflow/ios-simulator/)
24-
- [Expo Go](https://expo.dev/go), a limited sandbox for trying out app development with Expo
25+
- Node.js 18+ (recommended: latest LTS)
26+
- npm 9+
27+
- Expo CLI (via npx, no global install required)
28+
- Android Studio (for Android emulator) or Xcode (for iOS simulator on macOS)
2529

26-
You can start developing by editing the files inside the **app** directory. This project uses [file-based routing](https://docs.expo.dev/router/introduction).
30+
For API calls to work, run the backend service and make sure its URL is reachable from your device/emulator.
2731

28-
## Get a fresh project
32+
## Environment configuration
2933

30-
When you're ready, run:
34+
This project reads environment values from:
35+
36+
- `.env.development`
37+
- `.env.preview`
38+
- `.env.production`
39+
40+
The selected file depends on `APP_ENV` (default is `development`).
41+
42+
### 1. Create your env file
43+
44+
From this folder, copy `.env.example` to one of the environment files:
45+
46+
```bash
47+
cp .env.example .env.development
48+
```
49+
50+
### 2. Fill required values
51+
52+
At minimum, set all of the following keys:
53+
54+
```env
55+
API_URL=
56+
FIREBASE_API_KEY=
57+
FIREBASE_AUTH_DOMAIN=
58+
FIREBASE_PROJECT_ID=
59+
FIREBASE_STORAGE_BUCKET=
60+
FIREBASE_MESSAGING_SENDER_ID=
61+
FIREBASE_APP_ID=
62+
```
63+
64+
Optional but recommended:
65+
66+
```env
67+
GOOGLE_MAPS_API_KEY=
68+
```
69+
70+
### API_URL tips
71+
72+
- Android emulator (calling backend on your machine):
73+
74+
```env
75+
API_URL=http://10.0.2.2:8080
76+
```
77+
78+
- iOS simulator:
79+
80+
```env
81+
API_URL=http://localhost:8080
82+
```
83+
84+
- Physical device (same Wi-Fi as your machine):
85+
86+
```env
87+
API_URL=http://<YOUR_LOCAL_IP>:8080
88+
```
89+
90+
## Install dependencies
91+
92+
```bash
93+
npm install
94+
```
95+
96+
## Run the app
97+
98+
### Start Expo dev server
99+
100+
Development environment (default):
101+
102+
```bash
103+
npx expo start
104+
```
105+
106+
Use a specific environment file:
31107

32108
```bash
33-
npm run reset-project
109+
APP_ENV=preview npx expo start
110+
APP_ENV=production npx expo start
34111
```
35112

36-
This command will move the starter code to the **app-example** directory and create a blank **app** directory where you can start developing.
113+
### Run on Android
114+
115+
```bash
116+
npm run android
117+
```
118+
119+
### Run on iOS (macOS only)
120+
121+
```bash
122+
npm run ios
123+
```
124+
125+
### Run on web
126+
127+
```bash
128+
npm run web
129+
```
130+
131+
## Lint
132+
133+
```bash
134+
npm run lint
135+
```
136+
137+
## Typical local workflow
138+
139+
1. Start backend service (default expected port: 8080).
140+
2. Configure `.env.development` with valid API/Firebase values.
141+
3. Install dependencies with `npm install`.
142+
4. Start Expo using `npx expo start`.
143+
5. Launch on emulator/device (`a` for Android, `i` for iOS in Expo terminal, or use npm scripts).
144+
145+
## Build and deployment notes
146+
147+
- App config values are injected through `app.config.js` into Expo `extra`.
148+
- If you use EAS Build, define the same env vars in your EAS environment. Missing values can cause runtime failures when reading config.
37149

38-
## Learn more
150+
## Project structure
39151

40-
To learn more about developing your project with Expo, look at the following resources:
152+
- `app/` route screens (Expo Router)
153+
- `src/api/` API client setup
154+
- `src/services/` feature service layers
155+
- `src/constants/` shared constants and runtime config
156+
- `src/components/` reusable UI and feature components
157+
- `src/context/` and `src/hooks/` app state and hooks
41158

42-
- [Expo documentation](https://docs.expo.dev/): Learn fundamentals, or go into advanced topics with our [guides](https://docs.expo.dev/guides).
43-
- [Learn Expo tutorial](https://docs.expo.dev/tutorial/introduction/): Follow a step-by-step tutorial where you'll create a project that runs on Android, iOS, and the web.
159+
## Troubleshooting
44160

45-
## Join the community
161+
- Error: Missing required app config
162+
- Check `.env.*` values and confirm you started the app with the intended `APP_ENV`.
163+
- Network request failed
164+
- Verify backend is running and `API_URL` is reachable from emulator/device.
165+
- Android physical device cannot reach backend
166+
- Use your machine local IP address, not `localhost`.
46167

47-
Join our community of developers creating universal apps.
168+
## Useful scripts
48169

49-
- [Expo on GitHub](https://github.com/expo/expo): View our open source platform and contribute.
50-
- [Discord community](https://chat.expo.dev): Chat with Expo users and ask questions.
170+
- `npx expo start` - Start Expo development server
171+
- `npm run android` - Build/run on Android
172+
- `npm run ios` - Build/run on iOS
173+
- `npm run web` - Run web target
174+
- `npm run lint` - Lint project
175+
- `npm run reset-project` - Reset scaffolded starter structure

app.config.js

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ const appName =
1616
export default {
1717
expo: {
1818
name: appName,
19-
slug: "CrimelinkAnalyzer_app",
19+
slug: "crimelink",
20+
owner: "isiraexpoeass-organization",
2021
version: "1.0.0",
2122
orientation: "portrait",
2223
icon: "./assets/images/logo.png",
@@ -27,9 +28,17 @@ export default {
2728

2829
ios: {
2930
supportsTablet: true,
31+
config: {
32+
googleMapsApiKey: process.env.GOOGLE_MAPS_API_KEY,
33+
},
3034
infoPlist: {
3135
NSLocationWhenInUseUsageDescription:
3236
"This app uses your location to show nearby places and reports.",
37+
NSLocationAlwaysAndWhenInUseUsageDescription:
38+
"Crime Link Analyzer needs your location even when the app is in the background during duty hours.",
39+
NSLocationAlwaysUsageDescription:
40+
"Crime Link Analyzer needs your location even when the app is in the background during duty hours.",
41+
UIBackgroundModes: ["location"],
3342
NSFaceIDUsageDescription:
3443
"Allow Crime Link Analyzer to use Face ID to authenticate you.",
3544
},
@@ -44,7 +53,18 @@ export default {
4453
},
4554
edgeToEdgeEnabled: true,
4655
predictiveBackGestureEnabled: false,
47-
permissions: ["ACCESS_FINE_LOCATION"],
56+
permissions: [
57+
"ACCESS_COARSE_LOCATION",
58+
"ACCESS_FINE_LOCATION",
59+
"ACCESS_BACKGROUND_LOCATION",
60+
"FOREGROUND_SERVICE",
61+
"FOREGROUND_SERVICE_LOCATION",
62+
],
63+
config: {
64+
googleMaps: {
65+
apiKey: process.env.GOOGLE_MAPS_API_KEY,
66+
},
67+
},
4868
package: "com.anonymous.CrimelinkAnalyzer_app",
4969
jsEngine: "hermes",
5070
},
@@ -70,6 +90,14 @@ export default {
7090
],
7191
"expo-secure-store",
7292
"expo-sqlite",
93+
[
94+
"expo-location",
95+
{
96+
isAndroidBackgroundLocationEnabled: true,
97+
isAndroidForegroundServiceEnabled: true,
98+
isIosBackgroundLocationEnabled: true,
99+
},
100+
],
73101
],
74102

75103
experiments: {
@@ -80,7 +108,7 @@ export default {
80108
extra: {
81109
router: {},
82110
eas: {
83-
projectId: "ab5e7b7b-eb2e-49f5-9a61-01529d4cae27",
111+
projectId: "cfc2ec4e-36f0-4781-a496-4c08aa07b763",
84112
},
85113
appEnv: ENV,
86114
apiUrl: process.env.API_URL,

0 commit comments

Comments
 (0)