Skip to content

Colota - Android GPS Location tracker

refactor(ui): retire the pre-redesign fallbacks and pin the token rules (#861)

Max Dietrichfa2bc4a9d53a
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index bca3b1f9..787269df 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -22,6 +22,6 @@ assignees: ""
- Device: [e.g. Pixel 7]
- Android version: [e.g. 14]
-- App version: [e.g. 1.0.0, FOSS/GMS]
+- App version: [as Settings > About prints it, e.g. 1.16.0 (48) · FOSS]
**Additional context** Any other context about the problem (e.g. server type, tracking profile).
diff --git a/apps/docs/docs/contributing.md b/apps/docs/docs/contributing.md
index b2dcb584..4f55bda6 100644
--- a/apps/docs/docs/contributing.md
+++ b/apps/docs/docs/contributing.md
@@ -6,53 +6,17 @@ sidebar_position: 8
## Reporting Issues
-1. Check if the issue already exists in [GitHub Issues](https://github.com/dietrichmax/colota/issues)
-2. Provide device info (model, Android version, Colota version)
-3. Include logs if possible: `adb logcat | grep Colota`
-4. Describe steps to reproduce
+1. Search [GitHub Issues](https://github.com/dietrichmax/colota/issues) first
+2. Name the device, the Android version and the Colota version as Settings > About prints it
+3. Attach a log file recorded while the problem happens, see [viewing and exporting logs](/docs/guides/troubleshooting#viewing-and-exporting-logs)
+4. Describe the steps to reproduce
## Pull Requests
-1. Fork the repository
-2. Create a feature branch: `git checkout -b feature/batch-export`
-3. Make your changes with clear commit messages
-4. Add or update tests for new/changed functions, hooks, and components
-5. Test on a real device
-6. Open a Pull Request
+1. Fork the repository and branch off `main`
+2. Build and run the app, see [Local Setup](/docs/development/local-setup)
+3. Keep to the [code conventions](/docs/development/local-setup#code-conventions) and cover the change with tests
+4. Test on a real device
+5. Open a Pull Request
-See the [Development Guide](/docs/development/architecture) for architecture details and [Local Setup](/docs/development/local-setup) for building from source.
-
-## Code Style
-
-- **TypeScript / React Native** for the UI layer
-- **Kotlin** for native Android modules
-- Follow existing patterns in the codebase
-- Use `logger` instead of `console.log` - import from `src/utils/logger`
-- Use `AppLogger` instead of `android.util.Log` in Kotlin code - import from `com.Colota.util.AppLogger`
-- Test both build flavors if your changes touch native code:
- ```bash
- cd apps/mobile/android
- ./gradlew assembleGmsDebug assembleFossDebug
- ```
-- Run before submitting:
- ```bash
- npm run lint -w @colota/mobile
- npx -w @colota/mobile tsc --noEmit
- npm test -w @colota/mobile
- cd apps/mobile/android && ./gradlew testGmsDebugUnitTest testFossDebugUnitTest
- ```
-
-## Project Structure
-
-```
-colota/
-├── apps/
-│ ├── mobile/ # React Native Android app
-│ │ ├── android/ # Native Kotlin modules
-│ │ └── src/ # React Native TypeScript
-│ └── docs/ # Docusaurus documentation
-├── packages/
-│ └── shared/ # Shared colors and types
-├── screenshots/ # App screenshots
-└── package.json # Monorepo root
-```
+[Architecture](/docs/development/architecture) covers the native modules and the tracking flow.
diff --git a/apps/docs/docs/development/local-setup.md b/apps/docs/docs/development/local-setup.md
index c751335d..7472b2aa 100644
--- a/apps/docs/docs/development/local-setup.md
+++ b/apps/docs/docs/development/local-setup.md
@@ -186,6 +186,14 @@ npm run lint -w @colota/mobile # ESLint
npx -w @colota/mobile tsc --noEmit # TypeScript type check
```
+## Code Conventions
+
+- TypeScript and React Native for the UI layer, Kotlin for the native modules
+- Follow the patterns the surrounding code already uses
+- Use `logger` from `src/utils/logger` instead of `console.log`, and `AppLogger` from `com.Colota.util.AppLogger` instead of `android.util.Log`
+- Cover every changed function, hook and component with a test
+- Run both flavors' unit tests and both debug builds when a change touches native code
+
## Common Tasks
### Adding a New Screen
diff --git a/apps/docs/docs/faq.md b/apps/docs/docs/faq.md
index f33d248d..5baa71a0 100644
--- a/apps/docs/docs/faq.md
+++ b/apps/docs/docs/faq.md
@@ -44,19 +44,19 @@ To ensure modifications stay open source, especially server-side components.
### Can I use maps without internet?
-Yes. Go to **Settings → Offline Maps** to download map areas to your device. Pan and zoom the map to frame the area you want, give it a name, and tap **Download**. Downloaded tiles persist across app restarts and work without any network connection. See [Offline Maps](/docs/guides/offline-maps) for details.
+Yes. Go to **Settings → Offline maps** to download map areas to your device. Pan and zoom the map to frame the area you want, give it a name, and tap **Download area**. Downloaded tiles persist across app restarts and work without any network connection. See [Offline maps](/docs/guides/offline-maps) for details.
### Can I export my location history?
-Yes. Go to **Settings → Export Locations** to export in CSV, GeoJSON, GPX or KML, or export a single day's trips from the **History** tab. **Settings → Auto-Export** writes the same formats to a folder you pick on a daily, weekly or monthly schedule. See [Data Export](/docs/guides/data-export) for details.
+Yes. Go to **Settings → Export locations** to export in CSV, GeoJSON, GPX or KML, or export a single day's trips from the **History** tab. **Settings → Auto-export** writes the same formats to a folder you pick on a daily, weekly or monthly schedule. See [Data Export](/docs/guides/data-export) for details.
### Can I import location history from another app?
-Yes. Go to **Settings → Import Locations** and pick a file. Colota reads GeoJSON, Google Timeline (both the legacy Takeout export and the new on-device one), GPX, KML and CSV, detects the format itself, and shows a preview with the duplicate and invalid counts before anything is written. Imports are additive and duplicates are skipped, so re-importing the same file changes nothing. See [Data Import](/docs/guides/data-import) for details.
+Yes. Go to **Settings → Import locations** and pick a file. Colota reads GeoJSON, Google Timeline (both the legacy Takeout export and the new on-device one), GPX, KML and CSV, detects the format itself, and shows a preview with the duplicate and invalid counts before anything is written. Imports are additive and duplicates are skipped, so re-importing the same file changes nothing. See [Data Import](/docs/guides/data-import) for details.
### Can I back up everything and move to a new device?
-Yes. Go to **Settings → Backup & Restore** to create a single password-encrypted `.colota` file containing your locations, settings, geofences and credentials. Restore it on the new device with the same password. See [Backup & Restore](/docs/guides/backup-restore) for details.
+Yes. Go to **Settings → Backup & restore** to create a single password-encrypted `.colota` file containing your locations, settings, geofences and credentials. Restore it on the new device with the same password. See [Backup & restore](/docs/guides/backup-restore) for details.
### I forgot my backup password, can I recover it?
@@ -101,10 +101,10 @@ On Android 17+, apps need the Local Network Access permission to connect to loca
### Does Colota support mutual TLS (mTLS)?
-Yes. Import a PKCS12 (`.p12` / `.pfx`) bundle in **Settings → Connection → Authentication & Headers → Client Certificate (mTLS)**. The private key is stored in the OS keystore and the password isn't saved. For self-signed server certificates, import a CA in the same screen so trust is scoped to Colota only - no need to install a CA at the OS level. See the [mTLS guide](/docs/configuration/mtls) for details.
+Yes. Pick a device certificate or import a PKCS12 (`.p12` / `.pfx`) bundle in **Settings → Connection → Client certificate**. The private key is stored in the OS keystore and the password isn't saved. For self-signed server certificates, import a CA in the same screen so trust is scoped to Colota only - no need to install a CA at the OS level. See the [mTLS guide](/docs/configuration/mtls) for details.
### I was using a CA installed in Android Settings for Colota - does it still work?
-No, not since 1.9.0. Colota only trusts system CAs and an optional CA you import in-app via mTLS Settings - user-installed device CAs are deliberately ignored. If sync starts failing with `Server certificate is not trusted...` after upgrading, you'll need to re-import your CA through the new in-app screen.
+No, not since 1.9.0. Colota only trusts system CAs and an optional CA you import in-app under Connection → Client certificate - user-installed device CAs are deliberately ignored. If sync starts failing with `Server certificate is not trusted...` after upgrading, you'll need to re-import your CA through the new in-app screen.
-The migration is one-time: open Colota → Settings → Connection → Authentication & Headers → Client Certificate (mTLS) → Trusted Server CA → Import CA. The same `.crt` / `.pem` you originally installed in Android Settings works. See [Migrating from earlier behavior](/docs/configuration/mtls#trusting-a-privateinternal-server-ca) for the full walkthrough.
+The migration is one-time: open Colota → Settings → Connection → Client certificate → Trusted server CA → Import CA. The same `.crt` / `.pem` you originally installed in Android Settings works. See [Migrating from earlier behavior](/docs/configuration/mtls#trusting-a-privateinternal-server-ca) for the full walkthrough.
diff --git a/apps/docs/docs/guides/battery-optimization.md b/apps/docs/docs/guides/battery-optimization.md
index d1bdf7b0..edb9f6fa 100644
--- a/apps/docs/docs/guides/battery-optimization.md
+++ b/apps/docs/docs/guides/battery-optimization.md
@@ -12,7 +12,7 @@ Settings and tips to reduce battery usage without losing GPS fixes.
- **Notification updates**: redrawn when the status text changes, otherwise at most once a minute while fixes arrive
- **Batch processing**: 50 items per batch, 10 concurrent network requests
- **Smart sync**: Only syncs when queue has items and network is available
-- **Battery critical shutdown & auto-resume**: Stops tracking below 5% when unplugged (the dashboard shows "Tracking stopped" and a notification reads "Battery fell below 5% · resumes when charging"), then automatically resumes once you connect a charger - or on the next reboot if already plugged in. A stop you triggered yourself is never auto-resumed
+- **Battery critical shutdown & auto-resume**: Stops tracking below 5% when unplugged (the dashboard shows "Tracking stopped" and a notification reads "Battery fell below 5% · resumes when charging"), then automatically resumes once you connect a charger or on the next reboot if already plugged in. A stop you triggered yourself is never auto-resumed
## Tips
diff --git a/apps/docs/docs/guides/troubleshooting.md b/apps/docs/docs/guides/troubleshooting.md
index d7815f53..b6e0a01f 100644
--- a/apps/docs/docs/guides/troubleshooting.md
+++ b/apps/docs/docs/guides/troubleshooting.md
@@ -46,21 +46,21 @@ Colota starts a new trip after a 15-minute gap in fixes, so a long stop can brea
## Server sync not working
1. Check endpoint URL format - must be `https://` for public endpoints, or `http://` for private/local addresses
-2. Use the **Test Connection** button in settings
+2. Use **Test connection** under Settings > Connection; the Server card above it says what sync is doing now and, when it fails, the server's own sentence
3. Check server logs for incoming requests
4. Verify network connectivity
-5. Check the queue count in **Data Management**
+5. Check the queue count in **Data management**
**Common causes**: Wrong URL, HTTPS required for public endpoints, expired SSL certificate, incorrect authentication, mismatched field mapping, self-signed / private-CA server cert (see the [mTLS guide](/docs/configuration/mtls) for trust setup), **Sync Condition** restricting uploads to a specific network (Wi-Fi, SSID or VPN), missing local network permission on Android 16+.
-### Test Connection error messages
+### Test connection error messages
-If **Test Connection** fails, the message points at the specific layer that broke:
+If **Test connection** reads **Not reachable**, the sentence under it points at the specific layer that broke:
| Message | What it means | Fix |
| --- | --- | --- |
-| `Server certificate is not trusted (self-signed or unknown CA)` | TLS layer: Colota can't validate the server's certificate chain | Import your CA via mTLS Settings -> Trusted Server CA, or use a publicly-trusted cert. User-installed CAs from Android Settings are not honored. |
-| `Server requires a client certificate (mTLS) but none is configured` | TLS layer: the server demanded mTLS, Colota didn't present one | Import a `.p12` in mTLS Settings -> Client Certificate |
+| `Server certificate is not trusted (self-signed or unknown CA)` | TLS layer: Colota can't validate the server's certificate chain | Import your CA under Connection -> Client certificate -> Trusted server CA, or use a publicly trusted cert. User-installed CAs from Android Settings are not honored. |
+| `Server requires a client certificate (mutual TLS) but none is configured` | TLS layer: the server demanded a client certificate, Colota didn't present one | Add one under Connection -> Client certificate |
| `Server rejected the client certificate` | TLS layer: cert was sent but rejected (wrong CA, expired, revoked) | Verify the cert matches what your reverse proxy expects |
| `Incorrect password for client certificate` | Import-time: the password doesn't unlock the `.p12` | Re-import with the correct password |
| `Hostname not verified` | TLS layer: server cert doesn't list the hostname/IP you connected to | Reissue the server cert with a SAN that includes your hostname/IP |
@@ -70,29 +70,28 @@ If **Test Connection** fails, the message points at the specific layer that brok
## Viewing and exporting logs
-**Settings > Logging** shows app log entries in two tabs.
+**Settings > Logging** records a log file and hands it over as one file.
-### Live tab
+### Recording a log
-This is the easiest way to view and share recent logs.
+1. Open **Settings > Logging** and turn on **Record a log file**
+2. Use the app until the problem happens again. Recording keeps going across restarts, so this can take days
+3. Come back and tap **Save log file...** - pick a folder
+4. Open a bug report at [github.com/dietrichmax/colota/issues](https://github.com/dietrichmax/colota/issues/new) and attach the saved `colota-log-*.txt`
-1. Open **Settings > Logging** (the Live tab opens by default)
-2. Scroll through recent entries - the chips at the top filter by severity (`DEBUG` / `INFO` / `WARN` / `ERROR`)
-3. Tap the share icon (top right) to save a text file containing the recent entries plus your app version and device info
+Step 2 is the one people skip. A log saved without reproducing the problem contains everything except the thing being reported.
-### File tab
+The saved file is one timeline: your app version, flavor and device at the top, then the native and app log lines interleaved by the time they happened. A marker says where the app log's own coverage begins, because it only spans the current app session while the recorded file spans restarts.
-For bugs that take a while to happen:
+### Reading it first
-1. Open **Settings > Logging** and switch to the **File** tab
-2. Turn on **Persistent file logging**
-3. Use the app until the problem happens again
-4. Come back to the **File** tab and tap **Export log file...** - pick where to save it
-5. Open a bug report at [github.com/dietrichmax/colota/issues](https://github.com/dietrichmax/colota/issues/new) and attach the saved `colota-log-*.txt`
+**Read the log** opens a preview of the most recent lines, newest first. Search filters on the message, and the chips set the lowest level shown, each carrying its own count so you can see there are four errors without selecting Errors.
-**Heads up:** log files can contain your location coordinates. Please check the content of the file before sharing it.
+The preview shows the recorded file while recording is on, and the system log's last few minutes while it is off. It shows the most recent lines only, so a long capture holds far more than you can read here.
-The file grows the whole time logging is on. Tap **Clear log files** on the **File** tab to reset it.
+**Heads up:** the file names your geofences, your tracking profiles and your server host. Colota writes no coordinates into it, but a rejected upload can carry your server's reply, which may. Read it before you attach it.
+
+The file grows the whole time recording is on. **Delete the log file** clears it and, if recording is still on, starts a fresh one.
## Debugging with adb logcat
@@ -126,19 +125,19 @@ If sync to a local server stopped working after an Android update:
1. Go to **Android Settings > Apps > Colota > Permissions**
2. On Android 17+: Grant the **Local network access** permission
3. On Android 16: Grant the **Nearby devices** permission
-4. Use the **Test Connection** button to verify
+4. Use **Test connection** to verify
If you denied the permission and the system no longer shows the dialog, reset it from Android Settings.
## Locations not syncing on certain networks
-If **Sync Only On** is set to Wi-Fi, a specific SSID or VPN, uploads are skipped when the condition is not met. Locations continue to be recorded and queued locally - they sync automatically when the condition is satisfied.
+If **Sync only on** is set to Wi-Fi or Ethernet, a specific Wi-Fi network or VPN, uploads are skipped when the condition is not met. Locations continue to be recorded and queued locally - they sync automatically when the condition is satisfied.
-To change: **Settings > Advanced Settings > Network Settings > Sync Only On**.
+To change: **Settings > Tracking & sync > Sync only on**.
## Auto-export not working
-- Verify a directory is selected in **Settings > Auto-Export**
+- Verify a directory is selected in **Settings > Auto-export**
- Check that the toggle is enabled
- The first export fires at the configured time, not on enable. Tap **Export Now** to confirm the pipeline works without waiting
- Doze mode can delay an alarm by up to ~15 minutes - if exports are running but a few minutes late, that's expected
@@ -150,9 +149,9 @@ To change: **Settings > Advanced Settings > Network Settings > Sync Only On**.
## Database growing too large
-- Use **Clear Sent History** to remove synced locations
-- Use **Delete Older Than X Days** for cleanup
-- Export data first if you want to keep it
-- Use **Vacuum Database** to reclaim space after deletions
+- Use **Delete synced locations** to remove what your server already holds
+- Use **Delete older than** for an age cutoff, which ignores sync state
+- Back up or export first if you want to keep it
+- Use **Compact database** to reclaim space after deleting trips or points, which leave gaps nothing else reclaims
**Size reference**: ~200 bytes per location, ~2 MB per 10,000 locations.
diff --git a/apps/docs/docs/introduction.md b/apps/docs/docs/introduction.md
index d51b2a7e..1f47947f 100644
--- a/apps/docs/docs/introduction.md
+++ b/apps/docs/docs/introduction.md
@@ -12,58 +12,59 @@ Colota is a self-hosted GPS tracking app for Android. It sends your location to
- **Self-Hosted** - Send location data to your own server. Works with Dawarich, GeoPulse, Home Assistant, OwnTracks, Overland, PhoneTrack, Reitti, Traccar or any custom backend.
- **Privacy First** - No analytics, no telemetry, no third-party SDKs. Open source (AGPL-3.0).
- **Works Offline** - Fully functional without a server. Export as CSV, GeoJSON, GPX, or KML.
-- **Offline Maps** - Download map areas to your device for use without an internet connection.
+- **Offline maps** - Download map areas to your device for use without an internet connection.
- **Scheduled Export** - Automatic daily, weekly or monthly exports to a local directory with file retention management.
- **Encrypted Backup** - Single password-encrypted archive of locations, settings, geofences and credentials.
- **Location History** - View daily summaries, trip segmentation with manual merge and split, calendar with activity dots, per-trip export and per-point notes or deletion.
- **Import Your History** - Bring in existing tracks from GeoJSON, Google Timeline, GPX, KML or CSV.
- **Reliable Tracking** - Foreground service, auto-start on boot and exponential backoff retry.
- **Geofencing** - Pause zones that stop recording locations. Optionally stop GPS entirely when on WiFi or when the device is motionless.
-- **Tracking Profiles** - Automatically adjust GPS interval, distance filter and sync settings based on conditions like charging, Android Auto, speed or stationary detection.
+- **Tracking profiles** - Automatically adjust GPS interval, distance filter and sync settings based on conditions like charging, Android Auto, speed or stationary detection.
- **Flexible Sync** - Instant, batch, Wi-Fi only or offline modes.
- **Display Settings** - Choose between metric and imperial units, 12h or 24h time format. Auto-detected from device locale on first use.
- **App Shortcuts** - Long-press the app icon to start or stop tracking from the home screen. Compatible with automation apps like Tasker and Samsung Routines.
- **Quick Setup** - Configure devices via `colota://setup` deep links or QR codes.
-- **Authentication** - Basic Auth, Bearer Token or custom headers. Optional mutual TLS (mTLS) with a PKCS12 client certificate stored in Android Keystore.
-- **Dark Mode** - Full light and dark theme support.
+- **Authentication** - Basic auth, bearer token or custom headers. Optional mutual TLS (mTLS) with a PKCS12 client certificate stored in Android Keystore.
+- **Dark Mode** - Full light and dark theme support, optionally coloured from the Android wallpaper.
## App Screens
-Colota has twenty-five screens, each focused on a specific task:
+Colota has twenty-seven screens, each focused on a specific task:
| Screen | Purpose |
| --- | --- |
| **Dashboard** | Live map with current coordinates, today's track overlay, tracking controls, database stats, and geofence status |
-| **Settings** | Hub linking to Connection, Tracking and Sync, API Field Mapping, Tracking Profiles, Appearance and data/about screens |
+| **Settings** | The hub: Tracking, Display, Data, Help and About, each row showing the value it holds |
| **Connection** | Server endpoint URL, offline mode toggle and connection test |
-| **Tracking & Sync** | GPS polling interval, distance filter, accuracy threshold and sync strategy preset |
-| **Appearance** | Light/dark theme, unit system, time format and custom map tile URLs |
-| **API Config** | Endpoint field mapping with templates for Dawarich, GeoPulse, Overland, OwnTracks, PhoneTrack, Reitti, Traccar or custom backends |
-| **Auth Settings** | Endpoint authentication (None, Basic Auth, Bearer Token) and custom HTTP headers |
-| **mTLS Settings** | Client certificate (mTLS) import or KeyChain selection and trusted server CA management |
+| **Tracking & sync** | GPS polling interval, distance filter, accuracy threshold and sync strategy preset |
+| **Appearance** | Light/dark theme, wallpaper colors, unit system, time format and custom map tile URLs |
+| **Request format** | How the request is shaped: the backend template, the HTTP method, the field names and any custom fields |
+| **Backend template** | Pick the backend Colota formats its payload for, each option describing what it sends |
+| **Authentication** | Endpoint authentication (None, Basic auth, Bearer token) and custom HTTP headers |
+| **Client certificate** | Client certificate from the device store or a .p12, and the trusted server CA |
| **Geofences** | Create pause zones by tapping the map, view all zones with pause option indicators |
| **Geofence Editor** | Configure a zone: name, radius, record pause, WiFi pause, motionless pause and timeout, stationary heartbeat |
-| **Offline Maps** | Download map areas to the device for use without an internet connection |
-| **Tracking Profiles** | Create and manage condition-based profiles that automatically adjust tracking settings |
+| **Place zone** | Pick a zone's centre on a map with its radius drawn live, handing it back to the editor |
+| **Offline maps** | Download map areas to the device for use without an internet connection |
+| **Tracking profiles** | Create and manage condition-based profiles that automatically adjust tracking settings |
| **Profile Editor** | Configure profile name, condition trigger, GPS interval, distance filter, sync interval, priority, and deactivation delay |
| **Location History** | Browse recorded locations on a track map with calendar day picker and trip-colored segments, view segmented trips with per-trip stats; tap a point to add a note or delete it |
-| **Trip Detail** | Full trip view with dedicated map, stats grid (distance, duration, avg speed, elevation), speed and elevation profile charts, export, and delete |
-| **Location Summary** | Aggregated stats (total distance, trips, active days, avg distance) for selectable periods with daily breakdown and tap-to-inspect navigation |
-| **Export Locations** | Export tracked locations as CSV, GeoJSON, GPX, or KML |
-| **Import Locations** | Import tracks from GeoJSON, Google Timeline, GPX, KML or CSV with a preview before committing |
-| **Auto-Export** | Configure scheduled exports: directory, format, frequency, time of day (with weekday or day-of-month for weekly/monthly), export range and file retention |
-| **Data Management** | Clear sent history, delete old data, vacuum the database |
-| **Backup & Restore** | Create or restore a single password-encrypted `.colota` archive of all data (locations, settings, geofences, credentials) |
+| **Trip Detail** | Full trip view with dedicated map, stat rows (distance, duration, avg speed, elevation), speed and elevation profile charts, export and delete |
+| **Location Summary** | Distance, trips, active days and average per day for a week or a month, stepped with chevrons, with each day opening in Location History |
+| **Export & import** | Write locations to CSV, GeoJSON, GPX or KML, and read them back from GeoJSON, Google Timeline, GPX, KML or CSV with a preview before committing |
+| **Auto-export** | Configure scheduled exports: directory, format, frequency, time of day (with weekday or day-of-month for weekly/monthly), export range and file retention |
+| **Data management** | Delete by sync state or age, compact the database |
+| **Backup & restore** | Create or restore a single password-encrypted `.colota` archive of all data (locations, settings, geofences, credentials) |
| **Setup Import** | Confirmation screen for deep link configuration imports (`colota://setup`) |
-| **Share Setup** | Build a `colota://setup` link or QR code from selected settings to configure another device |
+| **Share setup** | Build a `colota://setup` link or QR code from selected settings to configure another device |
| **Logging** | In-app activity log viewer (level filtering, search, export) plus opt-in persistent file logging |
-| **About** | App version, device info, links to repository and privacy policy |
+| **About** | Version and build, then the privacy policy, licence and source code |
## Screenshots
import ScreenshotGallery from '@site/src/components/ScreenshotGallery'
-<ScreenshotGallery screenshots={[ { src: "/img/screenshots/Dashboard.png", label: "Dashboard" }, { src: "/img/screenshots/Settings.png", label: "Settings" }, { src: "/img/screenshots/ApiFieldMapping.png", label: "API Config" }, { src: "/img/screenshots/Authentication.png", label: "Auth Settings" }, { src: "/img/screenshots/Geofences.png", label: "Geofences" }, { src: "/img/screenshots/GeofenceEditor.png", label: "Geofence Editor" }, { src: "/img/screenshots/OfflineMaps.png", label: "Offline Maps" }, { src: "/img/screenshots/TrackingProfiles.png", label: "Profile Editor" }, { src: "/img/screenshots/LocationHistory.png", label: "Location History" }, { src: "/img/screenshots/TripDetails.png", label: "Trip Detail" }, { src: "/img/screenshots/Trips.png", label: "Trips" }, { src: "/img/screenshots/ExportData.png", label: "Export" }, { src: "/img/screenshots/AutoExport.png", label: "Auto-Export" }, { src: "/img/screenshots/DataManagement.png", label: "Data Management" }, { src: "/img/screenshots/DarkMode.png", label: "Dark Mode" }, ]} />
+<ScreenshotGallery screenshots={[ { src: "/img/screenshots/Dashboard.png", label: "Dashboard" }, { src: "/img/screenshots/Settings.png", label: "Settings" }, { src: "/img/screenshots/ApiFieldMapping.png", label: "Request format" }, { src: "/img/screenshots/Authentication.png", label: "Auth Settings" }, { src: "/img/screenshots/Geofences.png", label: "Geofences" }, { src: "/img/screenshots/GeofenceEditor.png", label: "Geofence Editor" }, { src: "/img/screenshots/OfflineMaps.png", label: "Offline maps" }, { src: "/img/screenshots/TrackingProfiles.png", label: "Profile Editor" }, { src: "/img/screenshots/LocationHistory.png", label: "Location History" }, { src: "/img/screenshots/TripDetails.png", label: "Trip Detail" }, { src: "/img/screenshots/Trips.png", label: "Trips" }, { src: "/img/screenshots/ExportData.png", label: "Export" }, { src: "/img/screenshots/AutoExport.png", label: "Auto-export" }, { src: "/img/screenshots/DataManagement.png", label: "Data management" }, { src: "/img/screenshots/DarkMode.png", label: "Dark Mode" }, ]} />
## Architecture
diff --git a/apps/docs/docs/security.md b/apps/docs/docs/security.md
index 08921783..38816280 100644
--- a/apps/docs/docs/security.md
+++ b/apps/docs/docs/security.md
@@ -15,7 +15,7 @@ HTTPS is enforced for all public server endpoints. HTTP is only allowed for priv
Colota's HTTPS chain validation accepts two trust sources, either of which is sufficient:
1. **System CAs** that ship with Android - the normal public web (Let's Encrypt, DigiCert, etc.)
-2. **In-app imported CA** added via Settings → Connection → Authentication & Headers → Client Certificate (mTLS) → Trusted Server CA. One slot, trusted only by Colota.
+2. **In-app imported CA** added via Settings → Connection → Client certificate → Trusted server CA. One slot, trusted only by Colota.
User-installed device CAs (from Android Settings -> Encryption & credentials) are not honored, so malware or a coerced profile that plants a CA in the device store can't intercept Colota's sync. Self-hosted users running a private CA should import it via the in-app path.
@@ -37,14 +37,14 @@ The database is not accessible to other apps (standard Android sandboxing).
## Encrypted Backups
-Colota can produce a single password-encrypted archive of your full dataset (locations, settings, geofences, credentials) for off-device storage or device migration. See the [Backup & Restore guide](/docs/guides/backup-restore) for the user-facing flow. The relevant security properties:
+Colota can produce a single password-encrypted archive of your full dataset (locations, settings, geofences, credentials) for off-device storage or device migration. See the [Backup & restore guide](/docs/guides/backup-restore) for the user-facing flow. The relevant security properties:
- **Cipher**: AES-256-GCM, chunked at 1 MiB of plaintext per chunk. Each chunk's GCM tag binds the file header as additional authenticated data, so any flip in the header (KDF parameters, salt, nonce prefix) invalidates the very first tag.
- **Key derivation**: Argon2id with 64 MiB memory, 3 iterations and 1 lane on standard devices; 32 MiB on devices flagged as low-RAM by Android. The salt is 32 bytes from `SecureRandom`, fresh per backup.
- **Password floor**: 12 characters, with a strength meter that enforces ~50 bits of entropy (passwords with sequential runs or fewer than 4 distinct characters are capped).
- **No recovery**: forgotten password means an unreadable file. There is no escrow, recovery code or developer override.
-- **Credential handling**: the auth credentials Colota uses to talk to your tracking endpoint (Basic Auth username/password, Bearer token, custom HTTP headers) are extracted from `EncryptedSharedPreferences` and written as plaintext **inside** the encrypted container. They are protected by the backup password, not by the device's hardware-backed key. The blast radius equals whatever your server lets those credentials do - a credential limited to writing locations caps damage at fake location posts; a credential tied to a user with broader privileges, or any token with more scope than the endpoint actually needs, gives the attacker that same scope. Configure Colota with the minimum permission its endpoint requires. On restore the credentials are re-wrapped under the destination device's key.
-- **mTLS**: the user-imported Trusted Server CA (public cert bytes) is included so a self-signed server stays reachable after restore. The mTLS **client certificate is not backed up** by design - the private key lives in the Android KeyChain (often hardware-backed) and cannot leave the source device. Re-import the `.p12` on the destination device after restore.
+- **Credential handling**: the auth credentials Colota uses to talk to your tracking endpoint (Basic auth username/password, bearer token, custom HTTP headers) are extracted from `EncryptedSharedPreferences` and written as plaintext **inside** the encrypted container. They are protected by the backup password, not by the device's hardware-backed key. The blast radius equals whatever your server lets those credentials do - a credential limited to writing locations caps damage at fake location posts; a credential tied to a user with broader privileges, or any token with more scope than the endpoint actually needs, gives the attacker that same scope. Configure Colota with the minimum permission its endpoint requires. On restore the credentials are re-wrapped under the destination device's key.
+- **mTLS**: the user-imported Trusted server CA (public cert bytes) is included so a self-signed server stays reachable after restore. The mTLS **client certificate is not backed up** by design - the private key lives in the Android KeyChain (often hardware-backed) and cannot leave the source device. Re-import the `.p12` on the destination device after restore.
- **Format independence**: the on-disk format is FOSS (BouncyCastle, no Tink/Google dependency) and stays stable independently of the in-app `EncryptedSharedPreferences` implementation.
The format is fully documented in [`BackupFormat.kt`](https://github.com/dietrichmax/colota/blob/main/apps/mobile/android/app/src/main/java/com/colota/backup/BackupFormat.kt).
diff --git a/apps/mobile/android/app/build.gradle b/apps/mobile/android/app/build.gradle
index b0c88f43..8c67ae1a 100644
--- a/apps/mobile/android/app/build.gradle
+++ b/apps/mobile/android/app/build.gradle
@@ -97,14 +97,6 @@ android {
versionCode 49
versionName "1.17.0"
- // Expose build config to the module
- buildConfigField "int", "MIN_SDK_VERSION", "${rootProject.ext.minSdkVersion}"
- buildConfigField "int", "TARGET_SDK_VERSION", "${rootProject.ext.targetSdkVersion}"
- buildConfigField "int", "COMPILE_SDK_VERSION", "${rootProject.ext.compileSdkVersion}"
- buildConfigField "String", "BUILD_TOOLS_VERSION", "\"${rootProject.ext.buildToolsVersion}\""
- buildConfigField "String", "KOTLIN_VERSION", "\"${rootProject.ext.kotlinVersion}\""
- buildConfigField "String", "NDK_VERSION", "\"${rootProject.ext.ndkVersion}\""
-
// Strip Build IDs for reproducible builds (IzzyOnDroid/F-Droid)
externalNativeBuild {
cmake {
diff --git a/apps/mobile/android/app/src/main/java/com/colota/bridge/BuildConfigModule.kt b/apps/mobile/android/app/src/main/java/com/colota/bridge/BuildConfigModule.kt
index 8b9aa7ba..bb7e9a4d 100644
--- a/apps/mobile/android/app/src/main/java/com/colota/bridge/BuildConfigModule.kt
+++ b/apps/mobile/android/app/src/main/java/com/colota/bridge/BuildConfigModule.kt
@@ -24,12 +24,6 @@ class BuildConfigModule(reactContext: ReactApplicationContext) :
"VERSION_NAME" to BuildConfig.VERSION_NAME,
"VERSION_CODE" to BuildConfig.VERSION_CODE,
"FLAVOR" to BuildConfig.FLAVOR,
- "MIN_SDK_VERSION" to BuildConfig.MIN_SDK_VERSION,
- "TARGET_SDK_VERSION" to BuildConfig.TARGET_SDK_VERSION,
- "BUILD_TOOLS_VERSION" to BuildConfig.BUILD_TOOLS_VERSION,
- "COMPILE_SDK_VERSION" to BuildConfig.COMPILE_SDK_VERSION,
- "KOTLIN_VERSION" to BuildConfig.KOTLIN_VERSION,
- "NDK_VERSION" to BuildConfig.NDK_VERSION,
"APP_LANGUAGE" to Locale.getDefault().toLanguageTag()
)
}
diff --git a/apps/mobile/android/app/src/main/java/com/colota/bridge/DebugSeedData.kt b/apps/mobile/android/app/src/main/java/com/colota/bridge/DebugSeedData.kt
deleted file mode 100644
index 74ee9258..00000000
--- a/apps/mobile/android/app/src/main/java/com/colota/bridge/DebugSeedData.kt
+++ /dev/null
@@ -1,118 +0,0 @@
-/**
- * Copyright (C) 2026 Max Dietrich
- * Licensed under the GNU AGPLv3. See LICENSE in the project root for details.
- */
-
-package com.Colota.bridge
-
-import com.Colota.data.DatabaseHelper
-
-/**
- * Debug-only DB seed: 7 days of plausible Berlin tracks
- * (home -> supermarket -> gym -> home, plus an occasional evening walk)
- * so the UI has something to render in development builds.
- */
-object DebugSeedData {
-
- // Home: Boxhagener Platz, Friedrichshain
- // Supermarket: REWE on Warschauer Str (~1.2 km south)
- // Gym: FitX Ostkreuz (~1.5 km SE of supermarket)
- // Columns: lat, lon, alt, speed, accuracy
- private val TRIP_HOME_TO_SUPERMARKET = arrayOf(
- doubleArrayOf(52.51420, 13.45830, 38.0, 0.2, 4.0),
- doubleArrayOf(52.51390, 13.45780, 37.0, 3.5, 5.0),
- doubleArrayOf(52.51310, 13.45650, 36.0, 8.2, 4.0),
- doubleArrayOf(52.51220, 13.45490, 35.0, 11.5, 3.5),
- doubleArrayOf(52.51120, 13.45340, 35.0, 12.8, 3.0),
- doubleArrayOf(52.50980, 13.45220, 34.0, 10.1, 4.0),
- doubleArrayOf(52.50870, 13.45100, 34.0, 8.7, 3.5),
- doubleArrayOf(52.50760, 13.44950, 33.0, 11.3, 3.0),
- doubleArrayOf(52.50650, 13.44820, 33.0, 9.4, 4.0),
- doubleArrayOf(52.50560, 13.44710, 33.0, 6.2, 4.5),
- doubleArrayOf(52.50490, 13.44650, 32.0, 2.1, 5.0),
- doubleArrayOf(52.50460, 13.44630, 32.0, 0.3, 4.0),
- )
-
- private val TRIP_SUPERMARKET_TO_GYM = arrayOf(
- doubleArrayOf(52.50460, 13.44630, 32.0, 0.5, 4.0),
- doubleArrayOf(52.50430, 13.44700, 32.0, 5.8, 4.5),
- doubleArrayOf(52.50380, 13.44890, 33.0, 10.2, 3.5),
- doubleArrayOf(52.50340, 13.45120, 33.0, 12.5, 3.0),
- doubleArrayOf(52.50310, 13.45380, 34.0, 11.8, 3.5),
- doubleArrayOf(52.50270, 13.45640, 34.0, 9.6, 4.0),
- doubleArrayOf(52.50230, 13.45900, 35.0, 8.3, 4.0),
- doubleArrayOf(52.50180, 13.46100, 35.0, 5.1, 4.5),
- doubleArrayOf(52.50150, 13.46250, 35.0, 2.4, 5.0),
- doubleArrayOf(52.50140, 13.46280, 35.0, 0.2, 4.0),
- )
-
- private val TRIP_GYM_TO_HOME = arrayOf(
- doubleArrayOf(52.50140, 13.46280, 35.0, 0.4, 4.0),
- doubleArrayOf(52.50190, 13.46180, 35.0, 4.2, 4.5),
- doubleArrayOf(52.50280, 13.45980, 34.0, 9.7, 3.5),
- doubleArrayOf(52.50390, 13.45820, 34.0, 11.4, 3.0),
- doubleArrayOf(52.50510, 13.45700, 33.0, 12.1, 3.5),
- doubleArrayOf(52.50630, 13.45590, 33.0, 10.5, 4.0),
- doubleArrayOf(52.50740, 13.45480, 34.0, 8.9, 3.5),
- doubleArrayOf(52.50860, 13.45360, 34.0, 11.0, 3.0),
- doubleArrayOf(52.50970, 13.45280, 35.0, 9.3, 4.0),
- doubleArrayOf(52.51080, 13.45370, 36.0, 10.8, 3.5),
- doubleArrayOf(52.51190, 13.45490, 37.0, 8.2, 4.0),
- doubleArrayOf(52.51290, 13.45620, 37.0, 6.5, 4.5),
- doubleArrayOf(52.51370, 13.45740, 38.0, 3.1, 5.0),
- doubleArrayOf(52.51420, 13.45830, 38.0, 0.2, 4.0),
- )
-
- private val EVENING_WALK = arrayOf(
- doubleArrayOf(52.51420, 13.45830, 38.0, 1.2, 6.0),
- doubleArrayOf(52.51450, 13.45900, 38.0, 1.4, 5.5),
- doubleArrayOf(52.51480, 13.45970, 38.0, 1.3, 5.0),
- doubleArrayOf(52.51500, 13.46050, 38.0, 1.5, 5.5),
- doubleArrayOf(52.51480, 13.46130, 38.0, 1.4, 6.0),
- doubleArrayOf(52.51450, 13.46080, 38.0, 1.3, 5.5),
- doubleArrayOf(52.51430, 13.45970, 38.0, 1.2, 5.0),
- doubleArrayOf(52.51420, 13.45830, 38.0, 0.3, 6.0),
- )
-
- fun insertDummyData(db: DatabaseHelper): Int {
- val now = System.currentTimeMillis() / 1000
- var count = 0
-
- for (dayOffset in 6 downTo 0) {
- val dayMidnight = now - (now % 86400) - (dayOffset * 86400L)
- val battery = 92 - (dayOffset * 3)
-
- count += insertTrip(db, TRIP_HOME_TO_SUPERMARKET, dayMidnight + 9 * 3600 + 1800, 30L, battery, 0, 1, now)
- count += insertTrip(db, TRIP_SUPERMARKET_TO_GYM, dayMidnight + 10 * 3600 + 1200, 30L, battery, 15, 2, now)
- count += insertTrip(db, TRIP_GYM_TO_HOME, dayMidnight + 12 * 3600, 30L, battery, 30, 1, now)
-
- if (dayOffset % 2 == 0) continue
- count += insertTrip(db, EVENING_WALK, dayMidnight + 18 * 3600, 75L, battery, 45, 1, now)
- }
- return count
- }
-
- private fun insertTrip(
- db: DatabaseHelper,
- trip: Array<DoubleArray>,
- startTs: Long,
- stepSeconds: Long,
- batteryBase: Int,
- batteryOffset: Int,
- profileId: Int,
- nowCeiling: Long,
- ): Int {
- var inserted = 0
- for ((i, wp) in trip.withIndex()) {
- val ts = startTs + (i * stepSeconds)
- if (ts > nowCeiling) break
- db.saveLocation(
- wp[0], wp[1],
- wp[4], wp[2].toInt(), wp[3],
- null, batteryBase - batteryOffset - i, profileId, ts,
- )
- inserted++
- }
- return inserted
- }
-}
diff --git a/apps/mobile/android/app/src/main/java/com/colota/bridge/LocationServiceModule.kt b/apps/mobile/android/app/src/main/java/com/colota/bridge/LocationServiceModule.kt
index 4242eb48..05af73b3 100644
--- a/apps/mobile/android/app/src/main/java/com/colota/bridge/LocationServiceModule.kt
+++ b/apps/mobile/android/app/src/main/java/com/colota/bridge/LocationServiceModule.kt
@@ -451,15 +451,6 @@ class LocationServiceModule(reactContext: ReactApplicationContext) :
deleteThenVacuum(refresh = true) { dbHelper.deleteOlderThan(days) }
}
- @ReactMethod
- fun insertDummyData(promise: Promise) {
- if (!BuildConfig.DEBUG) {
- promise.reject("ERR_NOT_DEBUG", "insertDummyData is only available in debug builds")
- return
- }
- executeAsync(promise) { DebugSeedData.insertDummyData(dbHelper) }
- }
-
@ReactMethod
fun countOlderThan(days: Int, promise: Promise) = executeAsync(promise) {
val counted = dbHelper.countOlderThan(days)
diff --git a/apps/mobile/android/app/src/main/java/com/colota/sync/SyncManager.kt b/apps/mobile/android/app/src/main/java/com/colota/sync/SyncManager.kt
index 8a74b553..13cc45ef 100644
--- a/apps/mobile/android/app/src/main/java/com/colota/sync/SyncManager.kt
+++ b/apps/mobile/android/app/src/main/java/com/colota/sync/SyncManager.kt
@@ -170,7 +170,7 @@ class SyncManager(
// The totals come from the pass, not from the last progress tick.
invalidateQueueCache()
val remaining = runCatching { dbHelper.getQueuedCount() }.getOrDefault(total - pass.sent)
- LocationServiceModule.sendSyncProgressEvent(pass.sent, pass.failed, total, remaining)
+ LocationServiceModule.sendSyncProgressEvent(pass.sent, pass.failed, pass.sent + pass.failed, remaining)
}
}
diff --git a/apps/mobile/android/app/src/main/java/com/colota/util/DeviceInfoHelper.kt b/apps/mobile/android/app/src/main/java/com/colota/util/DeviceInfoHelper.kt
index 7e825303..5a06dae7 100644
--- a/apps/mobile/android/app/src/main/java/com/colota/util/DeviceInfoHelper.kt
+++ b/apps/mobile/android/app/src/main/java/com/colota/util/DeviceInfoHelper.kt
@@ -43,8 +43,6 @@ class DeviceInfoHelper(private val context: Context) {
return Arguments.createMap().apply {
putString("model", Build.MODEL)
putString("brand", Build.BRAND)
- putString("manufacturer", Build.MANUFACTURER)
- putString("deviceId", Build.DEVICE)
putString("systemVersion", Build.VERSION.RELEASE)
putInt("apiLevel", Build.VERSION.SDK_INT)
}
diff --git a/apps/mobile/src/__tests__/chipGuard.test.ts b/apps/mobile/src/__tests__/chipGuard.test.ts
new file mode 100644
index 00000000..6d31b611
--- /dev/null
+++ b/apps/mobile/src/__tests__/chipGuard.test.ts
@@ -0,0 +1,89 @@
+// See designSystemGuard for why this file declares the node corner it needs by hand.
+declare const __dirname: string
+
+type Entry = { name: string; isDirectory: () => boolean }
+const fs: {
+ readdirSync: (dir: string, options: { withFileTypes: true }) => Entry[]
+ readFileSync: (file: string, encoding: "utf8") => string
+} = require("fs")
+const path: { join: (...parts: string[]) => string } = require("path")
+
+import { size, HIT_SLOP_MD } from "../constants"
+
+/**
+ * A chip is 32 by Material and 32 is under Android's 48 touch minimum, so every chip needs
+ * hitSlop to be reliably hittable. Three of the four in the app were hand-built and sat at 26
+ * to 33 with no slop at all, which no render test caught because each looked right on its own.
+ *
+ * This walks the tree instead: any style whose name ends in Chip must set minHeight from the
+ * token, and the file it lives in must reach for HIT_SLOP_MD. A badge is exempt because it is
+ * a label, not a control.
+ */
+const SRC = path.join(__dirname, "..")
+const ROOTS = ["screens", "components"]
+
+function sourceFiles(): string[] {
+ const found: string[] = []
+ const walk = (dir: string) => {
+ for (const entry of fs.readdirSync(path.join(SRC, dir), { withFileTypes: true })) {
+ const rel = `${dir}/${entry.name}`
+ if (entry.isDirectory()) {
+ if (entry.name !== "__tests__") walk(rel)
+ } else if (/\.tsx?$/.test(entry.name)) {
+ found.push(rel)
+ }
+ }
+ }
+ ROOTS.forEach(walk)
+ return found.sort()
+}
+
+const CHIP_STYLE = /^\s{2}(\w*[Cc]hip)\s*:\s*\{([\s\S]*?)^\s{2}\},?$/gm
+
+function chipStyles(source: string): { name: string; body: string }[] {
+ const found: { name: string; body: string }[] = []
+ for (const match of source.matchAll(CHIP_STYLE)) {
+ // chipText and the like are the label inside the chip, not the chip.
+ if (/text$/i.test(match[1])) continue
+ found.push({ name: match[1], body: match[2] })
+ }
+ return found
+}
+
+describe("chip guard", () => {
+ const files = sourceFiles()
+
+ it("finds the chips it is meant to police", () => {
+ const withChips = files.filter((f) => chipStyles(fs.readFileSync(path.join(SRC, f), "utf8")).length > 0)
+
+ expect(withChips).toContain("components/ui/ChipGroup.tsx")
+ expect(withChips).toContain("components/features/inspector/InspectorDock.tsx")
+ })
+
+ it("gives every chip the token height, so none of them drifts back to a literal", () => {
+ const offenders: string[] = []
+ for (const file of files) {
+ const source = fs.readFileSync(path.join(SRC, file), "utf8")
+ for (const chip of chipStyles(source)) {
+ if (!/minHeight:\s*size\.chip\b/.test(chip.body)) offenders.push(`${file} ${chip.name}`)
+ }
+ }
+
+ expect(offenders).toEqual([])
+ })
+
+ it("gives every chip slop, because 32 alone does not reach the touch minimum", () => {
+ const offenders: string[] = []
+ for (const file of files) {
+ const source = fs.readFileSync(path.join(SRC, file), "utf8")
+ if (chipStyles(source).length === 0) continue
+ if (!/hitSlop=\{HIT_SLOP_MD\}/.test(source)) offenders.push(file)
+ }
+
+ expect(offenders).toEqual([])
+ })
+
+ it("keeps the arithmetic true: the chip plus its slop clears the touch target", () => {
+ expect(size.chip + HIT_SLOP_MD.top + HIT_SLOP_MD.bottom).toBeGreaterThanOrEqual(size.touch)
+ })
+})
diff --git a/apps/mobile/src/__tests__/circleRadiusGuard.test.ts b/apps/mobile/src/__tests__/circleRadiusGuard.test.ts
new file mode 100644
index 00000000..9e539e58
--- /dev/null
+++ b/apps/mobile/src/__tests__/circleRadiusGuard.test.ts
@@ -0,0 +1,85 @@
+// See designSystemGuard for why this file declares the node corner it needs by hand.
+declare const __dirname: string
+
+type Entry = { name: string; isDirectory: () => boolean }
+const fs: {
+ readdirSync: (dir: string, options: { withFileTypes: true }) => Entry[]
+ readFileSync: (file: string, encoding: "utf8") => string
+} = require("fs")
+const path: { join: (...parts: string[]) => string } = require("path")
+
+import { radius } from "@colota/shared"
+
+/**
+ * A radius that is half a width is a circle stated as arithmetic, and it stops being one the moment
+ * the size changes. Two rounded a 24px dot with `radius.md`, which is a circle only by coincidence.
+ */
+const SRC = path.join(__dirname, "..")
+const ROOTS = ["screens", "components"]
+const SCALE: Record<string, number> = radius
+
+function sourceFiles(): string[] {
+ const found: string[] = []
+ const walk = (dir: string) => {
+ for (const entry of fs.readdirSync(path.join(SRC, dir), { withFileTypes: true })) {
+ const rel = `${dir}/${entry.name}`
+ if (entry.isDirectory()) {
+ if (entry.name !== "__tests__") walk(rel)
+ } else if (/\.tsx?$/.test(entry.name)) {
+ found.push(rel)
+ }
+ }
+ }
+ ROOTS.forEach(walk)
+ return found.sort()
+}
+
+function circlesWrittenAsArithmetic(source: string): string[] {
+ const found: string[] = []
+
+ for (const style of source.matchAll(/(\w+):\s*\{([^{}]*)\}/g)) {
+ const body = style[2]
+ const width = body.match(/\bwidth:\s*([\d.]+)/)
+ const height = body.match(/\bheight:\s*([\d.]+)/)
+ // A square is a circle and a bar is a pill: both write their corner as half a stated dimension,
+ // so checking only squares missed every rounded bar in the app.
+ const sides = [width, height].filter(Boolean).map((m) => parseFloat(m![1]))
+ if (sides.length === 0) continue
+ if (width && height && width[1] !== height[1]) continue
+
+ const literal = body.match(/borderRadius:\s*([\d.]+)/)
+ const token = body.match(/borderRadius:\s*radius\.(\w+)/)
+ const drawn = literal ? parseFloat(literal[1]) : token ? SCALE[token[1]] : null
+ if (drawn === null || drawn === undefined) continue
+
+ if (sides.some((side) => Math.abs(drawn - side / 2) < 0.01)) {
+ found.push(`${style[1]}: ${sides[0]}px with borderRadius ${literal ? literal[1] : `radius.${token![1]}`}`)
+ }
+ }
+
+ return found
+}
+
+describe("circle radius guard", () => {
+ const files = sourceFiles()
+
+ it("finds the shapes it is meant to police", () => {
+ const square = files.filter((f) => /\bwidth:\s*[\d.]+/.test(fs.readFileSync(path.join(SRC, f), "utf8")))
+
+ expect(square).toContain("components/ui/RadioDot.tsx")
+ expect(square).toContain("components/features/inspector/TripRow.tsx")
+ expect(square.length).toBeGreaterThan(5)
+ })
+
+ it("draws every circle with radius.pill rather than half its own width", () => {
+ const arithmetic: string[] = []
+
+ for (const file of files) {
+ for (const style of circlesWrittenAsArithmetic(fs.readFileSync(path.join(SRC, file), "utf8"))) {
+ arithmetic.push(`${file}: ${style}`)
+ }
+ }
+
+ expect(arithmetic).toEqual([])
+ })
+})
diff --git a/apps/mobile/src/__tests__/contrastGuard.test.ts b/apps/mobile/src/__tests__/contrastGuard.test.ts
new file mode 100644
index 00000000..6ef57454
--- /dev/null
+++ b/apps/mobile/src/__tests__/contrastGuard.test.ts
@@ -0,0 +1,141 @@
+import { lightColors, darkColors, type ThemeColors } from "@colota/shared"
+
+/**
+ * Contrast is the one colour rule a machine can settle, so it is settled here rather than in a
+ * status page nobody runs.
+ *
+ * Ten pairs fail today and are pinned at their measured ratio in DEFERRED. A pin is a number, not
+ * an exemption: a pair that gets worse fails, and a pair that gets fixed fails too, because its
+ * pin is then stale and has to be deleted. Adding a pin is a deliberate line in a diff.
+ *
+ * What this cannot do: the pair list is written by hand, because knowing that textSecondary is
+ * painted on card rather than background needs the layout. It proves things about the pairs
+ * below and says nothing about a pairing introduced later. The other guards walk the source and
+ * are complete over what they check; this one is not.
+ *
+ * textDisabled and placeholder are absent on purpose: WCAG exempts disabled controls and
+ * placeholder text is not the field's accessible name.
+ */
+
+/** WCAG 2.2: 4.5 for text under 18pt, 3.0 for a UI component or meaningful graphic. */
+const TEXT = 4.5
+const UI = 3.0
+
+type Pair = [fg: keyof ThemeColors, bg: keyof ThemeColors, floor: number]
+
+const PAIRS: Pair[] = [
+ ["text", "background", TEXT],
+ ["text", "card", TEXT],
+ ["text", "well", TEXT],
+ ["textSecondary", "background", TEXT],
+ ["textSecondary", "card", TEXT],
+ ["textSecondary", "well", TEXT],
+ ["textLight", "background", TEXT],
+ ["textLight", "card", TEXT],
+ ["link", "card", TEXT],
+ ["text", "surfaceRaised", TEXT],
+ ["textSecondary", "surfaceRaised", TEXT],
+ ["primary", "surfaceRaised", TEXT],
+ ["link", "surfaceRaised", TEXT],
+ ["textLight", "surfaceRaised", UI],
+ ["success", "surfaceRaised", UI],
+ ["warning", "surfaceRaised", UI],
+ ["error", "surfaceRaised", UI],
+ ["textOnPrimary", "primary", TEXT],
+ ["textOnPrimary", "error", TEXT],
+ ["onPrimaryContainer", "primaryContainer", TEXT],
+ ["primary", "background", TEXT],
+ ["primary", "card", TEXT],
+ ["primaryDark", "background", TEXT],
+ ["primaryDark", "card", TEXT],
+ ["error", "background", TEXT],
+ ["error", "card", TEXT],
+ ["warning", "background", TEXT],
+ ["warning", "card", TEXT],
+ ["info", "background", TEXT],
+ ["info", "card", TEXT],
+ ["border", "background", UI],
+ ["border", "card", UI],
+ ["border", "well", UI],
+ ["success", "background", UI],
+ ["success", "card", UI],
+ ["primary", "well", UI]
+]
+
+/** Empty on purpose: every pair clears its floor. A pin here is a palette decision not yet taken. */
+const DEFERRED: Record<string, Record<string, number>> = {
+ light: {},
+ dark: {}
+}
+
+function luminance(hex: string): number {
+ const channels = [1, 3, 5].map((i) => parseInt(hex.slice(i, i + 2), 16) / 255)
+ const [r, g, b] = channels.map((v) => (v <= 0.04045 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4)))
+ return 0.2126 * r + 0.7152 * g + 0.0722 * b
+}
+
+function ratio(fg: string, bg: string): number {
+ const [hi, lo] = [luminance(fg), luminance(bg)].sort((a, b) => b - a)
+ return Math.round(((hi + 0.05) / (lo + 0.05)) * 100) / 100
+}
+
+const THEMES: [name: string, colors: ThemeColors][] = [
+ ["light", lightColors],
+ ["dark", darkColors]
+]
+
+describe("contrast", () => {
+ it("computes the ratio WCAG defines, so every number below means something", () => {
+ // The published boundary case: #767676 is the darkest grey that clears 4.5 on white.
+ expect(ratio("#767676", "#FFFFFF")).toBeCloseTo(4.54, 1)
+ expect(ratio("#000000", "#FFFFFF")).toBe(21)
+ expect(ratio("#FFFFFF", "#FFFFFF")).toBe(1)
+ })
+
+ for (const [themeName, colors] of THEMES) {
+ describe(themeName, () => {
+ const deferred = DEFERRED[themeName]
+
+ it("clears the floor on every pair that is not deferred", () => {
+ const failures: string[] = []
+ for (const [fg, bg, floor] of PAIRS) {
+ const key = `${fg} on ${bg}`
+ if (key in deferred) continue
+ const measured = ratio(colors[fg] as string, colors[bg] as string)
+ if (measured < floor) failures.push(`${key} is ${measured}, floor ${floor}`)
+ }
+
+ expect(failures).toEqual([])
+ })
+
+ it("lets no deferred pair get worse than the day it was measured", () => {
+ const regressions: string[] = []
+ for (const [key, pinned] of Object.entries(deferred)) {
+ const [fg, bg] = key.split(" on ") as [keyof ThemeColors, keyof ThemeColors]
+ const measured = ratio(colors[fg] as string, colors[bg] as string)
+ if (measured < pinned) regressions.push(`${key} fell from ${pinned} to ${measured}`)
+ }
+
+ expect(regressions).toEqual([])
+ })
+
+ it("keeps no pin for a pair that now passes, so the list can only shrink", () => {
+ const stale: string[] = []
+ for (const [key, pinned] of Object.entries(deferred)) {
+ const [fg, bg] = key.split(" on ") as [keyof ThemeColors, keyof ThemeColors]
+ const floor = PAIRS.find(([f, b]) => f === fg && b === bg)?.[2] ?? TEXT
+ const measured = ratio(colors[fg] as string, colors[bg] as string)
+ if (measured >= floor) stale.push(`${key} is ${measured} and clears ${floor}: delete its pin (was ${pinned})`)
+ }
+
+ expect(stale).toEqual([])
+ })
+
+ it("defers nothing that is not in the pair list, so a pin cannot hide an unchecked pairing", () => {
+ const orphans = Object.keys(deferred).filter((key) => !PAIRS.some(([fg, bg]) => `${fg} on ${bg}` === key))
+
+ expect(orphans).toEqual([])
+ })
+ })
+ }
+})
diff --git a/apps/mobile/src/__tests__/designSystemGuard.test.ts b/apps/mobile/src/__tests__/designSystemGuard.test.ts
new file mode 100644
index 00000000..a8179ab4
--- /dev/null
+++ b/apps/mobile/src/__tests__/designSystemGuard.test.ts
@@ -0,0 +1,131 @@
+// The app's tsconfig exposes only the jest globals on purpose, so nothing in src can reach
+// for node. Reading the tree is what this file does, so it declares the corner it needs
+// rather than opening node's globals to every screen.
+declare const __dirname: string
+
+type Entry = { name: string; isDirectory: () => boolean }
+const fs: {
+ readdirSync: (dir: string, options: { withFileTypes: true }) => Entry[]
+ readFileSync: (file: string, encoding: "utf8") => string
+} = require("fs")
+const path: {
+ join: (...parts: string[]) => string
+} = require("path")
+
+/**
+ * A screen writing a number a constant already names forks the system quietly: it renders,
+ * nothing fails, and the next change to that constant misses it.
+ *
+ * Most rules here fire only on a value that HAS a constant. A radius of 10 or an icon at 28 is not
+ * a violation, because nothing names those; they are numbers with no home, and rounding them onto a
+ * scale would move the design rather than tidy it. That is why this file needs no allowlist: the
+ * rules describe what the constants cover, so anything they flag is genuinely a literal written in
+ * place of a name.
+ *
+ * Spacing is the exception, and it is the stronger form. `space` now names every step it uses, so
+ * the rule is inverted there: any number at all is drift. That closes the gap the value-list rules
+ * cannot see, which is where every guard added after this one found its defect.
+ *
+ * Widening a scale means widening the matching rule here, or the new step goes unenforced.
+ */
+const SRC = path.join(__dirname, "..")
+const ROOTS = ["screens", "components/features", "components/ui", "utils"]
+
+const RULES = [
+ // Spacing is the one scale with no holes: every step from 2 to 32 has a name, so any number
+ // here is a literal. 0 is not a spacing value, it cancels one, and stays legal.
+ { name: "spacing", pattern: /(?:padding|margin|gap|rowGap|columnGap)[A-Za-z]*:\s*-?(?!0\b)\d/ },
+ // A literal hides just as well behind an operator: `insets.bottom + 8` is the same drift.
+ { name: "spacingExpression", pattern: /(?:padding|margin|gap|rowGap|columnGap)[A-Za-z]*:[^,\n}]*[-+*/]\s*\d/ },
+ // Inverted like spacing: radius names every corner the app draws, pill included, so any number
+ // here is a literal. 0 squares a corner off rather than setting one, and stays legal.
+ { name: "radius", pattern: /borderRadius:\s*-?(?!0\b)\d/ },
+ { name: "fontSize", pattern: /fontSize:\s*(?:10|11|12|13|14|15|16|18|20|24|28)\b/ },
+ // Inverted with spacing and radius: size.icon names 16, 20 and 24, and a hero glyph is
+ // size.icon.lg in a size.emptyIcon disc, so there is no icon this scale does not cover.
+ { name: "iconSize", pattern: /size=\{\d/ },
+ // These three ban a property outright rather than a value, because the scale covers every case:
+ // elevation names its four levels, fonts names its four weights, and the type spec has no
+ // letter spacing at all.
+ { name: "elevation", pattern: /elevation:\s*\d/ },
+ { name: "fontWeight", pattern: /fontWeight:\s*"?\d/ },
+ { name: "letterSpacing", pattern: /letterSpacing:/ },
+ // Touch feedback is a ripple. A fade is the iOS idiom and dims the label with the surface,
+ // so it is banned outright rather than by value; the pressedOpacity token is gone with it.
+ { name: "pressOpacity", pattern: /pressed[^)]*&&[^}]*opacity/ }
+] as const
+
+function sourceFiles(): string[] {
+ const found: string[] = []
+ const walk = (dir: string) => {
+ for (const entry of fs.readdirSync(path.join(SRC, dir), { withFileTypes: true })) {
+ const rel = `${dir}/${entry.name}`
+ if (entry.isDirectory()) {
+ if (entry.name !== "__tests__") walk(rel)
+ } else if (/\.tsx?$/.test(entry.name)) {
+ found.push(rel)
+ }
+ }
+ }
+ ROOTS.forEach(walk)
+ return found.sort()
+}
+
+function violations(file: string): string[] {
+ const source = fs.readFileSync(path.join(SRC, file), "utf8")
+ return RULES.filter((rule) => rule.pattern.test(source)).map((rule) => rule.name)
+}
+
+describe("design system guard", () => {
+ const files = sourceFiles()
+
+ it("scans every screen, feature component and util", () => {
+ expect(files.length).toBeGreaterThan(0)
+ expect(files).toContain("screens/DashboardScreen.tsx")
+ expect(files).toContain("components/features/inspector/TrackMap.tsx")
+ expect(files).toContain("utils/trips.ts")
+ })
+
+ it("flags a value a constant names, and ignores one no constant covers", () => {
+ const caught = (source: string) => RULES.filter((rule) => rule.pattern.test(source)).map((rule) => rule.name)
+
+ expect(caught("{ padding: 16, borderRadius: 8, fontSize: 13 }")).toEqual(["spacing", "radius", "fontSize"])
+ expect(caught("{ padding: space.lg, borderRadius: radius.sm, fontSize: fontSizes.description }")).toEqual([])
+ expect(caught("<Icon size={20} />")).toEqual(["iconSize"])
+ expect(caught("<Icon size={size.icon.md} />")).toEqual([])
+ // No constant names these, so they are not drift and rounding them would move the design.
+ expect(caught("{ borderRadius: radius.md }")).toEqual([])
+ expect(caught("<Icon size={size.icon.lg} />")).toEqual([])
+ })
+
+ it("flags any spacing number, because space has a name for every step it uses", () => {
+ const caught = (source: string) => RULES.filter((rule) => rule.pattern.test(source)).map((rule) => rule.name)
+
+ // The three the value list could never see: between two steps, below the grid, and behind a plus.
+ expect(caught("{ marginTop: 20 }")).toEqual(["spacing"])
+ expect(caught("{ borderRadius: 10 }")).toEqual(["radius"])
+ expect(caught("{ borderRadius: 0 }")).toEqual([])
+ // 28 and 32 sat above the ladder, so the value list could not see either.
+ expect(caught("<Icon size={28} />")).toEqual(["iconSize"])
+ expect(caught("<Icon size={32} />")).toEqual(["iconSize"])
+ expect(caught("{ gap: 3 }")).toEqual(["spacing"])
+ expect(caught("{ paddingBottom: insets.bottom + 8 }")).toEqual(["spacingExpression"])
+ // 0 cancels a spacing value rather than setting one, and a token composes freely.
+ expect(caught("{ paddingHorizontal: 0 }")).toEqual([])
+ expect(caught("{ marginHorizontal: -space.lg }")).toEqual([])
+ expect(caught("{ paddingHorizontal: FIELD_INSET - borderWidth }")).toEqual([])
+ })
+
+ it("flags a press that fades instead of rippling", () => {
+ const caught = (source: string) => RULES.filter((rule) => rule.pattern.test(source)).map((rule) => rule.name)
+
+ expect(caught("style={({ pressed }) => [s.btn, pressed && { opacity: 0.7 }]}")).toEqual(["pressOpacity"])
+ expect(caught("android_ripple={{ color: colors.text + STATE_LAYER_ALPHA }}")).toEqual([])
+ })
+
+ it("keeps screens out of the styling business", () => {
+ const offenders = files.map((file) => ({ file, found: violations(file) })).filter((e) => e.found.length > 0)
+
+ expect(offenders).toEqual([])
+ })
+})
diff --git a/apps/mobile/src/__tests__/fieldSpacingGuard.test.ts b/apps/mobile/src/__tests__/fieldSpacingGuard.test.ts
new file mode 100644
index 00000000..c8123c85
--- /dev/null
+++ b/apps/mobile/src/__tests__/fieldSpacingGuard.test.ts
@@ -0,0 +1,146 @@
+// See designSystemGuard for why this file declares the node corner it needs by hand.
+declare const __dirname: string
+
+type Entry = { name: string; isDirectory: () => boolean }
+const fs: {
+ readdirSync: (dir: string, options: { withFileTypes: true }) => Entry[]
+ readFileSync: (file: string, encoding: "utf8") => string
+} = require("fs")
+const path: { join: (...parts: string[]) => string } = require("path")
+
+import { space } from "../constants"
+
+/**
+ * TextField deliberately carries no vertical margin: half its call sites sit in a row beside a
+ * unit, a button or a second field, and a baked margin cannot be subtracted by a caller. So the
+ * stack owns the gap, and screens that forgot produced five different values for one distance:
+ * 0 on Appearance, a 14 literal on Auth, 8 elsewhere.
+ *
+ * The label sits space.sm above its own box, so a labelled pair takes space.lg between fields:
+ * twice the inner distance, which is what binds each label to the field below it rather than to
+ * the field above. Two fields with no labels are one compound control (a header name and its
+ * value) and may sit tighter, so they only have to name a token.
+ */
+const SRC = path.join(__dirname, "..")
+const ROOTS = ["screens", "components"]
+
+function sourceFiles(): string[] {
+ const found: string[] = []
+ const walk = (dir: string) => {
+ for (const entry of fs.readdirSync(path.join(SRC, dir), { withFileTypes: true })) {
+ const rel = `${dir}/${entry.name}`
+ if (entry.isDirectory()) {
+ if (entry.name !== "__tests__") walk(rel)
+ } else if (/\.tsx$/.test(entry.name)) {
+ found.push(rel)
+ }
+ }
+ }
+ ROOTS.forEach(walk)
+ return found.sort()
+}
+
+type Pair = { file: string; line: number; labelled: boolean; parent: string | null }
+
+/** A tag runs from its `<TextField` line to the `/>` at the same indent. */
+function tagEnd(lines: string[], start: number, indent: string): number {
+ for (let i = start; i < lines.length; i++) {
+ if (lines[i] === `${indent}/>`) return i
+ }
+ return start
+}
+
+/** The nearest enclosing element that names a style, which is the stack that owns the gap. */
+function parentStyle(lines: string[], from: number, indent: string): string | null {
+ for (let i = from; i >= 0; i--) {
+ const line = lines[i]
+ if (line.trim() === "") continue
+ if (line.length - line.trimStart().length >= indent.length) continue
+ const match = /<\w+[^\n]*style=\{\[?styles\.(\w+)/.exec(line)
+ return match ? match[1] : null
+ }
+ return null
+}
+
+function styleBody(source: string, name: string): string {
+ const match = new RegExp(`^\\s{2}${name}\\s*:\\s*\\{([\\s\\S]*?)^\\s{2}\\},?$`, "m").exec(source)
+ return match ? match[1] : ""
+}
+
+/**
+ * Two TextFields are stacked when they open at the same indent and nothing between them is
+ * shallower, which is what says they are still inside the same parent rather than in a row of
+ * wrappers, as the geofence name and radius are.
+ */
+function stackedPairs(file: string, source: string): Pair[] {
+ const lines = source.split("\n")
+ const pairs: Pair[] = []
+ let prev: { end: number; indent: string; labelled: boolean } | null = null
+
+ lines.forEach((line, index) => {
+ const opening = /^(\s*)<\w*(?:TextField|Field)\b/.exec(line)
+ if (!opening) {
+ if (
+ prev &&
+ index > prev.end &&
+ line.trim() !== "" &&
+ line.length - line.trimStart().length < prev.indent.length
+ ) {
+ prev = null
+ }
+ return
+ }
+ const indent = opening[1]
+ const end = tagEnd(lines, index, indent)
+ const labelled = lines.slice(index, end + 1).some((l) => /^\s*label=/.test(l))
+ if (prev && prev.indent === indent) {
+ pairs.push({
+ file,
+ line: index + 1,
+ labelled: labelled && prev.labelled,
+ parent: parentStyle(lines, index - 1, indent)
+ })
+ }
+ prev = { end, indent, labelled }
+ })
+
+ return pairs
+}
+
+describe("field spacing guard", () => {
+ const files = sourceFiles()
+ const pairs = files.flatMap((file) => stackedPairs(file, fs.readFileSync(path.join(SRC, file), "utf8")))
+
+ it("finds the stacks it is meant to police", () => {
+ expect(pairs.map((p) => p.file)).toContain("screens/AppearanceScreen.tsx")
+ expect(pairs.map((p) => p.file)).toContain("screens/AuthSettingsScreen.tsx")
+ })
+
+ it("hands every stack of fields to a container that spaces them", () => {
+ const offenders = pairs
+ .filter((pair) => {
+ if (!pair.parent) return true
+ const source = fs.readFileSync(path.join(SRC, pair.file), "utf8")
+ return !/gap:\s*space\.\w+/.test(styleBody(source, pair.parent))
+ })
+ .map((pair) => `${pair.file}:${pair.line} in ${pair.parent ?? "an unnamed container"}`)
+
+ expect(offenders).toEqual([])
+ })
+
+ it("keeps the arithmetic true: the gap is twice the label's own distance from its field", () => {
+ expect(space.lg).toBe(space.sm * 2)
+ })
+
+ it("keeps a labelled pair at twice the distance the label sits from its own field", () => {
+ const offenders = pairs
+ .filter((pair) => {
+ if (!pair.labelled || !pair.parent) return false
+ const source = fs.readFileSync(path.join(SRC, pair.file), "utf8")
+ return !/gap:\s*space\.lg\b/.test(styleBody(source, pair.parent))
+ })
+ .map((pair) => `${pair.file}:${pair.line} in ${pair.parent}`)
+
+ expect(offenders).toEqual([])
+ })
+})
diff --git a/apps/mobile/src/__tests__/lineHeightGuard.test.ts b/apps/mobile/src/__tests__/lineHeightGuard.test.ts
new file mode 100644
index 00000000..6d48b1a4
--- /dev/null
+++ b/apps/mobile/src/__tests__/lineHeightGuard.test.ts
@@ -0,0 +1,77 @@
+// See designSystemGuard for why this file declares the node corner it needs by hand.
+declare const __dirname: string
+
+type Entry = { name: string; isDirectory: () => boolean }
+const fs: {
+ readdirSync: (dir: string, options: { withFileTypes: true }) => Entry[]
+ readFileSync: (file: string, encoding: "utf8") => string
+} = require("fs")
+const path: { join: (...parts: string[]) => string } = require("path")
+
+import { fontSizes, lineHeights } from "../styles/typography"
+
+/**
+ * A line height written per style drifts: 12sp text sat at 16, 17 and 18 across three screens, and
+ * no render test compares two files. Every one comes from `lineHeights`, with no exemption.
+ */
+const SRC = path.join(__dirname, "..")
+const ROOTS = ["screens", "components", "styles"]
+const SIZE_FOR: Record<keyof typeof lineHeights, keyof typeof fontSizes> = {
+ body: "body",
+ description: "description",
+ caption: "caption",
+ small: "small",
+ mono: "caption"
+}
+
+function sourceFiles(): string[] {
+ const found: string[] = []
+ const walk = (dir: string) => {
+ for (const entry of fs.readdirSync(path.join(SRC, dir), { withFileTypes: true })) {
+ const rel = `${dir}/${entry.name}`
+ if (entry.isDirectory()) {
+ if (entry.name !== "__tests__") walk(rel)
+ } else if (/\.tsx?$/.test(entry.name)) {
+ found.push(rel)
+ }
+ }
+ }
+ ROOTS.forEach(walk)
+ return found.sort()
+}
+
+describe("line height guard", () => {
+ const files = sourceFiles()
+
+ it("finds the files it is meant to police", () => {
+ const withLineHeights = files.filter((f) => /lineHeight:/.test(fs.readFileSync(path.join(SRC, f), "utf8")))
+
+ expect(withLineHeights).toContain("components/ui/SettingRow.tsx")
+ expect(withLineHeights).toContain("screens/ApiSettingsScreen.tsx")
+ expect(withLineHeights.length).toBeGreaterThan(20)
+ })
+
+ it("takes every line height from the token", () => {
+ const literals: string[] = []
+
+ for (const file of files) {
+ const source = fs.readFileSync(path.join(SRC, file), "utf8")
+ for (const match of source.matchAll(/lineHeight:\s*(\d+)/g)) {
+ literals.push(`${file}: lineHeight: ${match[1]}`)
+ }
+ }
+
+ expect(literals).toEqual([])
+ })
+
+ it("keeps every token within Material's leading range for its size", () => {
+ const tight: string[] = []
+
+ for (const [name, height] of Object.entries(lineHeights)) {
+ const ratio = height / fontSizes[SIZE_FOR[name as keyof typeof lineHeights]]
+ if (ratio < 1.3 || ratio > 1.5) tight.push(`${name}: ${height} / ${ratio.toFixed(2)}x`)
+ }
+
+ expect(tight).toEqual([])
+ })
+})
diff --git a/apps/mobile/src/__tests__/pressableRoleGuard.test.ts b/apps/mobile/src/__tests__/pressableRoleGuard.test.ts
new file mode 100644
index 00000000..89b6b095
--- /dev/null
+++ b/apps/mobile/src/__tests__/pressableRoleGuard.test.ts
@@ -0,0 +1,103 @@
+// See designSystemGuard for why this file declares the node corner it needs by hand.
+export {}
+
+declare const __dirname: string
+
+type Entry = { name: string; isDirectory: () => boolean }
+const fs: {
+ readdirSync: (dir: string, options: { withFileTypes: true }) => Entry[]
+ readFileSync: (file: string, encoding: "utf8") => string
+} = require("fs")
+const path: { join: (...parts: string[]) => string } = require("path")
+
+/**
+ * A bare `Pressable` announces nothing to TalkBack: no role, so it does not read as a control, and
+ * usually no name either, so there is nothing to read out. Data management shipped three
+ * destructive actions that way and the offline-maps delete disc sat silent beside an IconButton
+ * that looks identical.
+ *
+ * `none` is a real answer for a modal scrim and for the view that swallows a tap inside it, which
+ * is why this asks for a role rather than for a label.
+ */
+const SRC = path.join(__dirname, "..")
+const ROOTS = ["screens", "components"]
+
+function sourceFiles(): string[] {
+ const found: string[] = []
+ const walk = (dir: string) => {
+ for (const entry of fs.readdirSync(path.join(SRC, dir), { withFileTypes: true })) {
+ const rel = `${dir}/${entry.name}`
+ if (entry.isDirectory()) {
+ if (entry.name !== "__tests__") walk(rel)
+ } else if (/\.tsx$/.test(entry.name)) {
+ found.push(rel)
+ }
+ }
+ }
+ ROOTS.forEach(walk)
+ return found.sort()
+}
+
+/**
+ * Reads each opening tag by tracking brace depth. A regex cannot: `onPress={() => x}` puts a `>`
+ * inside the tag, so matching to the first one stops before the props that follow it and reports
+ * tags as bare when they are not.
+ */
+function openingTags(source: string): { tag: string; line: number }[] {
+ const tags: { tag: string; line: number }[] = []
+ let from = 0
+
+ for (;;) {
+ const start = source.indexOf("<Pressable", from)
+ if (start === -1) return tags
+
+ let i = start + "<Pressable".length
+ let depth = 0
+ let quote: string | null = null
+
+ for (; i < source.length; i++) {
+ const c = source[i]
+ if (quote) {
+ if (c === quote && source[i - 1] !== "\\") quote = null
+ continue
+ }
+ if (c === '"' || c === "'" || c === "`") quote = c
+ else if (c === "{") depth++
+ else if (c === "}") depth--
+ else if (c === ">" && depth === 0 && source[i - 1] !== "=") break
+ }
+
+ tags.push({ tag: source.slice(start, i), line: source.slice(0, start).split("\n").length })
+ from = i
+ }
+}
+
+describe("pressable role guard", () => {
+ const files = sourceFiles()
+
+ // A floor on the scanner's own reach, not on the tree: it exists so a regex that quietly matches
+ // nothing cannot pass as a clean run. Screens moving to the primitives lower the real count.
+ it("finds the Pressables it is meant to police", () => {
+ const total = files.reduce((n, f) => n + openingTags(fs.readFileSync(path.join(SRC, f), "utf8")).length, 0)
+
+ expect(total).toBeGreaterThan(30)
+ })
+
+ it("reads a tag past the arrow in an inline handler", () => {
+ const [only] = openingTags(`<Pressable onPress={() => go()} accessibilityRole="button">x</Pressable>`)
+
+ expect(only.tag).toContain("accessibilityRole")
+ })
+
+ it("gives every Pressable a role, so none of them announces as nothing", () => {
+ const bare: string[] = []
+
+ for (const file of files) {
+ for (const { tag, line } of openingTags(fs.readFileSync(path.join(SRC, file), "utf8"))) {
+ if (!/accessibilityRole/.test(tag)) bare.push(`${file}:${line}`)
+ }
+ }
+
+ expect(bare).toEqual([])
+ })
+})
diff --git a/apps/mobile/src/__tests__/rowHeightGuard.test.ts b/apps/mobile/src/__tests__/rowHeightGuard.test.ts
new file mode 100644
index 00000000..d91cdf23
--- /dev/null
+++ b/apps/mobile/src/__tests__/rowHeightGuard.test.ts
@@ -0,0 +1,117 @@
+// See designSystemGuard for why this file declares the node corner it needs by hand.
+declare const __dirname: string
+
+type Entry = { name: string; isDirectory: () => boolean }
+const fs: {
+ readdirSync: (dir: string, options: { withFileTypes: true }) => Entry[]
+ readFileSync: (file: string, encoding: "utf8") => string
+} = require("fs")
+const path: { join: (...parts: string[]) => string } = require("path")
+
+/**
+ * SettingRow owns its metrics: 56 minimum and space.lg above and below, which is Material's 56
+ * for one line and 72 for two. A caller that pads it again changes the height of some rows and
+ * not others, and the run reads as ragged where it is meant to read as a list.
+ *
+ * Two screens did exactly that. The geofence editor paid 10 on four pause toggles, leaving them
+ * near 61 beside its own full-height Timeout row; the sync settings paid 0 on top of the first
+ * quality filter, leaving it near 57 with its text against the top edge. Neither value is on the
+ * space scale, so designSystemGuard is right to ignore them and could never have caught either.
+ *
+ * ListItem has no style prop at all, which is the other way to solve this. SettingRow keeps one
+ * because a caller does legitimately need to reach the row (the disabled state, a testID wrapper),
+ * so the prop stays and this rule says what may not travel through it.
+ */
+const SRC = path.join(__dirname, "..")
+const ROOTS = ["screens", "components"]
+
+/** Anything that moves the row's edges or its content within them. */
+const OWNED = /^\s*(padding|margin|height|minHeight|maxHeight)/m
+
+function sourceFiles(): string[] {
+ const found: string[] = []
+ const walk = (dir: string) => {
+ for (const entry of fs.readdirSync(path.join(SRC, dir), { withFileTypes: true })) {
+ const rel = `${dir}/${entry.name}`
+ if (entry.isDirectory()) {
+ if (entry.name !== "__tests__") walk(rel)
+ } else if (/\.tsx$/.test(entry.name)) {
+ found.push(rel)
+ }
+ }
+ }
+ ROOTS.forEach(walk)
+ return found.sort()
+}
+
+function styleBody(source: string, name: string): string {
+ const inline = new RegExp(`^\\s{2}${name}\\s*:\\s*\\{([^\\n}]*)\\},?$`, "m").exec(source)
+ if (inline) return inline[1]
+ const block = new RegExp(`^\\s{2}${name}\\s*:\\s*\\{([\\s\\S]*?)^\\s{2}\\},?$`, "m").exec(source)
+ return block ? block[1] : ""
+}
+
+/** Every style name reaching a SettingRow, with the line the tag opens on. */
+export function rowStyles(source: string): { line: number; style: string }[] {
+ const lines = source.split("\n")
+ const found: { line: number; style: string }[] = []
+
+ lines.forEach((line, index) => {
+ if (!/<SettingRow\b/.test(line)) return
+ // The opening tag runs to the first line ending in `>`; a SettingRow always has children.
+ const tag: string[] = []
+ for (let i = index; i < lines.length; i++) {
+ tag.push(lines[i])
+ if (/>\s*$/.test(lines[i])) break
+ }
+ const match = /style=\{\[?styles\.(\w+)/.exec(tag.join("\n"))
+ if (match) found.push({ line: index + 1, style: match[1] })
+ })
+
+ return found
+}
+
+describe("row height guard", () => {
+ const files = sourceFiles()
+
+ it("reads the screens that hold the rows", () => {
+ expect(files).toContain("screens/GeofenceEditorScreen.tsx")
+ expect(files).toContain("components/features/settings/SyncStrategySettings.tsx")
+ })
+
+ it("recognises a style reaching the row, whatever shape the tag takes", () => {
+ expect(rowStyles(` <SettingRow label="A" hint="b" style={styles.toggleRow}>`)).toEqual([
+ { line: 1, style: "toggleRow" }
+ ])
+ expect(
+ rowStyles(
+ [
+ " <SettingRow",
+ " style={styles.firstInGroup}",
+ ' label="A"',
+ " >"
+ ].join("\n")
+ )
+ ).toEqual([{ line: 1, style: "firstInGroup" }])
+ expect(rowStyles(` <SettingRow label="A" hint="b">`)).toEqual([])
+ })
+
+ it("names the two shapes that shipped, so a revert fails here", () => {
+ expect(OWNED.test(" paddingVertical: 10")).toBe(true)
+ expect(OWNED.test(" paddingTop: 0")).toBe(true)
+ // A caller may still reach the row for something that is not its metrics.
+ expect(OWNED.test(" flex: 1")).toBe(false)
+ expect(OWNED.test(" opacity: 0.5")).toBe(false)
+ })
+
+ it("leaves the row's own height to the row", () => {
+ const offenders = files.flatMap((file) => {
+ const source = fs.readFileSync(path.join(SRC, file), "utf8")
+ return rowStyles(source)
+ .filter((entry) => OWNED.test(styleBody(source, entry.style)))
+ .map((entry) => `${file}:${entry.line} passes styles.${entry.style}`)
+ })
+
+ expect(offenders).toEqual([])
+ })
+})
diff --git a/apps/mobile/src/__tests__/typeRoleGuard.test.ts b/apps/mobile/src/__tests__/typeRoleGuard.test.ts
new file mode 100644
index 00000000..3443b236
--- /dev/null
+++ b/apps/mobile/src/__tests__/typeRoleGuard.test.ts
@@ -0,0 +1,92 @@
+// See designSystemGuard for why this file declares the node corner it needs by hand.
+declare const __dirname: string
+
+type Entry = { name: string; isDirectory: () => boolean }
+const fs: {
+ readdirSync: (dir: string, options: { withFileTypes: true }) => Entry[]
+ readFileSync: (file: string, encoding: "utf8") => string
+} = require("fs")
+const path: { join: (...parts: string[]) => string } = require("path")
+
+import { type, fontSizes } from "../styles/typography"
+
+/**
+ * A role is a size plus everything that always travels with it. Only the four sizes used at a
+ * single weight across the app are roles: `body`, `description`, `caption`, `label`, `input`,
+ * `small` and `micro` are each used at three or four weights, so a role for them would pick a
+ * weight for call sites that disagree, which is a reflow rather than a rename.
+ *
+ * This walks the tree for a style that composes a role's exact combination by hand, because that
+ * is how the app got here - two hundred styles writing size and weight separately, and a caption
+ * rendered in nine different size, weight and line-height combinations.
+ */
+const SRC = path.join(__dirname, "..")
+const ROOTS = ["screens", "components"]
+
+function sourceFiles(): string[] {
+ const found: string[] = []
+ const walk = (dir: string) => {
+ for (const entry of fs.readdirSync(path.join(SRC, dir), { withFileTypes: true })) {
+ const rel = `${dir}/${entry.name}`
+ if (entry.isDirectory()) {
+ if (entry.name !== "__tests__") walk(rel)
+ } else if (/\.tsx?$/.test(entry.name)) {
+ found.push(rel)
+ }
+ }
+ }
+ ROOTS.forEach(walk)
+ return found.sort()
+}
+
+/** A style body: every brace pair holding a fontSize and no nested object. */
+function styleBodies(source: string): string[] {
+ return [...source.matchAll(/\{([^{}]*fontSize[^{}]*)\}/g)].map((m) => m[1])
+}
+
+const ROLES: { role: string; size: keyof typeof fontSizes; weight?: string; mono?: boolean }[] = [
+ { role: "display", size: "screenTitle", weight: "bold" },
+ { role: "figure", size: "statValue", weight: "bold" },
+ { role: "title", size: "cardTitle", weight: "bold" },
+ { role: "heading", size: "heading", weight: "bold" },
+ { role: "mono", size: "caption", mono: true }
+]
+
+describe("type role guard", () => {
+ const files = sourceFiles()
+
+ it("finds the styles it is meant to police", () => {
+ const withText = files.filter((f) => styleBodies(fs.readFileSync(path.join(SRC, f), "utf8")).length > 0)
+
+ expect(withText.length).toBeGreaterThan(40)
+ expect(withText).toContain("components/ui/AppModal.tsx")
+ })
+
+ it("leaves no style composing a role by hand", () => {
+ const offenders: string[] = []
+ for (const file of files) {
+ for (const body of styleBodies(fs.readFileSync(path.join(SRC, file), "utf8"))) {
+ for (const { role, size, weight, mono } of ROLES) {
+ if (!new RegExp(`fontSize:\\s*fontSizes\\.${size}\\b`).test(body)) continue
+ if (weight && !new RegExp(`\\.\\.\\.fonts\\.${weight}\\b`).test(body)) continue
+ if (mono && !/fontFamily:\s*"monospace"/.test(body)) continue
+ offenders.push(`${file} rebuilds type.${role}`)
+ }
+ }
+ }
+
+ expect(offenders).toEqual([])
+ })
+
+ it("keeps a figure tabular, so a counting number does not jitter", () => {
+ expect(type.figure.fontVariant).toContain("tabular-nums")
+ })
+
+ it("keeps every role on the shared size scale, so one scale still governs", () => {
+ const sizes: number[] = Object.values(fontSizes)
+
+ for (const role of Object.values(type)) {
+ expect(sizes).toContain(role.fontSize)
+ }
+ })
+})
diff --git a/apps/mobile/src/__tests__/wrapperStyleGuard.test.ts b/apps/mobile/src/__tests__/wrapperStyleGuard.test.ts
new file mode 100644
index 00000000..c07bd419
--- /dev/null
+++ b/apps/mobile/src/__tests__/wrapperStyleGuard.test.ts
@@ -0,0 +1,79 @@
+// See designSystemGuard for why this file declares the node corner it needs by hand.
+export {}
+
+declare const __dirname: string
+
+type Entry = { name: string; isDirectory: () => boolean }
+const fs: {
+ readdirSync: (dir: string, options: { withFileTypes: true }) => Entry[]
+ readFileSync: (file: string, encoding: "utf8") => string
+} = require("fs")
+const path: { join: (...parts: string[]) => string } = require("path")
+
+/**
+ * `Button` and `TextField` put a caller's `style` on their outer view and paint the control inside
+ * it, so a fill, corner or border passed from a screen lands on a transparent box and is never
+ * drawn. It cost four inputs a double border and left the Start control at the default corner while
+ * its own style said otherwise. Layout is fine to pass; paint is not.
+ */
+const SRC = path.join(__dirname, "..")
+const ROOTS = ["screens", "components"]
+const WRAPPERS = ["Button", "TextField"]
+const PAINT = /\b(backgroundColor|borderRadius|borderWidth|borderColor)\s*:/
+
+function sourceFiles(): string[] {
+ const found: string[] = []
+ const walk = (dir: string) => {
+ for (const entry of fs.readdirSync(path.join(SRC, dir), { withFileTypes: true })) {
+ const rel = `${dir}/${entry.name}`
+ if (entry.isDirectory()) {
+ if (entry.name !== "__tests__") walk(rel)
+ } else if (/\.tsx$/.test(entry.name)) {
+ found.push(rel)
+ }
+ }
+ }
+ ROOTS.forEach(walk)
+ return found.sort()
+}
+
+function styleBodies(source: string): Record<string, string> {
+ const bodies: Record<string, string> = {}
+ for (const style of source.matchAll(/(\w+):\s*\{([^{}]*)\}/g)) bodies[style[1]] = style[2]
+ return bodies
+}
+
+function stylesHandedToAWrapper(source: string): string[] {
+ const names: string[] = []
+ for (const wrapper of WRAPPERS) {
+ const tag = new RegExp(`<${wrapper}\\b[^>]*?style=\\{styles\\.(\\w+)\\}`, "gs")
+ for (const use of source.matchAll(tag)) names.push(use[1])
+ }
+ return names
+}
+
+describe("wrapper style guard", () => {
+ const files = sourceFiles()
+
+ it("finds the callers it is meant to police", () => {
+ const callers = files.filter((f) => stylesHandedToAWrapper(fs.readFileSync(path.join(SRC, f), "utf8")).length > 0)
+
+ expect(callers).toContain("components/features/settings/MtlsSection.tsx")
+ expect(callers).toContain("screens/ProfileEditorScreen.tsx")
+ })
+
+ it("hands a wrapper layout only, because paint on it is never drawn", () => {
+ const painted: string[] = []
+
+ for (const file of files) {
+ const source = fs.readFileSync(path.join(SRC, file), "utf8")
+ const bodies = styleBodies(source)
+ for (const name of stylesHandedToAWrapper(source)) {
+ const body = bodies[name]
+ if (body && PAINT.test(body)) painted.push(`${file}: ${name} sets ${body.match(PAINT)![1]}`)
+ }
+ }
+
+ expect(painted).toEqual([])
+ })
+})
diff --git a/apps/mobile/src/components/index.ts b/apps/mobile/src/components/index.ts
index b11fe159..dc5e2352 100644
--- a/apps/mobile/src/components/index.ts
+++ b/apps/mobile/src/components/index.ts
@@ -51,6 +51,8 @@ export { BottomTabBar, TAB_ROUTES } from "./ui/BottomTabBar"
export { DashboardMap } from "./features/dashboard/DashboardMap"
export { ConnectionStatus } from "./features/dashboard/ConnectionStatus"
export { WelcomeCard } from "./features/dashboard/WelcomeCard"
+export { DashboardBanner } from "./features/dashboard/DashboardBanner"
+export { DashboardDock } from "./features/dashboard/DashboardDock"
// ============================================================================
// Feature Components - Map
@@ -61,6 +63,11 @@ export { MapCenterButton } from "./features/map/MapCenterButton"
// Feature Components - Inspector
// ============================================================================
export { TrackMap } from "./features/inspector/TrackMap"
+export { DayHeader } from "./features/inspector/DayHeader"
+export { DayPickerModal } from "./features/inspector/DayPickerModal"
+export { TripRow } from "./features/inspector/TripRow"
+export { InspectorDock } from "./features/inspector/InspectorDock"
+export { PointCard } from "./features/inspector/PointCard"
// ============================================================================
// Feature Components - Settings
@@ -68,10 +75,3 @@ export { TrackMap } from "./features/inspector/TrackMap"
export { ConnectionSettings } from "./features/settings/ConnectionSettings"
export { SyncStrategySettings } from "./features/settings/SyncStrategySettings"
export { StatRow } from "./ui/StatRow"
-export { DashboardBanner } from "./features/dashboard/DashboardBanner"
-export { DashboardDock } from "./features/dashboard/DashboardDock"
-export { DayHeader } from "./features/inspector/DayHeader"
-export { DayPickerModal } from "./features/inspector/DayPickerModal"
-export { TripRow } from "./features/inspector/TripRow"
-export { InspectorDock } from "./features/inspector/InspectorDock"
-export { PointCard } from "./features/inspector/PointCard"
diff --git a/apps/mobile/src/components/ui/Button.tsx b/apps/mobile/src/components/ui/Button.tsx
index 7d04cf17..ead0ff1d 100644
--- a/apps/mobile/src/components/ui/Button.tsx
+++ b/apps/mobile/src/components/ui/Button.tsx
@@ -24,7 +24,6 @@ type ButtonVariant = "primary" | "secondary" | "ghost" | "danger"
type ButtonShape = "rounded" | "pill"
type Props = {
- activeOpacity?: number
title: string
onPress: (event: GestureResponderEvent) => void
disabled?: boolean
diff --git a/apps/mobile/src/components/ui/FloatingSaveIndicator.tsx b/apps/mobile/src/components/ui/FloatingSaveIndicator.tsx
index 22dc1fce..4af4bdf6 100644
--- a/apps/mobile/src/components/ui/FloatingSaveIndicator.tsx
+++ b/apps/mobile/src/components/ui/FloatingSaveIndicator.tsx
@@ -3,7 +3,6 @@
* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.
*/
-import type { ThemeColors } from "../../types/global"
import React, { useEffect, useRef } from "react"
import { radius } from "@colota/shared"
import { View, Text, StyleSheet, Animated } from "react-native"
@@ -14,18 +13,16 @@ import { fontSizes, fonts } from "../../styles/typography"
import { size, space, elevation } from "../../constants"
interface Props {
- success?: boolean
- colors?: ThemeColors
saving: boolean
/** Shown once the work is done; absent when there is nothing to report. */
message?: string | null
isError?: boolean
}
-export const FloatingSaveIndicator: React.FC<Props> = ({ saving, success, message, isError }) => {
+export const FloatingSaveIndicator: React.FC<Props> = ({ saving, message, isError }) => {
const { colors } = useTheme()
const hasMessage = message != null
- const visible = hasMessage || saving || success === true
+ const visible = hasMessage || saving
const translateY = useRef(new Animated.Value(60)).current
const opacity = useRef(new Animated.Value(0)).current
@@ -44,7 +41,7 @@ export const FloatingSaveIndicator: React.FC<Props> = ({ saving, success, messag
}
}, [visible, translateY, opacity])
- const displayText = hasMessage ? message : saving ? "Saving..." : "Saved"
+ const displayText = hasMessage ? message : "Saving..."
return (
<Animated.View
diff --git a/apps/mobile/src/components/ui/NumericInput.tsx b/apps/mobile/src/components/ui/NumericInput.tsx
index b86071e7..f7eca77a 100644
--- a/apps/mobile/src/components/ui/NumericInput.tsx
+++ b/apps/mobile/src/components/ui/NumericInput.tsx
@@ -3,7 +3,6 @@
* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.
*/
-import type { ThemeColors } from "../../types/global"
import React from "react"
import { View, Text, StyleSheet } from "react-native"
import { useTheme } from "../../hooks/useTheme"
@@ -13,7 +12,6 @@ import { TextField } from "./TextField"
import { FieldMessage } from "./FieldMessage"
interface NumericInputProps {
- colors?: ThemeColors
label: string
value: string
onChange: (value: string) => void
diff --git a/apps/mobile/src/components/ui/TimePicker.tsx b/apps/mobile/src/components/ui/TimePicker.tsx
index 7a86274d..2bea9703 100644
--- a/apps/mobile/src/components/ui/TimePicker.tsx
+++ b/apps/mobile/src/components/ui/TimePicker.tsx
@@ -3,7 +3,6 @@
* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.
*/
-import type { ThemeColors } from "../../types/global"
import React, { useCallback, useEffect, useMemo, useState } from "react"
import { View, Text, StyleSheet } from "react-native"
import { useTheme } from "../../hooks/useTheme"
@@ -13,8 +12,7 @@ import { space } from "../../constants"
import { TextField } from "./TextField"
interface TimePickerProps {
- colors?: ThemeColors
- label?: string
+ label: string
value: string
onChange: (value: string) => void
}
diff --git a/apps/mobile/src/constants/index.ts b/apps/mobile/src/constants/index.ts
index 24a1bf20..53294098 100644
--- a/apps/mobile/src/constants/index.ts
+++ b/apps/mobile/src/constants/index.ts
@@ -172,12 +172,3 @@ export const SUPPORT_URL = "https://mxd.codes/support"
/** market:// opens the Play app straight on the listing; the https form is the fallback. */
export const PLAY_STORE_MARKET_URL = "market://details?id=com.Colota"
export const PLAY_STORE_WEB_URL = "https://play.google.com/store/apps/details?id=com.Colota"
-
-export const STATS_REFRESH_IDLE = 30_000
-export const STATS_REFRESH_FAST = 3_000
-export const MIN_STATS_INTERVAL_MS = 2000
-export const MS_TO_KMH = 3.6
-export const HIGH_QUEUE_THRESHOLD = 50
-export const CRITICAL_QUEUE_THRESHOLD = 100
-export const TILE_SERVER_DOCS_URL = "https://colota.app/docs/guides/tile-server"
-export const TEST_RESULT_DISPLAY_MS = 5_000
diff --git a/apps/mobile/src/hooks/useAutoSave.ts b/apps/mobile/src/hooks/useAutoSave.ts
index 9d4cb503..e7dec732 100644
--- a/apps/mobile/src/hooks/useAutoSave.ts
+++ b/apps/mobile/src/hooks/useAutoSave.ts
@@ -17,13 +17,11 @@ import { logger } from "../utils/logger"
*/
export function useAutoSave() {
const [saving, setSaving] = useState(false)
- const [saveSuccess, setSaveSuccess] = useState(false)
const [message, setMessage] = useState<string | null>(null)
const [isError, setIsError] = useState(false)
const saveTimeout = useTimeout()
const restartTimeout = useTimeout()
const messageTimeout = useTimeout()
- const successTimeout = useTimeout()
const announce = useCallback(
(text: string, failed: boolean) => {
@@ -37,8 +35,6 @@ export function useAutoSave() {
const runRestart = useCallback(
async (restartFn: () => Promise<boolean>) => {
try {
- setSaveSuccess(true)
- successTimeout.set(() => setSaveSuccess(false), SAVE_SUCCESS_DISPLAY_MS)
if (await restartFn()) announce("Tracking restarted", false)
} catch (err) {
logger.error("[useAutoSave] Restart failed:", err)
@@ -47,7 +43,7 @@ export function useAutoSave() {
setSaving(false)
}
},
- [announce, successTimeout]
+ [announce]
)
/**
@@ -98,7 +94,6 @@ export function useAutoSave() {
return {
saving,
- saveSuccess,
message,
isError,
debouncedSaveAndRestart,
diff --git a/apps/mobile/src/hooks/useTheme.tsx b/apps/mobile/src/hooks/useTheme.tsx
index 4097d737..39eb2bf8 100644
--- a/apps/mobile/src/hooks/useTheme.tsx
+++ b/apps/mobile/src/hooks/useTheme.tsx
@@ -23,7 +23,6 @@ interface ThemeContextType {
mode: ThemeMode
preference: ThemePreference
setPreference: (preference: ThemePreference) => void
- toggleTheme: () => void
isDark: boolean
wallpaperColors: boolean
setWallpaperColors: (enabled: boolean) => void
@@ -117,22 +116,19 @@ export const ThemeProvider = ({ children }: { children: ReactNode }) => {
return mode === "dark" ? darkColors : lightColors
}, [mode, wallpaperColors, palette])
- const toggleTheme = useCallback(() => setPreference(mode === "dark" ? "light" : "dark"), [mode, setPreference])
-
const contextValue = useMemo(
() => ({
colors,
mode,
preference,
setPreference,
- toggleTheme,
isDark: mode === "dark",
wallpaperColors,
setWallpaperColors,
wallpaperColorsAvailable: Platform.OS === "android" && Number(Platform.Version) >= 31,
wallpaperPaletteReady: palette !== null
}),
- [colors, mode, preference, setPreference, wallpaperColors, setWallpaperColors, palette, toggleTheme]
+ [colors, mode, preference, setPreference, wallpaperColors, setWallpaperColors, palette]
)
return <ThemeContext.Provider value={contextValue}>{children}</ThemeContext.Provider>
diff --git a/apps/mobile/src/i18n/locales/en.json b/apps/mobile/src/i18n/locales/en.json
index e9ab63a7..12d7a3f5 100644
--- a/apps/mobile/src/i18n/locales/en.json
+++ b/apps/mobile/src/i18n/locales/en.json
@@ -17,7 +17,5 @@
"appearance.mapStyle.reset": "Reset to default",
"appearance.mapStyle.light": "Light style URL",
"appearance.mapStyle.dark": "Dark style URL",
- "appearance.mapStyle.error": "Starts with http:// or https:// and names a host.",
- "appearance.darkMode": "Dark Mode",
- "appearance.mapStyle.subtitle": "Override the default map tile source"
+ "appearance.mapStyle.error": "Starts with http:// or https:// and names a host."
}
diff --git a/apps/mobile/src/screens/index.ts b/apps/mobile/src/screens/index.ts
index b5b8e334..164d20d0 100644
--- a/apps/mobile/src/screens/index.ts
+++ b/apps/mobile/src/screens/index.ts
@@ -3,12 +3,15 @@
* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.
*/
+export { LoggingScreen } from "./LoggingScreen"
+export { LogPreviewScreen } from "./LogPreviewScreen"
export { ApiSettingsScreen } from "./ApiSettingsScreen"
export { AutoExportScreen } from "./AutoExportScreen"
export { AuthSettingsScreen } from "./AuthSettingsScreen"
export { MtlsSettingsScreen } from "./MtlsSettingsScreen"
export { DashboardScreen } from "./DashboardScreen"
export { DataManagementScreen } from "./DataManagementScreen"
+export { ExportImportScreen } from "./ExportImportScreen"
export { GeofenceScreen } from "./GeofenceScreen"
export { GeofenceEditorScreen } from "./GeofenceEditorScreen"
export { LocationHistoryScreen } from "./LocationInspectorScreen"
@@ -25,8 +28,5 @@ export { ShareSetupScreen } from "./ShareSetupScreen"
export { TripDetailScreen } from "./TripDetailScreen"
export { OfflineMapsScreen } from "./OfflineMapsScreen"
export { BackupRestoreScreen } from "./BackupRestoreScreen"
-export { BackendTemplateScreen } from "./BackendTemplateScreen"
export { PlaceZoneScreen } from "./PlaceZoneScreen"
-export { ExportImportScreen } from "./ExportImportScreen"
-export { LoggingScreen } from "./LoggingScreen"
-export { LogPreviewScreen } from "./LogPreviewScreen"
+export { BackendTemplateScreen } from "./BackendTemplateScreen"
diff --git a/apps/mobile/src/services/BackupService.ts b/apps/mobile/src/services/BackupService.ts
index b9f1c951..039dde19 100644
--- a/apps/mobile/src/services/BackupService.ts
+++ b/apps/mobile/src/services/BackupService.ts
@@ -20,9 +20,6 @@ export type BackupSource = {
displayName: string | null
}
-export const MIN_BACKUP_PASSWORD_LENGTH = 12
-export const MIN_BACKUP_PASSWORD_BITS = 50
-
export type BackupManifest = {
createdAt: string
appVersion: string
diff --git a/apps/mobile/src/services/NativeLocationService.ts b/apps/mobile/src/services/NativeLocationService.ts
index 60dcd873..86ad1176 100644
--- a/apps/mobile/src/services/NativeLocationService.ts
+++ b/apps/mobile/src/services/NativeLocationService.ts
@@ -260,11 +260,6 @@ class NativeLocationService {
// CLEANUP OPERATIONS
// ============================================================================
- static async insertDummyData(): Promise<number> {
- this.ensureModule()
- return this.safeExecute(() => LocationServiceModule.insertDummyData(), 0, "insertDummyData failed")
- }
-
/** Deletes the locations themselves where `sent = 1`, imported rows included. Resolves how many went. */
static async clearSentHistory(): Promise<number> {
this.ensureModule()
@@ -730,12 +725,6 @@ class NativeLocationService {
VERSION_CODE: number
FLAVOR: string
APP_LANGUAGE: string
- MIN_SDK_VERSION: number
- TARGET_SDK_VERSION: number
- COMPILE_SDK_VERSION: number
- BUILD_TOOLS_VERSION: string
- KOTLIN_VERSION: string
- NDK_VERSION: string
} | null {
if (!BuildConfigModule) {
logger.warn("[NativeLocationService] BuildConfigModule not available")
@@ -769,8 +758,6 @@ class NativeLocationService {
brand: string
systemVersion: string
apiLevel: number
- manufacturer: string
- deviceId: string
}> {
this.ensureModule()
return LocationServiceModule.getDeviceInfo()
@@ -846,7 +833,7 @@ class NativeLocationService {
}
/** Returns null if there are no entries to export. */
- static async exportFileLogToUri(treeUri: string, header = "", appLog = ""): Promise<string | null> {
+ static async exportFileLogToUri(treeUri: string, header: string, appLog: string): Promise<string | null> {
this.ensureModule()
return LocationServiceModule.exportFileLogToUri(treeUri, header, appLog)
}
diff --git a/apps/mobile/src/styles/dynamicColors.ts b/apps/mobile/src/styles/dynamicColors.ts
index c77bf1af..59f5dd33 100644
--- a/apps/mobile/src/styles/dynamicColors.ts
+++ b/apps/mobile/src/styles/dynamicColors.ts
@@ -61,11 +61,7 @@ export function buildDynamicColors(palette: SystemPalette, isDark: boolean): The
warning: base.warning,
error: base.error,
info: base.info,
- overlay: base.overlay,
- primaryLight: base.primaryLight,
- cardElevated: base.cardElevated,
- pressedOpacity: base.pressedOpacity,
- borderRadius: base.borderRadius
+ overlay: base.overlay
}
if (isDark) {
diff --git a/apps/mobile/src/types/global.ts b/apps/mobile/src/types/global.ts
index 831e24ff..92b6217c 100644
--- a/apps/mobile/src/types/global.ts
+++ b/apps/mobile/src/types/global.ts
@@ -109,8 +109,6 @@ export type HttpMethod = "POST" | "GET"
export type SyncCondition = "any" | "wifi_any" | "wifi_ssid" | "vpn"
-export type ServerStatus = "connected" | "error" | "notConfigured"
-
export type ApiTemplateName =
"custom" | "dawarich" | "geopulse" | "overland" | "owntracks" | "phonetrack" | "reitti" | "traccar"
@@ -267,8 +265,6 @@ export const API_TEMPLATES: Record<Exclude<ApiTemplateName, "custom">, ApiTempla
// PRESETS
// ============================================================================
-export type BatteryImpact = "Low" | "Medium" | "High"
-
export interface TrackingPresetConfig {
interval: number
distance: number
@@ -277,8 +273,6 @@ export interface TrackingPresetConfig {
label: string
/** What the preset costs, read beside the numbers it prices. */
cost: string
- description: string
- batteryImpact: BatteryImpact
}
export const TRACKING_PRESETS = {
@@ -288,9 +282,7 @@ export const TRACKING_PRESETS = {
syncInterval: 0,
retryInterval: 30,
label: "Instant",
- cost: "most battery, finest track",
- description: "Track every 5s • Send instantly",
- batteryImpact: "High"
+ cost: "most battery, finest track"
},
balanced: {
interval: 30,
@@ -298,9 +290,7 @@ export const TRACKING_PRESETS = {
syncInterval: 300,
retryInterval: 300,
label: "Balanced",
- cost: "moderate battery, fewer wake-ups",
- description: "Track every 30s • Batch 5 min",
- batteryImpact: "Medium"
+ cost: "moderate battery, fewer wake-ups"
},
powersaver: {
interval: 60,
@@ -308,9 +298,7 @@ export const TRACKING_PRESETS = {
syncInterval: 900,
retryInterval: 900,
label: "Power saver",
- cost: "least battery, coarser track",
- description: "Track every 60s • Batch 15 min",
- batteryImpact: "Low"
+ cost: "least battery, coarser track"
}
} as const satisfies Record<string, TrackingPresetConfig>
diff --git a/apps/mobile/src/types/navigation.ts b/apps/mobile/src/types/navigation.ts
index 894629c4..fd4f1d8e 100644
--- a/apps/mobile/src/types/navigation.ts
+++ b/apps/mobile/src/types/navigation.ts
@@ -22,7 +22,7 @@ export type RootStackParamList = {
Geofences: undefined
"Geofence Editor": { geofenceId?: number; name?: string; radius?: number; lat?: number; lon?: number } | undefined
"Place Zone": { name: string; radius: number; lat?: number; lon?: number }
- "Location History": { initialTab?: InspectorTab; initialDate?: string } | undefined
+ "Location History": { initialTab?: InspectorTab; initialDate?: number } | undefined
"Location Summary": undefined
"Export & Import": undefined
"Auto-Export": undefined
diff --git a/fastlane/metadata/android/en-US/changelogs/50.txt b/fastlane/metadata/android/en-US/changelogs/50.txt
new file mode 100644
index 00000000..31ea420a
--- /dev/null
+++ b/fastlane/metadata/android/en-US/changelogs/50.txt
@@ -0,0 +1,7 @@
+- Every screen redesigned: labels read as sentences and each row shows its value
+- Appearance can take the app colors from your Android wallpaper
+- Tapping the month in Location History picks a year and a month
+- Export and import share one screen, and an import says what it adds first
+- GeoJSON exports write one point per recording
+- Switching units updates every screen at once
+- Offline maps picks up a running download when you come back
diff --git a/packages/shared/src/colors.ts b/packages/shared/src/colors.ts
index ffd78fb2..3cfb97c5 100644
--- a/packages/shared/src/colors.ts
+++ b/packages/shared/src/colors.ts
@@ -12,7 +12,6 @@ export interface ThemeColors {
// Primary colors
primary: string
primaryDark: string
- primaryLight: string
primaryContainer: string
onPrimaryContainer: string
border: string
@@ -30,9 +29,6 @@ export interface ThemeColors {
background: string
backgroundElevated: string
card: string
- cardElevated: string
- pressedOpacity: number
- borderRadius: number
/** One tonal step above `card` for what floats over content: docks, dialogs, banners, map discs. Never a list card. */
surfaceRaised: string
surface: string
@@ -60,7 +56,6 @@ export const lightColors: ThemeColors = {
// Brand (Teal)
primary: "#0B7D73",
primaryDark: "#115E59",
- primaryLight: "#99F6E4",
primaryContainer: "#B9E4DC",
onPrimaryContainer: "#115E59",
well: "#E9EDF0",
@@ -75,9 +70,6 @@ export const lightColors: ThemeColors = {
background: "#F1F4F6",
backgroundElevated: "#FFFFFF",
card: "#FFFFFF",
- cardElevated: "#FFFFFF",
- pressedOpacity: 0.7,
- borderRadius: 8,
surfaceRaised: "#FFFFFF",
surface: "#FFFFFF",
@@ -88,7 +80,7 @@ export const lightColors: ThemeColors = {
textDisabled: "#9AA0A6",
// Border & divider
- border: "#e5e7eb",
+ border: "#7e889c",
borderLight: "#f3f4f6",
divider: "#e5e7eb",
@@ -105,7 +97,6 @@ export const darkColors: ThemeColors = {
// Brand (Teal)
primary: "#2DD4BF",
primaryDark: "#0FA698",
- primaryLight: "#99F6E4",
primaryContainer: "#0F3B36",
onPrimaryContainer: "#99F6E4",
well: "#232323",
@@ -120,9 +111,6 @@ export const darkColors: ThemeColors = {
background: "#121212",
backgroundElevated: "#1E1E1E",
card: "#2D2D2D",
- cardElevated: "#3D3D3D",
- pressedOpacity: 0.7,
- borderRadius: 8,
surfaceRaised: "#353535",
surface: "#1E1E1E",
@@ -133,7 +121,7 @@ export const darkColors: ThemeColors = {
textDisabled: "#666666",
// Border & divider
- border: "#424242",
+ border: "#767676",
borderLight: "#333333",
divider: "#505050",