trails/openspec/changes/mobile-app/specs/mobile-offline/spec.md
Ullrich Schäfer fff77a2ed2
Add mobile app, map-core, nearby sync, and activity recording specs
mobile-app: Unified React Native + Expo app combining Planner and
Journal. OAuth2 PKCE auth, MapLibre maps, versioned REST API with
Zod schemas, configurable server URL, offline SQLite, Web Push relay
notifications. TanStack Query + Zustand state management. Jest +
Maestro testing. 76 tasks across 5 phases.

map-core-package: Extract renderer-agnostic map definitions (tiles,
color palettes, POI categories, z-index) into @trails-cool/map-core.
Pure refactor preparing for MapLibre on mobile. 27 tasks.

mobile-activity-recording: GPS recording, live stats, HealthKit/Health
Connect export. Separated from mobile-app for independent scheduling.

mobile-nearby-sync: BLE route sync between nearby devices for offline
group riding. QR waypoint sharing as simpler v1. TXQR noted as future.

journal-rest-api spec: Full API contract — endpoints, auth, pagination,
errors, discovery, versioning, BRouter proxy.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 21:52:30 +02:00

1.9 KiB

ADDED Requirements

Requirement: Download routes for offline

The system SHALL allow users to download route data (GPX, waypoints, metadata) for offline access.

Scenario: Download a route

  • WHEN the user taps "Download for offline" on a route
  • THEN the route GPX, parsed waypoints, and metadata are stored in the local SQLite database

Scenario: View offline route

  • WHEN the user views a downloaded route without network connectivity
  • THEN the route is loaded from the local database and displayed on the map with cached tiles

Scenario: Delete offline data

  • WHEN the user removes a route from offline storage
  • THEN all cached data for that route (GPX, tiles, metadata) is deleted from the device

Requirement: Map tile caching

The system SHALL cache map tiles for downloaded route regions so maps are viewable offline.

Scenario: Tile download for route region

  • WHEN a route is downloaded for offline use
  • THEN map tiles covering the route bounding box at relevant zoom levels are cached locally

Scenario: Storage budget

  • WHEN the total offline storage exceeds the configured budget (shown on Profile tab)
  • THEN the system warns the user and suggests removing older offline routes

Requirement: Offline edit queue

The system SHALL queue route edits made offline and sync them when connectivity returns.

Scenario: Queue edits while offline

  • WHEN the user edits a route without network connectivity
  • THEN the changes are saved to a local edit queue and a sync-pending indicator is shown

Scenario: Sync on reconnect

  • WHEN the device regains network connectivity
  • THEN queued edits are sent to the Journal API in order and the sync indicator clears

Scenario: Conflict on sync

  • WHEN the server version of a route changed while the user was offline
  • THEN the system warns the user and applies last-write-wins, preserving the local version