Commit Graph

14 Commits

Author SHA1 Message Date
Davide Scaini 3ce365e439 feat: tap map thumbnail to open full-screen interactive map 2026-04-24 21:55:56 +02:00
Davide Scaini a306682b52 feat: add sync mode setting — summaries only vs full data download 2026-04-24 21:52:25 +02:00
Davide Scaini bb44b80e97 fix: upgrade react-native-svg to 15.15.4 to fix Fabric crash on RN 0.81 2026-04-24 18:20:36 +02:00
Davide Scaini c1e4ab5af7 feat: add reset synced data button to settings 2026-04-24 15:45:51 +02:00
Davide Scaini 97c7fae9be feat: Phase 4 — MapLibre route map + SVG elevation chart on activity screen
- Add /api/activity/{id}/geojson and /api/activity/{id}/timeseries endpoints
  (bearer-token-gated, falls back from _merged to raw activities dir)
- Rewrite activity detail screen with MapLibreGL v11 API (Map, Camera,
  GeoJSONSource, Layer) and react-native-svg area chart with gradient fill
- On-demand fetch for remote activities that have no local geojson/timeseries
- Add react-native-svg dependency; requires dev build (npx expo run:android)
2026-04-24 15:40:10 +02:00
Davide Scaini 02726034c7 fix: read activity shards in GET /api/feed; improve sync feedback
_merged/index.json is a shard manifest with activities:[] when the user
has >FEED_PAGE_SIZE activities. The endpoint now collects from all
index-{year}.json shard files before returning.

SyncResult gains a `total` field (activities received from server) so the
feed screen can distinguish "server returned nothing" from "all already
stored locally". Messages: "No activities on instance" / "Up to date (N)"
/ "X of N activities synced".
2026-04-24 15:07:52 +02:00
Davide Scaini 44b2878b14 feat: Phase 0.5 — remote feed sync via Bearer token auth
Server (bincio/serve/server.py):
- Add _require_auth: accepts session cookie OR Authorization: Bearer token
- POST /api/auth/token: same as /api/auth/login but returns token in body
  (password used once, not stored; mobile stores only the session token)
- GET /api/feed: auth-gated; reads _merged/index.json for the user and
  returns the activities array as JSON

Mobile:
- db/sync.ts: syncFeed(db) fetches /api/feed, upserts each summary into
  local SQLite as origin='remote'; skips locally-imported activities
- db/queries.ts: add upsertRemoteActivity (INSERT ... ON CONFLICT DO UPDATE
  WHERE origin='remote' — never overwrites local imports); fix feed sort
  order to started_at DESC instead of insertion order
- settings.tsx: Connect section — password field (not persisted) + Connect
  button calls POST /api/auth/token and stores token; Disconnect clears it
- index.tsx: ↓ Sync button + pull-to-refresh both trigger syncFeed; cloud
  badge on remote activities; empty state updated
2026-04-24 12:07:49 +02:00
Davide Scaini 79c572bf8b fix: align expo packages to SDK 54 expected versions
Expo's version checker reported mismatches; update to exact expected versions:
  expo-sqlite ~16.0.10, expo-document-picker ~14.0.8,
  expo-file-system ~19.0.21, expo-background-fetch ~14.0.9,
  expo-task-manager ~14.0.9, react-native-webview 13.15.0,
  typescript ~5.9.2

expo-file-system v19 moved the legacy API (documentDirectory, copyAsync,
makeDirectoryAsync) to 'expo-file-system/legacy' — update import in import.tsx.
2026-04-24 11:45:23 +02:00
Davide Scaini 10b515f3bf fix: pin react-dom to 19.1.0 to prevent npm resolving 19.2.5
expo-router@6.0.23 declares react-dom as peerOptional; without an explicit
pin npm resolves react-dom@19.2.5 (latest) which conflicts with react@19.1.0.
The SDK 54 template pins both to 19.1.0 — mirroring that here.
2026-04-24 11:39:02 +02:00
Davide Scaini 6f5abf634d fix: downgrade to Expo SDK 54 for Expo Go compatibility
Expo Go 54 (latest available on device) cannot run SDK 55 projects.
Rewrite package.json with canonical SDK 54 versions from expo-template-tabs:
  expo ~54.0.33, expo-router ~6.0.23, react 19.1.0, react-native 0.81.5
  expo-sqlite ~15.0.6, expo-document-picker ~13.1.6,
  expo-file-system ~18.0.12, expo-background-fetch/task-manager ~13.1.6,
  expo-notifications ~0.32.16, expo-constants ~18.0.13,
  expo-linking ~8.0.11, expo-splash-screen ~31.0.13,
  expo-status-bar ~3.0.9, react-native-screens ~4.16.0,
  react-native-safe-area-context ~5.6.0
TypeScript compiles cleanly; npm install completes without errors.
2026-04-24 11:32:56 +02:00
Davide Scaini 6e0b619ad3 fix: pin react to 19.2.5 and @types/react to ~19.2.0
react-dom@19.2.5 (pulled by @expo/router-server) requires react@^19.2.5;
@react-native/virtualized-lists@0.85.2 requires @types/react@^19.2.0.
npm install now completes without errors or warnings.
2026-04-24 11:24:16 +02:00
Davide Scaini 18726699f1 fix: update react to 19.2.3 to satisfy react-native 0.85.2 peer dep
react-native@0.85.2 requires react@^19.2.3; package.json had 19.0.0.
Also update @types/react to ~19.1.0 to match.
2026-04-24 11:16:14 +02:00
Davide Scaini 02bb8a3dd7 feat: serve bincio wheel locally for mobile dev testing
- Add GET /api/wheel/download to serve/server.py and edit/server.py:
  serves dist/bincio-*.whl via FileResponse; in production nginx takes
  the request before FastAPI, so this is a no-op there but works locally
- wheel_version response now includes api_url: "/api/wheel/download"
  alongside the nginx-served url field
- Bundle mobile/assets/bincio.whl (built from dist/) as an offline
  fallback for Pyodide testing before the first instance sync
- docs/mobile-app.md: document dev setup — bundled asset, local server
  endpoint, and how to refresh the bundle with uv build + cp
2026-04-24 11:01:24 +02:00
Davide Scaini b37df88fe1 feat: Phase 0 mobile app scaffold — Expo 55, SQLite, Feed/Import/Settings screens 2026-04-24 10:39:06 +02:00