# Delivery App — Build & Feature Changelog **Date:** 2026-04-29 **Developer:** Raphael (Emergency: kimi-k2.6) **Target:** Wesley vdk (Telegram) --- ## ✅ Completed Features ### 1. Map Themes (Fixed) - **Standard** — OpenStreetMap default tiles - **Dark** — CartoDB Dark Matter (replaced Stadia Dark which returned 401 Unauthorized) - **CartoDB Voyager** — Light themed, good contrast with app UI *Note: Stadia Dark requires API key. CartoDB Dark Matter is free.* ### 2. Overpass Address Integration - Fetched **5,855 addresses** (151 streets) in Hoogerheide via Overpass API - Stored locally in `assets/hoogerheide_addresses.json` - App now checks local cache first (instant), falls back to Nominatim with timeout - Added "Refresh coordinates" button in RoutePage AppBar ### 3. Delete Functionality - **Delete stops:** Via stop details bottom sheet (red button) - **Delete routes:** Trash icon next to each route in RoutesPage - Both require confirmation dialog ### 4. Route Optimization & Display - **OSRM trip routing** for proper TSP (Traveling Salesman Problem) optimization - **Route polyline display** using `flutter_map` PolylineLayer - **Loading indicators** when calculating routes - Route button (↗️) toggles display on/off ### 5. Build Environment Setup - Installed **Eclipse Temurin JDK 17** (`/workspace/jdk/`) - Installed **Android SDK** (`/workspace/android-sdk/`) - Installed **CMake 3.22.1** via Android SDK manager - Fixed missing `source_span: ^1.10.0` dependency - APK output: **49MB** (consistent across builds) --- ## ❌ Known Issues / Unresolved ### 1. Route Line Not Displaying **Status:** Unresolved **Symptoms:** - Tapping route button shows loading indicator - After completion, no polyline appears on map - OSRM API returns valid geometry (tested manually) - Polyline decoding appears correct (debug prints added) **Likely causes:** - PolylineLayer z-index issue (might be behind tiles) - `_showRoute` state not triggering rebuild - Decoded points might be malformed - OSRM returns encoded polyline, decoding might fail silently **Debug steps:** ```bash adb logcat | grep flutter # View debug prints from phone ``` ### 2. Stadia Dark Theme Unusable **Status:** Replaced with CartoDB Dark **Root cause:** `tiles.stadiamaps.com` returns 401 Unauthorized **Solution:** Use CartoDB Dark Matter (free, no auth) or get Stadia API key ### 3. Coordinate Accuracy **Status:** Improved, not perfect **Issue:** Some stops still map to incorrect locations **Cause:** Database has old/wrong coordinates from previous Nominatim failures **Fix:** Use "Refresh coordinates" button to re-geocode all stops using Overpass data ### 4. APK Caching on Telegram **Status:** Partially fixed **Issue:** Telegram caches APK files, installing old versions **Workaround:** Rename APK with timestamp before sending (e.g., `delivery-v20260429-2126-debug.apk`) --- ## 🔧 Technical Debt ### Code Issues 1. **Missing commas** — Several Dart function calls missing commas between arguments (fixed in multiple places) 2. **Fallback logic** — If OSRM fails, falls back to straight lines between stops (not following streets) 3. **No error UI** — Route/optimization failures fail silently (only debugPrint) 4. **State management** — `_isLoadingRoute` and `_showRoute` might have race conditions ### Dependencies Added ```yaml dependencies: source_span: ^1.10.0 # Fix for string_scanner incompatibility ``` ### Files Modified - `lib/main.dart` — Main app logic (routes, stops, map, geocoding) - `pubspec.yaml` — Added assets reference - `assets/hoogerheide_addresses.json` — 5,855 addresses from Overpass - `lib/hoogerheide_streets.dart` — Generated street coordinates (unused now) --- ## 📋 Test Checklist - [ ] Route line displays after tapping ↗️ button - [ ] Loading indicator shows during route calculation - [ ] Route optimization reorders stops correctly - [ ] Delete stop works with confirmation - [ ] Delete route works with confirmation - [ ] Dark theme (CartoDB) renders correctly - [ ] "Refresh coordinates" updates stop positions - [ ] Overpass data loads (no network needed after first fetch) --- ## 🚀 Next Steps (If Resuming) 1. **Fix route display:** - Check `adb logcat` for debug prints - Verify PolylineLayer renders (try hardcoded points) - Test with 2-3 stops only 2. **Improve error handling:** - Show SnackBar on route/optimization failure - Add retry button 3. **Local Nominatim (optional):** - Install PostgreSQL + Nominatim with Netherlands data - Solves rate-limiting issues permanently 4. **Unit tests:** - Test polyline decoding - Test geocoding logic - Test route optimization --- ## 📦 Build Commands ```bash # Clean build flutter clean && flutter pub get # Release APK export JAVA_HOME="/home/node/.openclaw/workspace/jdk/jdk-17.0.9+9" export ANDROID_HOME="/home/node/.openclaw/workspace/android-sdk" export PATH="$JAVA_HOME/bin:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools:/home/node/.openclaw/workspace/flutter/bin:$PATH" flutter build apk --release # Output: build/app/outputs/flutter-apk/app-release.apk (49MB) ``` --- **Last updated:** 2026-04-29 23:15 UTC