Commit Graph

168 Commits

Author SHA1 Message Date
Doug Borg 8983939b05 Delegate network tile fetching to NetworkTileProvider
Replace our custom tile pipeline (fetchRemoteTile / _SimpleSemaphore /
exponential backoff) with flutter_map's built-in NetworkTileProvider,
gaining persistent disk cache, ETag revalidation, RetryClient, and
obsolete request aborting for free.

DeflockTileProvider now extends NetworkTileProvider and overrides
getTileUrl() to route through TileType.getTileUrl() (quadkey,
subdomains, API keys). getImageWithCancelLoadingSupport() routes
between two paths at runtime: the common network path (super) when
no offline areas exist, and a DeflockOfflineTileImageProvider for
offline-first when they do.

- Delete tiles_from_remote.dart (semaphore, retry loop, spatial helpers)
- Simplify MapDataProvider._fetchRemoteTileFromCurrentProvider to plain
  http.get (only used by offline area downloader now)
- Remove dead clearTileQueue/clearTileQueueSelective from MapDataProvider
- Remove 7 tile fetch constants from dev_config.dart
- TileLayerManager now disposes provider on cache clear and uses actual
  urlTemplate for cache key generation
- 9 new tests covering URL delegation, routing, and equality

Closes #87 Phase 2.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 20:07:56 -07:00
Doug Borg 0137fd66aa Add consistent User-Agent header to all HTTP clients
Create UserAgentClient (http.BaseClient wrapper) that injects a
User-Agent header into every request, reading app name and version
from VersionService and contact/homepage from dev_config.dart.

Format follows OSM tile usage policy:
  DeFlock/<version> (+https://deflock.org; contact: admin@stopflock.com)

Replaces 4 inconsistent hardcoded UA strings and adds UA to the 9
call sites that previously sent none.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 19:31:27 -07:00
Doug Borg 5df0170344 Use out skel for Overpass way/relation pass and add service tests
Switch the second Overpass pass (ways/relations) from out meta to out skel,
dropping unused tags/version/changeset fields from the response. The app only
reads structural references (node lists, relation members) from these elements.

Also inject http.Client into OverpassService for testability (matching
RoutingService pattern) and add close() for client lifecycle management.

14 tests covering query building, constraint detection, and error handling.

Fixes #108

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:26:22 -07:00
stopflock 59afd75887 Merge pull request #42 from dougborg/fix/routing-empty-tags
Fix route calculation HTTP 400 caused by empty profile tag values
2026-02-09 18:26:12 -06:00
Doug Borg 5abcc58a78 Address PR review: truncate error response logs and close http client
- Gate full error response body logging behind kDebugMode; truncate to
  500 chars in release builds to avoid log noise and data exposure
- Add RoutingService.close() and call from NavigationState.dispose()

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 14:32:34 -07:00
Doug Borg 71776ee8f0 Fix route calculation HTTP 400 by filtering empty profile tags
Built-in profiles (Flock, Motorola, etc.) include placeholder empty
values like camera:mount: '' for user refinement. When these get
serialized into the routing request body, the alprwatch API rejects
them with HTTP 400.

Fix: strip empty-valued tags from enabled_profiles before sending
the routing request. Also refactor RoutingService to accept an
injectable http.Client for testability, and log error response
bodies for easier debugging of future API issues.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 14:32:34 -07:00
Doug Borg ef4205f4bd Make suggestion limit configurable and remove redundant .take(10) from widget
Move hardcoded suggestion limit to kNSIMaxSuggestions in dev_config, and remove
the redundant .take(10) from optionsBuilder since the fetch stage already caps
results.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 14:32:18 -07:00
Doug Borg 037165653c Fix lint warnings and cleanup unused code after RadioGroup migration
Remove unused imports, fields, variables, and dead code introduced
during the RadioGroup widget migration and prior changes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 13:36:18 -07:00
Doug Borg 4fddd8e807 Replace print() with debugPrint() across codebase
Fixes avoid_print lint warnings by using debugPrint which respects
release mode and avoids console overflow on mobile platforms.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 14:23:07 -07:00
Doug Borg c712aba724 Add flutter_lints and fix analyzer errors, dead code, and unused imports 2026-02-08 14:23:06 -07:00
Doug Borg 61a2a99bbc Replace deprecated localization APIs and add test coverage
Use AssetManifest.loadFromAssetBundle instead of manually parsing the
deprecated AssetManifest.json. Fix a broken localization key reference
(queue.cameraWithIndex → queue.itemWithIndex).

Replace the standalone scripts/validate_localizations.dart with proper
flutter tests (11 tests across two groups): file integrity checks
(directory exists, en.json present, valid JSON structure, language code
file names, deep key-completeness across all locales) and t() lookup
tests (nested resolution, missing-key fallback, parameter substitution,
partial-path fallback).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 22:31:48 -07:00
stopflock 2620c8758e dev mode, imperial units incl. custom scalebar 2026-02-06 20:28:08 -06:00
stopflock 38245bfb5b Ask for location permission first, notifications later. Roadmap. 2026-02-03 16:22:46 -06:00
stopflock aba919f8d4 Fix submissions using existing tags profile by stripping non-xml-safe chars. Allow customizing changeset comment. 2026-02-01 22:22:31 -06:00
stopflock 659cf5c0f0 Fix fetching and loading indicator in sandbox 2026-02-01 18:38:31 -06:00
stopflock 83d7814fb6 Network status indicator should only respect the latest / current request. Others finish in background. Replace stupid bools with an enum to track state. Be smarter about split requests. 2026-01-31 17:21:31 -06:00
stopflock 9a17d7e666 Network status indicator should only respect the latest / current request. Others finish in background. 2026-01-31 14:22:33 -06:00
stopflock 79d2fe711d Monolithic reimplementation of node fetching from overpass/offline areas. Prevent submissions in areas without cache coverage. Also fixes offline node loading. 2026-01-30 21:34:55 -06:00
stopflock 4a36c52982 Node fetch rework 2026-01-30 19:11:00 -06:00
Heath Dutton🕴️ 33ae6473bb pass viewbox to nominatim search for location-biased results 2026-01-29 10:42:56 -05:00
stopflock 1873d6e768 profile import from deeplinks 2026-01-28 15:20:25 -06:00
stopflock 8b44b3abf5 Better loading indicator 2025-12-23 16:17:06 -06:00
stopflock ae795a7607 configurable overpass query timeout; increased to 45s 2025-12-23 12:03:53 -06:00
stopflock c3752fd17e log in button, submission guide cancel, filter nsi by popularity and entered text 2025-12-17 17:36:59 -06:00
stopflock 656dbc8ce8 positioning tutorial 2025-12-11 16:01:45 -06:00
stopflock 4a4fc30828 Improve overpass efficiency by omitting profiles which are subsumed by any other 2025-12-10 15:26:42 -06:00
stopflock e6b18bf89b NSI and tag refinement 2025-12-10 12:52:20 -06:00
stopflock b0d2ae22fe Simplify suspected locations databse handling 2025-12-07 11:34:38 -06:00
stopflock ffec43495b Better suspected locations download indicator 2025-12-07 11:00:42 -06:00
stopflock 16b8acad3a Suspected locations database 2025-12-07 10:23:36 -06:00
stopflock b02623deac rework one-time migrations 2025-12-06 14:48:21 -06:00
stopflock b176724fc5 Configurable nav timeout 2025-12-03 15:04:43 -06:00
ALPR Watch 3f83d67bc1 Add error handling and update documentation 2025-12-03 07:35:18 +01:00
ALPR Watch 043a036075 Enable user-selected profiles in navigation 2025-12-03 07:34:12 +01:00
ALPR Watch 0ec53c3a11 Enable avoidance distance settings 2025-12-03 07:33:50 +01:00
ALPR Watch 9782352909 Start to change navigation to alprwatch API
This only covers the success path. Known todos:

* failure modes in routing
* developer documentation
* feature flags
2025-12-03 07:31:22 +01:00
stopflock bb3d398c9c More camera -> node 2025-12-02 21:17:07 -06:00
stopflock 5043ef3e34 Repopulate node cache from pending 2025-12-02 19:16:33 -06:00
stopflock c81014d530 maxCameras->maxNodes, default from dev_config 2025-12-02 15:50:11 -06:00
stopflock c4d9cd7986 Message notifications working 2025-12-02 14:04:04 -06:00
stopflock bc03dcbe89 OSM message notifications in theory 2025-12-02 12:10:09 -06:00
stopflock dccafc898b Fix changesets not getting closed, other updates to queue mechanism 2025-12-01 15:01:48 -06:00
stopflock df0377b41f Get rid of double cache, filesystem checking for every tile fetch, swap out http interception for a fluttermap tileprovider that calls map_data, fix node rendering limit 2025-11-28 21:48:17 -06:00
stopflock 153377e9e6 laggy on android, UX needs polish 2025-11-26 15:03:58 -06:00
stopflock 45f1635e10 Get rid of double cache layer, remove tiles from network status indicator, fix status callbacks from split fetches, use tileprovider instead of http catching. 2025-11-24 18:28:36 -06:00
stopflock 961465ebb5 Popup message before submitting first node 2025-11-22 14:56:05 -06:00
stopflock 7ff04851f4 Fix tile loading finally 2025-11-22 13:22:17 -06:00
stopflock 3c996c78c9 Two nodes too close together warning 2025-11-21 15:35:12 -06:00
stopflock 95fad14261 min zoom 1, max cameras 8, extract node from way 2025-11-19 22:46:09 -06:00
stopflock b2645f1341 Limit tag list size, make changelog use a list instead of \n, make links clickable in node tags 2025-11-16 17:30:24 -06:00