Compare commits

...

135 Commits

Author SHA1 Message Date
stopflock
256dd1a43c Merge pull request #145 from dougborg/feat/resilience-policy
Add endpoint migration with centralized retry/fallback policy
2026-03-12 11:42:28 -05:00
Doug Borg
ca7192d3ec Add changelog entry for retry/fallback feature
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 23:20:08 -06:00
Doug Borg
2833906c68 Add centralized retry/fallback policy with hard-coded endpoints
Extract duplicated retry logic from OverpassService and RoutingService
into a shared resilience framework in service_policy.dart:

- ResiliencePolicy: configurable retries, backoff, and HTTP timeout
- executeWithFallback: retry loop with primary→fallback endpoint chain
- ErrorDisposition enum: abort / fallback / retry classification
- ServicePolicy + ServicePolicyResolver: per-service compliance rules
  (rate limits, caching, concurrency) for OSMF and third-party services
- ServiceRateLimiter: async semaphore-based concurrency and rate control

OverpassService now hits overpass.deflock.org first, falls back to
overpass-api.de. RoutingService hits api.dontgetflocked.com first,
falls back to alprwatch.org. Both use per-service error classifiers
to determine retry vs fallback vs abort behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 23:13:52 -06:00
stopflock
4d1032e56d ver, changelog 2026-03-11 23:22:17 -05:00
stopflock
834861bcaf Merge pull request #148 from dougborg/fix/node-render-prioritization
Prioritize closest nodes to viewport center when render limit is active
2026-03-11 23:19:16 -05:00
Doug Borg
ba80b88595 Update lib/widgets/map/map_data_manager.dart
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-11 22:06:52 -06:00
Doug Borg
ebb7fd090f Address review: stable tie-breaker and accurate log message
- Add node id tie-breaker to sort comparator so equal-distance nodes
  have deterministic ordering across renders (prevents flicker)
- Log validNodesCount instead of allNodes.length so the message
  reflects the actual post-filter count

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 14:38:58 -06:00
Doug Borg
fe401cc04b Prioritize closest nodes to viewport center when render limit is active
Sort nodes by squared distance from viewport center before applying the
render limit, so visible nodes always make the cut instead of arbitrary
selection causing gaps that shift as you pan.

Also: inject node provider for testability, deduplicate validity filter,
and reduce debug log spam to state transitions only.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 15:09:37 -06:00
stopflock
de65cecc6a bump ver 2026-03-07 16:51:38 -06:00
stopflock
122b303378 Merge pull request #132 from dougborg/fix/tile-retry-on-error
I think this finally has online, offline, proper caching, tile types, all working correctly.
2026-03-07 16:33:42 -06:00
Doug Borg
91e5177056 Detect config drift in cached tile providers and replace stale instances
When a user edits a tile type's URL template, max zoom, or API key
without changing IDs, the cached DeflockTileProvider would keep the old
frozen config. Now _getOrCreateProvider() computes a config fingerprint
and replaces the provider when drift is detected.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 12:34:01 -07:00
Doug Borg
f3f40f36ef Allow OSM offline downloads, disable button for restricted providers
Allow offline area downloads for OSM tile server. Move the "downloads
not permitted" check from inside the download dialog to the download
button itself — the button is now disabled (greyed out) when the
current tile type doesn't support offline downloads.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 12:34:01 -07:00
Doug Borg
2d92214bed Add offline-first tile system with per-provider caching and error retry
- Add ServicePolicy framework with OSM-specific rate limiting and TTL
- Add per-provider disk tile cache (ProviderTileCacheStore) with O(1)
  lookup, oldest-modified eviction, and ETag/304 revalidation
- Rewrite DeflockTileProvider with two paths: common (NetworkTileProvider)
  and offline-first (disk cache -> local tiles -> network with caching)
- Add zoom-aware offline routing so tiles outside offline area zoom ranges
  use the efficient common path instead of the overhead-heavy offline path
- Fix HTTP client lifecycle: dispose() is now a no-op for flutter_map
  widget recycling; shutdown() handles permanent teardown
- Add TileLayerManager with exponential backoff retry (2s->60s cap),
  provider switch detection, and backoff reset
- Guard null provider/tileType in download dialog with localized error
- Fix Nominatim cache key to use normalized viewbox values
- Comprehensive test coverage (1800+ lines across 6 test files)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 12:34:01 -07:00
stopflock
be446fbcbc Merge pull request #140 from FoggedLens/fix/force-simulate-without-secrets
Force simulate mode when OAuth secrets are missing
2026-03-07 12:34:42 -06:00
Doug Borg
5728b4f70f Force simulate mode when OSM OAuth secrets are missing
Preview/PR builds don't have access to GitHub Secrets, so the OAuth
client IDs are empty. Previously this caused a runtime crash from
keys.dart throwing on empty values. Now we detect missing secrets
and force simulate mode, which already fully supports fake auth
and uploads.

Also fixes a latent bug where forceLogin() would crash with
LateInitializationError in simulate mode since _helper is never
initialized when OAuth setup is skipped.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 11:25:17 -07:00
stopflock
aeb1903bbc Merge pull request #135 from subfloor201/chore/update-do_builds.sh
Don't require trailing new line in build.keys.conf
2026-03-03 16:04:03 -06:00
stopflock
57df8e83a7 fix tests for profile order, add correct migration 2026-03-02 13:56:07 -06:00
stopflock
bc671c4efe Fix phantom FOVs, reorderable profiles 2026-03-02 12:38:49 -06:00
jay
4941c2726d don't require trailing new line in build.keys.conf 2026-02-27 23:59:16 -06:00
stopflock
b56e9325b3 Update changelog.json
280
2026-02-25 19:28:48 -06:00
stopflock
30f546be29 Update pubspec.yaml
bump version
2026-02-25 19:27:59 -06:00
stopflock
dc817e5eb7 Merge pull request #115 from dougborg/chore/ios26-sdk
Build with iOS 26 SDK for App Store deadline
2026-02-25 17:07:23 -06:00
stopflock
e1cca2f503 Merge pull request #85 from dougborg/chore/deps-applinks-packageinfo
chore(deps): Update app_links and package_info_plus to latest majors
2026-02-25 16:38:05 -06:00
Doug Borg
abd8682b49 Build with iOS 26 SDK to meet App Store deadline
Apple requires all iOS/iPadOS apps to be built with the iOS 26 SDK
(Xcode 26+) starting April 28, 2026. Switch the build-ios and
upload-to-stores jobs from macos-latest (macOS 15 / Xcode 16) to
macos-26 (macOS 26 / Xcode 26).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 15:32:16 -07:00
Doug Borg
90a806a10d chore(deps): upgrade minor/patch dependencies within existing constraints
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 15:32:00 -07:00
Doug Borg
b6bcd23667 chore(android): bump Dart SDK floor, desugar_jdk_libs, and fix Kotlin DSL deprecation
- Bump Dart SDK constraint from >=3.8.0 to >=3.10.3 to match resolved dependency floor
- Upgrade desugar_jdk_libs from 2.0.4 to 2.1.5 (adds Stream.toList(), better locale support)
- Migrate deprecated kotlinOptions { jvmTarget } to kotlin { compilerOptions { jvmTarget } }
- Remove stale comments and non-breaking space characters

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 15:32:00 -07:00
Doug Borg
dba375c63d chore(deps): update app_links and package_info_plus to latest major versions
Upgrade packages:
- app_links: ^6.1.4 → ^7.0.0 (backward compatible with v6)
- package_info_plus: ^8.0.0 → ^9.0.0 (build tooling only, no Dart API changes)

Bump Android build tooling to latest Flutter 3.38-compatible versions:
- AGP: 8.9.1 → 8.11.1
- Gradle: 8.12 → 8.14
- Kotlin: 2.1.0 → 2.2.20

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 15:20:50 -07:00
stopflock
6c52541361 Merge pull request #84 from dougborg/chore/deps-auth-stable
chore(deps): Move auth packages to stable releases
2026-02-25 15:11:10 -06:00
stopflock
fcf7ff7a98 Merge pull request #82 from dougborg/chore/deps-minor-patch
chore(deps): Upgrade minor/patch dependencies
2026-02-25 15:07:58 -06:00
Doug Borg
206b3afe9d chore(deps): move flutter_web_auth_2 and flutter_secure_storage to stable releases
Move auth-critical packages from pre-release pins to stable:
- flutter_web_auth_2: 5.0.0-alpha.3 → ^5.0.1
- flutter_secure_storage: 10.0.0-beta.4 → ^10.0.0
- oauth2_client: 4.2.0 → 4.2.3 (auto-resolved, was blocked by pre-release pins)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 09:45:38 -07:00
Doug Borg
e72d557d2a chore(android): bump AGP to 8.9.1 and Java compatibility to 17
Transitive AndroidX dependencies (browser:1.9.0, core-ktx:1.17.0,
core:1.17.0) pulled in by the pub upgrade now require AGP 8.9.1+.

- AGP: 8.7.3 → 8.9.1
- Java source/target compatibility: 11 → 17
- Gradle 8.12 already satisfies AGP 8.9.1's minimum of 8.11.1

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 09:45:38 -07:00
Doug Borg
25a34aab0b chore(deps): upgrade minor/patch dependencies within existing constraints
Run `flutter pub upgrade` to pull in 42 dependency updates within
existing ^constraints. No pubspec.yaml changes needed.

Notable updates: flutter_map 8.2.1→8.2.2, flutter_svg 2.2.0→2.2.3,
http 1.5.0-beta.2→1.6.0, provider 6.1.5→6.1.5+1,
shared_preferences 2.5.3→2.5.4, uuid 4.5.1→4.5.2, xml 6.5.0→6.6.1,
flutter_native_splash 2.4.6→2.4.7, plus many transitive deps.

Closes #78

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 09:45:38 -07:00
stopflock
610c5c71b1 Merge pull request #127 from dougborg/hybrid-tile-provider
Delegate network tile fetching to NetworkTileProvider
2026-02-24 21:31:11 -06:00
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
stopflock
9448305738 Merge pull request #123 from dougborg/feat/consistent-user-agent
Add consistent User-Agent header to all HTTP clients
2026-02-24 20:37:49 -06:00
Doug Borg
775148cfb7 Bump version to 2.7.2+48
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 19:31:31 -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
fe20356734 Merge branch 'main' of github.com:dougborg/deflock-app
* 'main' of github.com:dougborg/deflock-app:
  Comment on commit c7cfdc471c by dougborg on 2026-02-11 02:14:40 UTC
2026-02-24 18:59:03 -07:00
stopflock
14d7c10ca6 Merge pull request #116 from dougborg/ci/pr-build-artifacts
Add debug build artifacts to PR workflow
2026-02-24 19:44:15 -06:00
Doug Borg
348256270d Cache Flutter SDK, Gradle, and CocoaPods in CI
Cold Gradle builds were taking ~8.5 min for the APK job. Add
caching for Flutter/pub (via flutter-action), Gradle deps, and
CocoaPods to speed up subsequent runs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 18:29:02 -07:00
Doug Borg
8a759e88e9 Add debug build artifacts and download links to PR workflow
Let reviewers download and test PR changes on a device without building
locally. A sticky PR comment links directly to the artifacts page.

Closes #52

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 18:29:02 -07:00
stopflock
e168b6e19c Dutch, Polish, Turkish, Ukrainian 2026-02-15 13:20:15 -06:00
stopflock
f78ea1a300 no dev mode - publishing 2026-02-14 14:50:38 -06:00
stopflock
2dca311d2a changelog, version 2026-02-14 14:42:39 -06:00
stopflock
7470b14e38 Merge pull request #113 from dougborg/fix/overpass-out-skel
Use out skel for Overpass way/relation pass
2026-02-14 14:30:08 -06: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
1429f1d02b Merge pull request #41 from dougborg/fix/map-jitter-on-touch
Fix map jitter/wiggle when touching at low zoom
2026-02-14 13:17:43 -06:00
Doug Borg
f0f23489b5 Fix map jitter when touching map during follow-me animations
Cancel in-progress follow-me animations on pointer-down and suppress
new ones while any pointer is on the map. Without this, GPS position
updates trigger 600ms animateTo() calls that fight with the user's
stationary finger, causing visible wiggle — especially at low zoom
where small geographic shifts cover more pixels.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 02:02:51 -07:00
Doug Borg
9ae7d9c894 Merge branch 'main' of github.com:FoggedLens/deflock-app
* 'main' of github.com:FoggedLens/deflock-app:
  Remove simulation tests that don't exercise production code
  Guard onFieldSubmitted on non-empty text to prevent cleared values reappearing
  Add tests demonstrating RawAutocomplete onSubmitted bug
  no longer lose operator profile selection when making other changes to a node
  bump version
  Move README roadmap items to GitHub Issues
  Address PR review: truncate error response logs and close http client
  Fix route calculation HTTP 400 by filtering empty profile tags
  Add tests for routing service and node profile serialization
  Make suggestion limit configurable and remove redundant .take(10) from widget
  Materialize options iterable to list in optionsViewBuilder
  Fix dropdown dismiss by replacing manual overlay with RawAutocomplete
  Address Copilot review feedback on PR #46
  Bump Dart SDK constraint to >=3.8.0 and document Flutter 3.35+ requirement
  Rewrite dev setup docs with tested, copy-pasteable instructions
2026-02-11 11:13:53 -07:00
stopflock
c8e396a6eb Merge pull request #104 from dougborg/fix/tag-value-clear-on-done
Fix tag value reappearing after clearing and pressing Done
2026-02-10 20:31:25 -06:00
Doug Borg
97675f9f48 Comment on commit c7cfdc471c by dougborg on 2026-02-11 02:14:40 UTC 2026-02-10 19:14:52 -07:00
Doug Borg
75014be485 Remove simulation tests that don't exercise production code
The RawAutocomplete tests proved the pattern and fix but never
instantiated NSITagValueField itself — no actual coverage gained.
PR #36 replaces the widget entirely, so investing in testability
here isn't worthwhile.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 19:01:09 -07:00
Doug Borg
af42e18f6e Guard onFieldSubmitted on non-empty text to prevent cleared values reappearing
When a user clears a tag value and presses Done, RawAutocomplete's
onFieldSubmitted auto-selects the first option from the suggestions
list. Since optionsBuilder returns all suggestions for empty text,
this causes the cleared value to reappear. Guarding the call on
non-empty text prevents the auto-selection while preserving
autocomplete behavior when the user has typed a partial match.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 18:56:28 -07:00
Doug Borg
c7cfdc471c Add tests demonstrating RawAutocomplete onSubmitted bug
RawAutocomplete.onFieldSubmitted auto-selects the first option when
called, which means pressing "Done" on an empty tag value field
re-populates it with the first NSI suggestion. These tests prove the
bug exists (unguarded path) and verify the fix (guarded path).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 18:56:18 -07:00
stopflock
19b3ca236e no longer lose operator profile selection when making other changes to a node 2026-02-10 18:28:07 -06:00
stopflock
2e0dcb1b2b bump version 2026-02-09 23:59:08 -06: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
stopflock
83370fba7e Merge pull request #77 from dougborg/chore/roadmap-to-issues
Move README roadmap to GitHub Issues
2026-02-09 18:23:52 -06:00
stopflock
ba6c7cdbda Merge pull request #40 from dougborg/investigate/dropdown-dismiss
Fix suggestion dropdown dismiss on tap outside
2026-02-09 18:17:53 -06:00
Doug Borg
311125e1f5 Move README roadmap items to GitHub Issues
Replace the inline roadmap section with a link to GitHub Issues.
Each roadmap item has been created as a proper issue (#55-#76) for
better tracking, discussion, and prioritization.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 14:53:45 -07: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
6607e30038 Add tests for routing service and node profile serialization
Route calculation to alprwatch API fails with HTTP 400 because
built-in profiles include empty tag values (e.g. camera:mount: '')
that get serialized into the request body and rejected by the API.

Add routing_service_test.dart with 5 tests:
- Empty tags filtered from request (reproduces the bug)
- Successful route parsing
- HTTP error handling
- Network error wrapping
- API-level error surfacing

Add node_profile_test.dart with 4 tests:
- toJson/fromJson round-trip
- getDefaults returns expected profiles
- Empty tag values exist in defaults (documents bug origin)
- Equality based on id

Tests require RoutingService to accept an injectable http.Client,
which will be added in the next commit along with the fix.

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
ef6fc1c9c8 Materialize options iterable to list in optionsViewBuilder
Avoids repeated iteration of the lazy .where().take() iterable on each
call to .length and .elementAt() in ListView.builder.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 14:31:37 -07:00
Doug Borg
26c85df7e8 Fix dropdown dismiss by replacing manual overlay with RawAutocomplete
NSITagValueField used raw OverlayEntry + CompositedTransformFollower
with no tap-outside dismiss mechanism, causing suggestion dropdowns to
stay visible when tapping elsewhere. Replace with Flutter's
RawAutocomplete which handles dismiss, keyboard navigation, and
accessibility out of the box.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 14:31:37 -07:00
stopflock
20c1b9b108 Merge pull request #46 from dougborg/docs/dev-setup-guide
Rewrite dev setup docs with tested instructions
2026-02-09 15:18:58 -06:00
Doug Borg
0207f999ee Address Copilot review feedback on PR #46
- build.gradle.kts: use maxOf(flutter.minSdkVersion, 23) to preserve
  the floor required by oauth2_client/flutter_web_auth_2
- DEVELOPER.md: replace hardcoded /opt/homebrew paths with
  $(brew --prefix) for Intel Mac compatibility, use $HOME instead
  of /Users/$USER for --sdk_root
- README.md: label quick-start as macOS-specific, add cross-platform
  pointer to DEVELOPER.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 13:59:11 -07:00
Doug Borg
4a342aee9d Bump Dart SDK constraint to >=3.8.0 and document Flutter 3.35+ requirement
The RadioGroup widget (merged via PR #35) requires Flutter 3.35+ /
Dart 3.8+. The old constraint (>=3.5.0) allowed older SDKs that don't
have RadioGroup, causing cryptic build errors instead of a clear
version mismatch from pub get.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 13:54:42 -07:00
Doug Borg
3827a6fa1d Rewrite dev setup docs with tested, copy-pasteable instructions
Replaces the vague "Latest stable version" prerequisites in DEVELOPER.md
with concrete commands tested on a fresh macOS machine. Adds Android SDK
setup without Android Studio, documents the gen_icons_splashes.sh
requirement, and fixes the OAuth2 config to reference build_keys.conf
instead of the removed keys.dart.example. Also includes Flutter SDK
auto-migrations (iOS 13.0 min, gradle minSdk).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 13:54:42 -07:00
stopflock
ed38e9467c Merge pull request #47 from dougborg/fix/map-bounds-null-safety
Fix null-safety issue with mapBounds in getNearbyNodes
2026-02-09 14:52:26 -06:00
Doug Borg
d124cee9b3 Fix null-safety issue with mapBounds in getNearbyNodes
Change mapBounds from LatLngBounds? to final LatLngBounds so the
compiler can prove it's non-null after the inner try-catch. Addresses
review comment on PR #45.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 13:47:15 -07:00
stopflock
c13dd8e58a Merge pull request #45 from dougborg/pr/fix-upstream-lint
Fix lint warnings after RadioGroup migration
2026-02-09 14:42:25 -06: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
stopflock
98b73fe019 Merge pull request #35 from dougborg/pr/03-radiogroup
Migrate Radio to RadioGroup widget
2026-02-09 14:26:34 -06:00
stopflock
86e0d656d3 Merge pull request #34 from dougborg/pr/02-lint-cleanup
Add flutter_lints and fix all analyzer warnings
2026-02-09 11:43:48 -06:00
stopflock
a149562001 Merge pull request #38 from dougborg/pr/add-pr-validation-workflow
Add PR validation workflow
2026-02-08 20:19:13 -06:00
Doug Borg
e4b36719d7 Migrate Radio groupValue/onChanged to RadioGroup widget 2026-02-08 14:23:37 -07:00
Doug Borg
3570104800 Add mounted guards for BuildContext use across async gaps 2026-02-08 14:23:07 -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
3dada20ec2 Replace deprecated withOpacity and surfaceVariant APIs
Migrate all withOpacity() calls to withValues(alpha:) and
surfaceVariant to surfaceContainerHighest across the codebase.

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
stopflock
498e36f69d Merge pull request #39 from dougborg/pr/localization-fixes
Replace deprecated localization APIs and add test coverage
2026-02-08 12:53:25 -06:00
Doug Borg
e2d0d1b790 Replace deleted validation script with flutter test in build scripts
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 22:31:48 -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
Doug Borg
7e67859b2f Add PR validation workflow for analyze and test
No CI currently runs on pull requests — the only workflow triggers on
releases. This adds a lightweight, secrets-free workflow that runs
flutter analyze and flutter test on PRs to main and pushes to main.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 13:57:50 -07:00
stopflock
e559b86400 Merge pull request #33 from dougborg/pr/01-test-fixes
Fix pre-existing test failures in tile provider tests
2026-02-07 13:04:51 -06:00
Doug Borg
73160c32de Add mocktail dev dependency and fix test state leak
Address PR review comments:
- Add mocktail and flutter_test to dev_dependencies in pubspec.yaml
- Add tearDown to reset AppState.instance between tests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 11:35:28 -07:00
Doug Borg
d6f7e99941 Fix pre-existing test failures in tile provider tests
- tile_provider_test: Fix stale package:flock_map_app import (now
  deflockapp), correct test assertion for Mapbox requiring API key
- deflock_tile_provider_test: Fix relative imports, replace invalid
  const TileLayer with final, mock AppState.instance for getImage test
- Remove widget_test.dart (default flutter create scaffold, references
  nonexistent MyApp counter widget)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-07 11:27:39 -07:00
stopflock
0ffb7956c5 clear search box after selecting first nav point 2026-02-06 21:08:01 -06:00
stopflock
2620c8758e dev mode, imperial units incl. custom scalebar 2026-02-06 20:28:08 -06:00
stopflock
8804fdadf4 Remove special "existing tags" profile case; existing tags profile now empty. 2026-02-06 09:56:08 -06:00
stopflock
c50d43e00c Pass through all extraneous tags on an existing node, always. Strip out special case for "existing tags" profile, replace with an empty temp profile so all can be treated the same. 2026-02-05 13:21:54 -06:00
stopflock
5df16f376d Move upload queue pause toggle from offline to queue page in settings 2026-02-03 17:00:02 -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
ff5821b184 Prevent no-change edit submissions 2026-02-01 16:51:35 -06:00
stopflock
dd1838319d roadmap 2026-02-01 16:08:36 -06:00
stopflock
f76268f241 get rid of old versions of edited nodes when submitting in sim mode 2026-02-01 16:02:49 -06:00
stopflock
ba3b844c1e "existing tags" temp profile when editing, "existing operator" profile when such tags exist, full editing of existing nodes via refine tags 2026-02-01 14:50:47 -06:00
stopflock
1dd0258c0b cleanup, bump version 2026-01-31 17:35:42 -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
d095736078 roadmap 2026-01-31 17:18:58 -06:00
stopflock
77648db32f roadmap 2026-01-31 17:06:09 -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
a34b786918 roadmap 2026-01-30 22:33:27 -06:00
stopflock
6707efebbe Fix color of "get more" link text in profile dropdown 2026-01-30 21:49:27 -06:00
stopflock
69ebd43e0d bump to 2.6 2026-01-30 21:37:12 -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
stopflock
f478a3eb2d Clean up FOV cone debug logging 2026-01-30 18:55:29 -06:00
stopflock
9621e5f35a "Get more" link in profile dropdown, suggest identify page when creating profile 2026-01-30 12:56:50 -06:00
stopflock
f048ebc7db Merge pull request #28 from heathdutton/issue-27-search-viewbox
Pass (rough) viewbox to search for location-biased results
2026-01-29 12:45:35 -06:00
Heath Dutton🕴️
33ae6473bb pass viewbox to nominatim search for location-biased results 2026-01-29 10:42:56 -05:00
stopflock
0957670a15 roadmap 2026-01-28 20:36:46 -06:00
stopflock
3fc3a72cde Fixes for 360-deg FOVs 2026-01-28 20:21:25 -06:00
stopflock
1d65d5ecca v2.4.1, adds profile import via deeplink, moves profile save button, fixes FOV clearing, disable direction slider while submitting with 360-fov profile 2026-01-28 18:13:49 -06:00
stopflock
1873d6e768 profile import from deeplinks 2026-01-28 15:20:25 -06:00
stopflock
4638a18887 roadmap 2026-01-28 15:20:25 -06:00
stopflock
6bfdfadd97 Merge pull request #29 from pbaehr/main
Update running instructions in DEVELOPER.md
2026-01-25 16:37:52 -06:00
Peter Baehr
72f3c9ee79 Update running instructions in DEVELOPER.md
Add script execution and client ID definition to run instructions
2026-01-21 16:29:03 -05:00
stopflock
05e2e4e7c6 roadmap 2026-01-14 12:23:28 -06:00
stopflock
2e679c9a7e roadmap 2026-01-13 15:06:55 -06:00
stopflock
3ef053126b fix changelog syntax issue - missing comma 2026-01-13 15:03:07 -06:00
stopflock
ae354c43a4 drop approx location support, restore follow me mode on sheet close 2025-12-24 15:29:32 -06:00
stopflock
34eac41a96 bump ver 2025-12-23 18:18:16 -06:00
stopflock
816dadfbd1 devibe changelog 2025-12-23 17:58:06 -06:00
stopflock
607ecbafaf Concurrent submissions 2025-12-23 17:56:16 -06:00
stopflock
8b44b3abf5 Better loading indicator 2025-12-23 16:17:06 -06:00
stopflock
a675cf185a roadmap 2025-12-23 13:47:05 -06:00
stopflock
26b479bf20 forgot to update roadmap 2025-12-23 12:04:30 -06:00
stopflock
ae795a7607 configurable overpass query timeout; increased to 45s 2025-12-23 12:03:53 -06:00
stopflock
a05e03567e shorten nav timeout to reasonable number 2025-12-23 11:39:25 -06:00
stopflock
da6887f7d3 update roadmap 2025-12-23 11:38:54 -06:00
158 changed files with 14324 additions and 3366 deletions

167
.github/workflows/pr.yml vendored Normal file
View File

@@ -0,0 +1,167 @@
name: Validate PR
on:
pull_request:
branches: [main]
push:
branches: [main]
jobs:
validate:
name: Analyze & Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true
- run: flutter pub get
- name: Analyze
run: flutter analyze
- name: Test
run: flutter test
build-debug-apk:
name: Build Debug APK
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '17'
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true
- uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: gradle-${{ runner.os }}-
- run: flutter pub get
- name: Generate icons and splash screens
run: |
dart run flutter_launcher_icons
dart run flutter_native_splash:create
- name: Build debug APK
run: flutter build apk --debug
- name: Upload debug APK
uses: actions/upload-artifact@v4
with:
name: debug-apk
path: build/app/outputs/flutter-apk/app-debug.apk
if-no-files-found: error
retention-days: 14
build-ios-simulator:
name: Build iOS Simulator
runs-on: macos-26
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v5
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true
- uses: actions/cache@v4
with:
path: ios/Pods
key: pods-${{ runner.os }}-${{ hashFiles('ios/Podfile.lock') }}
restore-keys: pods-${{ runner.os }}-
- run: flutter pub get
- name: Generate icons and splash screens
run: |
dart run flutter_launcher_icons
dart run flutter_native_splash:create
- name: Build iOS simulator app
run: flutter build ios --debug --simulator
- name: Zip Runner.app
run: cd build/ios/iphonesimulator && zip -r "$GITHUB_WORKSPACE/Runner.app.zip" Runner.app
- name: Upload simulator build
uses: actions/upload-artifact@v4
with:
name: ios-simulator
path: Runner.app.zip
if-no-files-found: error
retention-days: 14
comment-artifacts:
name: Post Artifact Links
needs: [build-debug-apk, build-ios-simulator]
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && !cancelled()
permissions:
pull-requests: write
steps:
- uses: actions/github-script@v7
continue-on-error: true
env:
APK_RESULT: ${{ needs.build-debug-apk.result }}
IOS_RESULT: ${{ needs.build-ios-simulator.result }}
with:
script: |
const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}#artifacts`;
const apkOk = process.env.APK_RESULT === 'success';
const iosOk = process.env.IOS_RESULT === 'success';
const lines = ['## Debug builds', ''];
if (apkOk || iosOk) {
lines.push(`Download from the [artifacts page](${runUrl}):`);
if (apkOk) lines.push('- **debug-apk** — install on Android device/emulator');
if (iosOk) lines.push('- **ios-simulator** — unzip and install with `xcrun simctl install booted Runner.app`');
}
if (!apkOk || !iosOk) {
const failed = [];
if (!apkOk) failed.push('Android APK');
if (!iosOk) failed.push('iOS simulator');
lines.push('', `**Failed:** ${failed.join(', ')} — check the [workflow run](${runUrl}) for details.`);
}
const body = lines.join('\n');
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
const existing = comments.find(c => c.body.startsWith('## Debug builds'));
if (existing) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existing.id,
body,
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body,
});
}

View File

@@ -58,8 +58,8 @@ jobs:
- name: Install dependencies
run: flutter pub get
- name: Validate localizations
run: dart run scripts/validate_localizations.dart
- name: Run tests
run: flutter test
- name: Generate icons and splash screens
run: |
@@ -110,8 +110,8 @@ jobs:
- name: Install dependencies
run: flutter pub get
- name: Validate localizations
run: dart run scripts/validate_localizations.dart
- name: Run tests
run: flutter test
- name: Generate icons and splash screens
run: |
@@ -142,7 +142,7 @@ jobs:
build-ios:
name: Build iOS
needs: get-version
runs-on: macos-latest
runs-on: macos-26
steps:
- name: Checkout repository
uses: actions/checkout@v5
@@ -155,8 +155,8 @@ jobs:
- name: Install dependencies
run: flutter pub get
- name: Validate localizations
run: dart run scripts/validate_localizations.dart
- name: Run tests
run: flutter test
- name: Generate icons and splash screens
run: |
@@ -290,7 +290,7 @@ jobs:
upload-to-stores:
name: Upload to App Stores
needs: [get-version, build-android-aab, build-ios]
runs-on: macos-latest # Need macOS for iOS uploads
runs-on: macos-26 # Need macOS for iOS uploads
if: needs.get-version.outputs.should_upload_to_stores == 'true'
steps:
- name: Download AAB artifact for Google Play

3
.gitignore vendored
View File

@@ -73,12 +73,13 @@ fuchsia/build/
web/build/
# ───────────────────────────────
# IDE / Editor Settings
# IDE / Editor / AI Tool Settings
# ───────────────────────────────
.idea/
.idea/**/workspace.xml
.idea/**/tasks.xml
.vscode/
.claude/settings.local.json
# Swap files
*.swp
*.swo

11
COMMENT Normal file
View File

@@ -0,0 +1,11 @@
---
An alternative approach to addressing this issue could be adjusting the `optionsBuilder` logic to avoid returning any suggestions when the input text field is empty, rather than guarding `onFieldSubmitted`. For instance:
```dart
optionsBuilder: (TextEditingValue textEditingValue) {
if (textEditingValue.text.isEmpty) return <String>[];
return suggestions.where((s) => s.contains(textEditingValue.text));
}
```
This ensures that the `RawAutocomplete` widget doesn't offer any options to auto-select on submission when the field is cleared, potentially simplifying the implementation and avoiding the need for additional boolean flags (`guardOnSubmitted`). This pattern can be seen in some implementations "in the wild."

View File

@@ -97,10 +97,15 @@ Changelog content is stored in `assets/changelog.json`:
### User Experience Flow
- **First Launch**: Welcome popup with "don't show again" option
- **Location Permission**: Requested immediately after welcome dialog on first launch (v2.6.3+)
- **First Submission**: Submission guide popup with best practices and resource links
- **Version Updates**: Changelog popup (only if content exists, no "don't show again")
- **Settings Access**: Complete changelog history available in Settings > About > Release Notes
### Permission Handling (Updated v2.6.3)
- **Location Permission**: Requested on first launch for core GPS functionality
- **Notification Permission**: Requested on-demand when user enables proximity alerts
### Privacy Integration
The welcome popup explains that the app:
- Runs entirely locally on device
@@ -202,15 +207,24 @@ Deletions don't need position dragging or tag editing - they just need confirmat
- Retries: Exponential backoff up to 59 minutes
- Failures: OSM auto-closes after 60 minutes, so we eventually give up
**Queue processing workflow:**
**Queue processing workflow (v2.3.0+ concurrent processing):**
1. User action (add/edit/delete) → `PendingUpload` created with `UploadState.pending`
2. Immediate visual feedback (cache updated with temp markers)
3. Background uploader processes queue when online:
3. Background uploader starts new uploads every 5 seconds (configurable via `kUploadQueueProcessingInterval`):
- **Concurrency limit**: Maximum 5 uploads processing simultaneously (`kMaxConcurrentUploads`)
- **Individual lifecycles**: Each upload processes through all three stages independently
- **Timer role**: Only used to start new pending uploads, not control stage progression
4. Each upload processes through stages without waiting for other uploads:
- **Pending** → Create changeset → **CreatingChangeset****Uploading**
- **Uploading** → Upload node → **ClosingChangeset**
- **ClosingChangeset** → Close changeset → **Complete**
4. Success → cache updated with real data, temp markers removed
5. Failures → appropriate retry logic based on which stage failed
5. Success → cache updated with real data, temp markers removed
6. Failures → appropriate retry logic based on which stage failed
**Performance improvement (v2.3.0):**
- **Before**: Sequential processing with 10-second delays between each stage of each upload
- **After**: Concurrent processing with uploads completing in 10-30 seconds regardless of queue size
- **User benefit**: 3-5x faster upload processing for users with good internet connections
**Why three explicit stages:**
The previous implementation conflated changeset creation + node operation as one step, making error handling unclear. The new approach:
@@ -356,11 +370,13 @@ Local cache contains production data. Showing production nodes in sandbox mode w
- **Dual alert types**: Push notifications (background) and visual banners (foreground)
- **Configurable distance**: 25-200 meter alert radius
- **Battery awareness**: Users explicitly opt into background location monitoring
- **On-demand permissions**: Notification permission requested only when user enables proximity alerts (v2.6.3+)
**Implementation notes:**
- Uses Flutter Local Notifications for cross-platform background alerts
- Simple RecentAlert tracking prevents duplicate notifications
- Visual callback system for in-app alerts when app is active
- Permission requests deferred until feature activation for better UX
### 9. Compass Indicator & North Lock
@@ -386,30 +402,39 @@ Local cache contains production data. Showing production nodes in sandbox mode w
**Why separate from follow mode:**
Users often want to follow their location while keeping the map oriented north. Previous "north up" follow mode was confusing because it didn't actually keep north up. This separation provides clear, predictable behavior.
### 10. Network Status Indicator (Simplified in v1.5.2+)
### 10. Network Status Indicator (Refactored in v2.6.1)
**Purpose**: Show loading and error states for surveillance data fetching only
**Simplified approach (v1.5.2+):**
- **Surveillance data focus**: Only tracks node/camera data loading, not tile loading
- **Visual feedback**: Tiles show their own loading progress naturally
- **Reduced complexity**: Eliminated tile completion tracking and multiple issue types
**Brutalist approach (v2.6.1+):**
- **Single enum state**: Replaced multiple boolean flags with simple `NetworkRequestStatus` enum
- **User-initiated only**: Only tracks latest user-initiated requests (pan/zoom), background requests ignored
- **Auto-reset timers**: Different timeouts for different states (success: 2s, errors: 5s, rate limit: 2min)
**Status types:**
- **Loading**: Shows when fetching surveillance data from APIs
- **Success**: Brief confirmation when data loads successfully
- **Timeout**: Network request timeouts
- **Limit reached**: When node display limit is hit
- **API issues**: Overpass/OSM API problems only
**Status states:**
```dart
enum NetworkRequestStatus {
idle, // No indicator shown
loading, // Initial request in progress
splitting, // Request being split due to limits/timeouts
success, // Data loaded successfully (brief confirmation)
timeout, // Request timed out
rateLimited, // API rate limited
noData, // No offline data available
error, // Other network errors
}
```
**What was removed:**
- Tile server issue tracking (tiles handle their own progress)
- "Both" network issue type (only surveillance data matters)
- Complex semaphore-based completion detection
- Tile-related status messages and localizations
**State transitions:**
- **Normal flow**: `idle``loading``success``idle`
- **Split requests**: `loading``splitting``success``idle`
- **Errors**: `loading``timeout/error/rateLimited``idle`
**Why the change:**
The previous approach tracked both tile loading and surveillance data, creating redundancy since tiles already show loading progress visually on the map. Users don't need to be notified about tile loading issues when they can see tiles loading/failing directly. Focusing only on surveillance data makes the indicator more purposeful and less noisy.
**Why the refactor:**
The previous system used multiple boolean flags with complex reconciliation logic, creating potential for conflicting states and race conditions. The new enum-based approach provides clear, explicit state management with predictable transitions and eliminates complexity while maintaining all functionality.
**Request ownership:**
Only user-initiated requests (pan, zoom, manual refresh) report status. Background requests (pre-fetch, cache warming) complete silently to avoid status indicator noise.
### 11. Suspected Locations (v1.8.0+: SQLite Database Storage)
@@ -775,32 +800,104 @@ The app uses a **clean, release-triggered workflow** that rebuilds from scratch
## Build & Development Setup
### Prerequisites
- **Flutter SDK**: Latest stable version
- **Xcode**: For iOS builds (macOS only)
- **Android Studio**: For Android builds
- **Git**: For version control
**macOS** (required for iOS builds; Android-only contributors can use macOS or Linux):
| Tool | Install | Notes |
|------|---------|-------|
| **Homebrew** | [brew.sh](https://brew.sh) | Package manager for macOS |
| **Flutter SDK 3.35+** | `brew install --cask flutter` | Installs Flutter + Dart (3.35+ required for RadioGroup widget) |
| **Xcode** | Mac App Store | Required for iOS builds |
| **CocoaPods** | `brew install cocoapods` | Required for iOS plugin resolution |
| **Android SDK** | See below | Required for Android builds |
| **Java 17+** | `brew install --cask temurin` | Required by Android toolchain (skip if already installed) |
After installing, verify with:
```bash
flutter doctor # All checks should be green
```
### Android SDK Setup (without Android Studio)
You don't need the full Android Studio IDE. Install the command-line tools and let Flutter's build system pull what it needs:
```bash
# 1. Install command-line tools
brew install --cask android-commandlinetools
# 2. Create the SDK directory and install required components
mkdir -p ~/Library/Android/sdk/licenses
# Write license acceptance hashes
printf "\n24333f8a63b6825ea9c5514f83c2829b004d1fee" > ~/Library/Android/sdk/licenses/android-sdk-license
printf "\n84831b9409646a918e30573bab4c9c91346d8abd" > ~/Library/Android/sdk/licenses/android-sdk-preview-license
# 3. Install platform tools and the SDK platform Flutter needs
"$(brew --prefix android-commandlinetools)/cmdline-tools/latest/bin/sdkmanager" \
--sdk_root="$HOME/Library/Android/sdk" \
"platform-tools" "platforms;android-36" "build-tools;35.0.0"
# 4. Copy cmdline-tools into the SDK root (Flutter expects them there)
mkdir -p ~/Library/Android/sdk/cmdline-tools
cp -R "$(brew --prefix android-commandlinetools)/cmdline-tools/latest" \
~/Library/Android/sdk/cmdline-tools/latest
# 5. Point Flutter at the SDK and accept licenses
flutter config --android-sdk ~/Library/Android/sdk
yes | flutter doctor --android-licenses
```
> **Note:** The first `flutter build apk` will auto-download additional components it needs (NDK, CMake, etc). This is normal and only happens once.
### OAuth2 Setup
**Required registrations:**
To run the app with working OSM authentication, register OAuth2 applications:
1. **Production OSM**: https://www.openstreetmap.org/oauth2/applications
2. **Sandbox OSM**: https://master.apis.dev.openstreetmap.org/oauth2/applications
**Configuration:**
For local builds, create `build_keys.conf` (gitignored):
```bash
cp lib/keys.dart.example lib/keys.dart
# Edit keys.dart with your OAuth2 client IDs
cp build_keys.conf.example build_keys.conf
# Edit build_keys.conf with your OAuth2 client IDs
```
### iOS Setup
You can also pass keys directly via `--dart-define`:
```bash
cd ios && pod install
flutter run --dart-define=OSM_PROD_CLIENTID=your_id --dart-define=OSM_SANDBOX_CLIENTID=your_id
```
### First Build
```bash
# 1. Install dependencies
flutter pub get
# 2. Generate icons and splash screens (gitignored, must be regenerated)
./gen_icons_splashes.sh
# 3. Build Android
flutter build apk --debug \
--dart-define=OSM_PROD_CLIENTID=your_id \
--dart-define=OSM_SANDBOX_CLIENTID=your_id
# 4. Build iOS (macOS only, no signing needed for testing)
flutter build ios --no-codesign \
--dart-define=OSM_PROD_CLIENTID=your_id \
--dart-define=OSM_SANDBOX_CLIENTID=your_id
```
> **Important:** You must run `./gen_icons_splashes.sh` before the first build. The generated icons and splash screen assets are gitignored, so the build will fail without this step.
### Running
```bash
flutter pub get
flutter run
# Run on connected device or simulator
flutter run --dart-define=OSM_PROD_CLIENTID=your_id --dart-define=OSM_SANDBOX_CLIENTID=your_id
# Or use the build script (reads keys from build_keys.conf)
./do_builds.sh # Both platforms
./do_builds.sh --android # Android only
./do_builds.sh --ios # iOS only
```
### Testing

View File

@@ -53,6 +53,12 @@ A comprehensive Flutter app for mapping public surveillance infrastructure with
- **Queue management**: Review, edit, retry, or cancel pending uploads
- **Changeset tracking**: Automatic grouping and commenting for organized contributions
### Profile Import & Sharing
- **Deep link support**: Import custom profiles via `deflockapp://profiles/add?p=<base64>` URLs
- **Website integration**: Generate profile import links from [deflock.me](https://deflock.me)
- **Pre-filled editor**: Imported profiles open in the profile editor for review and modification
- **Seamless workflow**: Edit imported profiles like any custom profile before saving
### Offline Operations
- **Smart area downloads**: Automatically calculate tile counts and storage requirements
- **Device caching**: Offline areas include surveillance device data for complete functionality without network
@@ -84,12 +90,16 @@ A comprehensive Flutter app for mapping public surveillance infrastructure with
- Code organization and contribution guidelines
- Debugging tips and troubleshooting
**Quick setup:**
**Quick setup (macOS with Homebrew):**
```shell
flutter pub get
cp lib/keys.dart.example lib/keys.dart
# Add OAuth2 client IDs, then: flutter run
brew install --cask flutter # Install Flutter SDK
brew install cocoapods # Required for iOS
flutter pub get # Install dependencies
./gen_icons_splashes.sh # Generate icons & splash screens (required before first build)
cp build_keys.conf.example build_keys.conf # Add your OSM OAuth2 client IDs
./do_builds.sh # Build both platforms
```
See [DEVELOPER.md](DEVELOPER.md) for cross-platform instructions and Android SDK setup.
**Releases**: The app uses GitHub's release system for automated building and store uploads. Simply create a GitHub release and use the "pre-release" checkbox to control whether builds go to app stores - checked for beta releases, unchecked for production releases.
@@ -97,42 +107,7 @@ cp lib/keys.dart.example lib/keys.dart
## Roadmap
### Needed Bugfixes
- Add cancel button to submission guide
- When not logged in, submit button should take users to settings>account to log in.
- Ensure GPS/follow-me works after recent revamp (loses lock? have to move map for button state to update?)
- Add new tags to top of a profile so they're visible immediately
- Allow arbitrary entry on refine tags page
- Don't show NSI suggestions that aren't sufficiently popular (image=)
- Clean cache when nodes have been deleted by others
- Are offline areas preferred for fast loading even when online? Check working.
### Current Development
- Add ability to downvote suspected locations which are old enough
- Turn by turn navigation or at least swipe nav sheet up to see a list
- Import/Export map providers, profiles (profiles from deflock identify page?)
### On Pause
- Offline navigation (pending vector map tiles)
### Future Features & Wishlist
- Optional reason message when deleting
- Update offline area data while browsing?
### Maybes
- Yellow ring for devices missing specific tag details
- Android Auto / CarPlay
- "Cache accumulating" offline area?
- "Offline areas" as tile provider?
- Grab the full latest database for each profile just like for suspected locations (instead of overpass)?
- Optional custom icons for profiles to aid identification
- Custom device providers and OSM/Overpass alternatives
- Offer options for extracting nodes which are attached to a way/relation:
- Auto extract (how?)
- Leave it alone (wrong answer unless user chooses intentionally)
- Manual cleanup (cognitive load for users)
- Delete the old one (also wrong answer unless user chooses intentionally)
- Give multiple of these options??
See [GitHub Issues](https://github.com/FoggedLens/deflock-app/issues) for the full list of planned features, known bugs, and ideas.
---

View File

@@ -17,29 +17,28 @@ if (keystorePropertiesFile.exists()) {
android {
namespace = "me.deflock.deflockapp"
// Matches current stable Flutter (compileSdk 34 as of July 2025)
compileSdk = 36
// NDK only needed if you build native plugins; keep your pinned version
ndkVersion = "27.0.12077973"
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
isCoreLibraryDesugaringEnabled = true
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
kotlin {
compilerOptions {
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
}
}
defaultConfig {
// Application ID (package name)
applicationId = "me.deflock.deflockapp"
// ────────────────────────────────────────────────────────────
// oauth2_client 4.x & flutter_web_auth_2 5.x require minSdk 23
// ────────────────────────────────────────────────────────────
minSdk = 23
// oauth2_client 4.x & flutter_web_auth_2 5.x require minSdk 23
minSdk = maxOf(flutter.minSdkVersion, 23)
targetSdk = 36
// Flutter tool injects these during `flutter build`
@@ -76,6 +75,5 @@ flutter {
}
dependencies {
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.4")
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.5")
}

View File

@@ -35,6 +35,14 @@
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<!-- Profile import deep links -->
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="deflockapp" android:host="profiles"/>
</intent-filter>
</activity>
<!-- flutter_web_auth_2 callback activity (V2 embedding) -->

View File

@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-all.zip

View File

@@ -18,8 +18,8 @@ pluginManagement {
plugins {
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
id("com.android.application") version "8.7.3" apply false
id("org.jetbrains.kotlin.android") version "2.1.0" apply false
id("com.android.application") version "8.11.1" apply false
id("org.jetbrains.kotlin.android") version "2.2.20" apply false
}
include(":app")

View File

@@ -1,4 +1,122 @@
{
"2.9.1": {
"content": [
"• When hitting node render limit, only render nodes closest to center of viewport.",
"• Moved to our own infrastructure for Overpass and routing services, with automatic fallback to public servers."
]
},
"2.9.0": {
"content": [
"• Caching, tile retries, offline areas, now working properly. Map imagery should load correctly."
]
},
"2.8.1": {
"content": [
"• Fixed bug where the \"existing tags\" profile would incorrectly add default FOV ranges during submission",
"• Added drag handles so profiles can be reordered to customize dropdown order when submitting"
]
},
"2.8.0": {
"content": [
"• Update dependencies and build chain tools; no code changes"
]
},
"2.7.2": {
"content": [
"• Now following OSM UserAgent guidelines"
]
},
"2.7.1": {
"content": [
"• Fixed operator profile selection being lost when moving node position, adjusting direction, or changing profiles",
"• Further improved node loading by only fetching what is needed to determine whether a node is attached to a way/relation"
]
},
"2.6.4": {
"content": [
"• Added imperial units support (miles, feet) in addition to metric units (km, meters)",
"• Moved units setting from Navigation to Language & Region settings page"
]
},
"2.6.3": {
"content": [
"• Improved first launch experience - location permission is now requested immediately after welcome dialog",
"• Prevent edit submissions where nothing (location, tags, direction) has been changed",
"• Allow customizing changeset comment on refine tags page",
"• Moved upload queue pause toggle to upload queue screen for better discoverability"
]
},
"2.6.2": {
"content": [
"• Enhanced edit workflow; new '<Existing tags>' profile preserves current tags while allowing direction and location edits",
"• New '<Existing operator>' profile when editing nodes with operator tags; preserves operator details automatically",
"• Tag pre-population; existing node values automatically fill empty profile tags to prevent data loss"
]
},
"2.6.1": {
"content": [
"• Simplified network status indicator - cleaner state management",
"• Improved error handling for surveillance data requests",
"• Better status reporting for background vs. user-initiated requests"
]
},
"2.6.0": {
"content": [
"• Fix slow node loading, offline node loading",
"• Prevent submissions when we have no data in that area"
]
},
"2.5.0": {
"content": [
"• NEW: 'Get more...' button in profile dropdowns - easily browse and import profiles from deflock.me/identify",
"• NEW: Profile creation choice dialog - when adding profiles in settings, choose between creating custom profiles or importing from website",
"• Enhanced profile discovery workflow - clearer path for users to find and import community-created profiles"
]
},
"2.4.4": {
"content": [
"• Search results now prioritize locations near your current map view"
]
},
"2.4.3": {
"content": [
"• Fixed 360° FOV rendering - devices with full circle coverage now render as complete rings instead of having a wedge cut out or being a line",
"• Fixed 360° FOV submission - now correctly submits '0-360' to OpenStreetMap instead of incorrect '180-180' values, disables direction slider"
]
},
"2.4.1": {
"content": [
"• Save button moved to top-right corner of profile editor screens",
"• Fixed issue where FOV values could not be removed from profiles",
"• Direction slider is now disabled for profiles with 360° FOV"
]
},
"2.4.0": {
"content": [
"• Profile import from website links",
"• Visit deflock.me for profile links to auto-populate custom profiles"
]
},
"2.3.1": {
"content": [
"• Follow-me mode now automatically restores when add/edit/tag sheets are closed",
"• Follow-me button is greyed out while node sheets are open (add/edit/tag) since following doesn't make sense during node operations",
"• Drop support for approximate location since I can't get it to work reliably; apologies"
]
},
"2.3.0": {
"content": [
"• Concurrent upload queue processing",
"• Each submission is now much faster"
]
},
"2.2.1": {
"content": [
"• Fixed network status indicator timing out prematurely",
"• Improved GPS follow-me reliability - fixed sync issues that could cause tracking to stop working",
"• Network status now accurately shows 'taking a while' when requests split or backoff, and only shows 'timed out' for actual network failures"
]
},
"2.2.0": {
"content": [
"• Fixed follow-me sync issues where tracking would sometimes stop working after mode changes",
@@ -259,4 +377,4 @@
"• New suspected locations feature"
]
}
}
}

View File

@@ -28,7 +28,7 @@ read_from_file() {
echo "$v"
return 0
fi
done < "$file"
done < <(cat "$file"; echo)
return 1
}
@@ -80,9 +80,9 @@ fi
# Build the dart-define arguments
DART_DEFINE_ARGS="--dart-define=OSM_PROD_CLIENTID=$OSM_PROD_CLIENTID --dart-define=OSM_SANDBOX_CLIENTID=$OSM_SANDBOX_CLIENTID"
# Validate localizations before building
echo "Validating localizations..."
dart run scripts/validate_localizations.dart || exit 1
# Run tests before building
echo "Running tests..."
flutter test || exit 1
echo
appver=$(grep "version:" pubspec.yaml | head -1 | cut -d ':' -f 2 | tr -d ' ' | cut -d '+' -f 1)

View File

@@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>12.0</string>
<string>13.0</string>
</dict>
</plist>

View File

@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '12.0'
# platform :ios, '13.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

View File

@@ -455,7 +455,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
@@ -588,7 +588,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -639,7 +639,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;

View File

@@ -1,8 +1,8 @@
import 'dart:async';
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart';
import 'package:http/http.dart' as http;
import 'package:flutter_map/flutter_map.dart' show LatLngBounds;
import 'services/http_client.dart';
import 'package:latlong2/latlong.dart';
import 'package:shared_preferences/shared_preferences.dart';
@@ -14,13 +14,14 @@ import 'models/suspected_location.dart';
import 'models/tile_provider.dart';
import 'models/search_result.dart';
import 'services/offline_area_service.dart';
import 'services/node_cache.dart';
import 'services/map_data_provider.dart';
import 'services/node_data_manager.dart';
import 'services/tile_preview_service.dart';
import 'services/changelog_service.dart';
import 'services/operator_profile_service.dart';
import 'services/deep_link_service.dart';
import 'widgets/node_provider_with_cache.dart';
import 'services/profile_service.dart';
import 'widgets/proximity_warning_dialog.dart';
import 'widgets/reauth_messages_dialog.dart';
import 'dev_config.dart';
import 'state/auth_state.dart';
@@ -38,6 +39,7 @@ import 'state/upload_queue_state.dart';
export 'state/navigation_state.dart' show AppNavigationMode;
export 'state/settings_state.dart' show UploadMode, FollowMeMode;
export 'state/session_state.dart' show AddNodeSession, EditNodeSession;
export 'models/pending_upload.dart' show UploadOperation;
// ------------------ AppState ------------------
class AppState extends ChangeNotifier {
@@ -129,6 +131,7 @@ class AppState extends ChangeNotifier {
bool get isNavigationSearchLoading => _navigationState.isSearchLoading;
List<SearchResult> get navigationSearchResults => _navigationState.searchResults;
int get navigationAvoidanceDistance => _settingsState.navigationAvoidanceDistance;
DistanceUnit get distanceUnit => _settingsState.distanceUnit;
// Profile state
List<NodeProfile> get profiles => _profileState.profiles;
@@ -239,11 +242,19 @@ class AppState extends ChangeNotifier {
// Initialize OfflineAreaService to ensure offline areas are loaded
await OfflineAreaService().ensureInitialized();
// Preload offline nodes into cache for immediate display
await NodeDataManager().preloadOfflineNodes();
// Start uploader if conditions are met
_startUploader();
_isInitialized = true;
// Check for initial deep link after a small delay to let navigation settle
Future.delayed(const Duration(milliseconds: 500), () {
DeepLinkService().checkInitialLink();
});
// Start periodic message checking
_startMessageCheckTimer();
@@ -324,35 +335,39 @@ class AppState extends ChangeNotifier {
final accessToken = await _authState.getAccessToken();
if (accessToken == null) return false;
final client = UserAgentClient();
try {
// Try to fetch user details - this should include message data if scope is correct
final response = await http.get(
final response = await client.get(
Uri.parse('${_getApiHost()}/api/0.6/user/details.json'),
headers: {'Authorization': 'Bearer $accessToken'},
);
if (response.statusCode == 403) {
// Forbidden - likely missing scope
return true;
}
if (response.statusCode == 200) {
final data = jsonDecode(response.body);
final messages = data['user']?['messages'];
// If messages field is missing, we might not have the right scope
return messages == null;
}
return false;
} catch (e) {
// On error, assume no re-auth needed to avoid annoying users
return false;
} finally {
client.close();
}
}
/// Show re-authentication dialog if needed
Future<void> checkAndPromptReauthForMessages(BuildContext context) async {
if (await needsReauthForMessages()) {
if (!context.mounted) return;
_showReauthDialog(context);
}
}
@@ -392,6 +407,10 @@ class AppState extends ChangeNotifier {
_profileState.addOrUpdateProfile(p);
}
void reorderProfiles(int oldIndex, int newIndex) {
_profileState.reorderProfiles(oldIndex, newIndex);
}
void deleteProfile(NodeProfile p) {
_profileState.deleteProfile(p);
}
@@ -424,7 +443,7 @@ class AppState extends ChangeNotifier {
}
void startEditSession(OsmNode node) {
_sessionState.startEditSession(node, enabledProfiles);
_sessionState.startEditSession(node, enabledProfiles, operatorProfiles);
}
void updateSession({
@@ -433,6 +452,9 @@ class AppState extends ChangeNotifier {
OperatorProfile? operatorProfile,
LatLng? target,
Map<String, String>? refinedTags,
Map<String, String>? additionalExistingTags,
String? changesetComment,
bool updateOperatorProfile = false,
}) {
_sessionState.updateSession(
directionDeg: directionDeg,
@@ -440,6 +462,9 @@ class AppState extends ChangeNotifier {
operatorProfile: operatorProfile,
target: target,
refinedTags: refinedTags,
additionalExistingTags: additionalExistingTags,
changesetComment: changesetComment,
updateOperatorProfile: updateOperatorProfile,
);
// Check tutorial completion if position changed
@@ -455,6 +480,9 @@ class AppState extends ChangeNotifier {
LatLng? target,
bool? extractFromWay,
Map<String, String>? refinedTags,
Map<String, String>? additionalExistingTags,
String? changesetComment,
bool updateOperatorProfile = false,
}) {
_sessionState.updateEditSession(
directionDeg: directionDeg,
@@ -463,6 +491,9 @@ class AppState extends ChangeNotifier {
target: target,
extractFromWay: extractFromWay,
refinedTags: refinedTags,
additionalExistingTags: additionalExistingTags,
changesetComment: changesetComment,
updateOperatorProfile: updateOperatorProfile,
);
// Check tutorial completion if position changed
@@ -518,6 +549,8 @@ class AppState extends ChangeNotifier {
_sessionState.removeDirection();
}
bool get canRemoveDirection => _sessionState.canRemoveDirection;
void cycleDirection() {
_sessionState.cycleDirection();
}
@@ -563,8 +596,8 @@ class AppState extends ChangeNotifier {
}
// ---------- Navigation Methods - Simplified ----------
void enterSearchMode(LatLng mapCenter) {
_navigationState.enterSearchMode(mapCenter);
void enterSearchMode(LatLng mapCenter, {LatLngBounds? viewbox}) {
_navigationState.enterSearchMode(mapCenter, viewbox: viewbox);
}
void cancelNavigation() {
@@ -651,7 +684,7 @@ class AppState extends ChangeNotifier {
Future<void> setUploadMode(UploadMode mode) async {
// Clear node cache when switching upload modes to prevent mixing production/sandbox data
NodeCache.instance.clear();
MapDataProvider().clearCache();
debugPrint('[AppState] Cleared node cache due to upload mode change');
await _settingsState.setUploadMode(mode);
@@ -714,7 +747,11 @@ class AppState extends ChangeNotifier {
/// Set navigation avoidance distance
Future<void> setNavigationAvoidanceDistance(int distance) async {
await _settingsState.setNavigationAvoidanceDistance(distance);
}
}
Future<void> setDistanceUnit(DistanceUnit unit) async {
await _settingsState.setDistanceUnit(unit);
}
// ---------- Queue Methods ----------
void clearQueue() {
@@ -784,6 +821,31 @@ class AppState extends ChangeNotifier {
);
}
// ---------- Utility Methods ----------
/// Generate a default changeset comment for a submission
/// Handles special case of `<Existing tags>` profile by using "a" instead
static String generateDefaultChangesetComment({
required NodeProfile? profile,
required UploadOperation operation,
}) {
// Handle temp profiles with brackets by using "a"
final profileName = profile?.name.startsWith('<') == true && profile?.name.endsWith('>') == true
? 'a'
: profile?.name ?? 'surveillance';
switch (operation) {
case UploadOperation.create:
return 'Add $profileName surveillance node';
case UploadOperation.modify:
return 'Update $profileName surveillance node';
case UploadOperation.delete:
return 'Delete $profileName surveillance node';
case UploadOperation.extract:
return 'Extract $profileName surveillance node';
}
}
// ---------- Private Methods ----------
/// Attempts to fetch missing tile preview images in the background (fire and forget)
void _fetchMissingTilePreviews() {

View File

@@ -52,16 +52,20 @@ double topPositionWithSafeArea(double baseTop, EdgeInsets safeArea) {
// Client name for OSM uploads ("created_by" tag)
const String kClientName = 'DeFlock';
// Note: Version is now dynamically retrieved from VersionService
const String kContactEmail = 'admin@stopflock.com';
const String kHomepageUrl = 'https://deflock.org';
// Upload and changeset configuration
const Duration kUploadHttpTimeout = Duration(seconds: 30); // HTTP request timeout for uploads
const Duration kUploadQueueProcessingInterval = Duration(seconds: 5); // How often to check for new uploads to start
const int kMaxConcurrentUploads = 5; // Maximum number of uploads processing simultaneously
const Duration kChangesetCloseInitialRetryDelay = Duration(seconds: 10);
const Duration kChangesetCloseMaxRetryDelay = Duration(minutes: 5); // Cap at 5 minutes
const Duration kChangesetAutoCloseTimeout = Duration(minutes: 59); // Give up and trust OSM auto-close
const double kChangesetCloseBackoffMultiplier = 2.0;
// Navigation routing configuration
const Duration kNavigationRoutingTimeout = Duration(seconds: 120); // HTTP timeout for routing requests
// Overpass API configuration
const Duration kOverpassQueryTimeout = Duration(seconds: 45); // Timeout for Overpass API queries (was 25s hardcoded)
// Suspected locations CSV URL
const String kSuspectedLocationsCsvUrl = 'https://alprwatch.org/suspected-locations/deflock-latest.csv';
@@ -139,6 +143,7 @@ const int kDefaultMaxNodes = 500; // Default maximum number of nodes to render o
// NSI (Name Suggestion Index) configuration
const int kNSIMinimumHitCount = 500; // Minimum hit count for NSI suggestions to be considered useful
const int kNSIMaxSuggestions = 10; // Maximum number of tag value suggestions to fetch and display
// Map interaction configuration
const double kNodeDoubleTapZoomDelta = 1.0; // How much to zoom in when double-tapping nodes (was 1.0)
@@ -147,15 +152,6 @@ const double kPinchZoomThreshold = 0.2; // How much pinch required to start zoom
const double kPinchMoveThreshold = 30.0; // How much drag required for two-finger pan (default 40.0)
const double kRotationThreshold = 6.0; // Degrees of rotation required before map actually rotates (Google Maps style)
// Tile fetch configuration (brutalist approach: simple, configurable, unlimited retries)
const int kTileFetchConcurrentThreads = 8; // Reduced from 10 to 8 for better cross-platform performance
const int kTileFetchInitialDelayMs = 150; // Reduced from 200ms for faster retries
const double kTileFetchBackoffMultiplier = 1.4; // Slightly reduced for faster recovery
const int kTileFetchMaxDelayMs = 4000; // Reduced from 5000ms for faster max retry
const int kTileFetchRandomJitterMs = 50; // Reduced jitter for more predictable timing
const int kTileFetchMaxQueueSize = 100; // Reasonable queue size to prevent memory bloat
// Note: Removed max attempts - tiles retry indefinitely until they succeed or are canceled
// User download max zoom span (user can download up to kMaxUserDownloadZoomSpan zooms above min)
const int kMaxUserDownloadZoomSpan = 7;

View File

@@ -1,16 +1,20 @@
// OpenStreetMap OAuth client IDs for this app.
// These must be provided via --dart-define at build time.
/// Whether OSM OAuth secrets were provided at build time.
/// When false, the app should force simulate mode.
bool get kHasOsmSecrets {
const prod = String.fromEnvironment('OSM_PROD_CLIENTID');
const sandbox = String.fromEnvironment('OSM_SANDBOX_CLIENTID');
return prod.isNotEmpty && sandbox.isNotEmpty;
}
String get kOsmProdClientId {
const fromBuild = String.fromEnvironment('OSM_PROD_CLIENTID');
if (fromBuild.isNotEmpty) return fromBuild;
throw Exception('OSM_PROD_CLIENTID not configured. Use --dart-define=OSM_PROD_CLIENTID=your_id');
return fromBuild;
}
String get kOsmSandboxClientId {
const fromBuild = String.fromEnvironment('OSM_SANDBOX_CLIENTID');
if (fromBuild.isNotEmpty) return fromBuild;
throw Exception('OSM_SANDBOX_CLIENTID not configured. Use --dart-define=OSM_SANDBOX_CLIENTID=your_id');
return fromBuild;
}

View File

@@ -47,12 +47,16 @@
},
"settings": {
"title": "Einstellungen",
"language": "Sprache",
"language": "Sprache & Region",
"systemDefault": "Systemstandard",
"aboutInfo": "Über / Informationen",
"aboutThisApp": "Über Diese App",
"aboutSubtitle": "App-Informationen und Credits",
"languageSubtitle": "Wählen Sie Ihre bevorzugte Sprache",
"languageSubtitle": "Wählen Sie Ihre bevorzugte Sprache und Einheiten",
"distanceUnit": "Entfernungseinheiten",
"distanceUnitSubtitle": "Wählen Sie zwischen metrischen (km/m) oder imperialen (mi/ft) Einheiten",
"metricUnits": "Metrisch (km, m)",
"imperialUnits": "Imperial (mi, ft)",
"maxNodes": "Max. angezeigte Knoten",
"maxNodesSubtitle": "Obergrenze für die Anzahl der Knoten auf der Karte festlegen.",
"maxNodesWarning": "Sie möchten das wahrscheinlich nicht tun, es sei denn, Sie sind absolut sicher, dass Sie einen guten Grund dafür haben.",
@@ -82,8 +86,7 @@
"enableNotifications": "Benachrichtigungen Aktivieren",
"checkingPermissions": "Berechtigungen prüfen...",
"alertDistance": "Warnentfernung: ",
"meters": "Meter",
"rangeInfo": "Bereich: {}-{} Meter (Standard: {})"
"rangeInfo": "Bereich: {}-{} {} (Standard: {})"
},
"node": {
"title": "Knoten #{}",
@@ -103,8 +106,8 @@
"mustBeLoggedIn": "Sie müssen angemeldet sein, um neue Knoten zu übertragen. Bitte melden Sie sich über die Einstellungen an.",
"enableSubmittableProfile": "Aktivieren Sie ein übertragbares Profil in den Einstellungen, um neue Knoten zu übertragen.",
"profileViewOnlyWarning": "Dieses Profil ist nur zum Anzeigen der Karte gedacht. Bitte wählen Sie ein übertragbares Profil aus, um neue Knoten zu übertragen.",
"refineTags": "Tags Verfeinern",
"refineTagsWithProfile": "Tags Verfeinern ({})"
"loadingAreaData": "Lade Bereichsdaten... Bitte warten Sie vor dem Übertragen.",
"refineTags": "Tags Verfeinern"
},
"editNode": {
"title": "Knoten #{} Bearbeiten",
@@ -118,12 +121,16 @@
"sandboxModeWarning": "Bearbeitungen von Produktionsknoten können nicht an die Sandbox übertragen werden. Wechseln Sie in den Produktionsmodus in den Einstellungen, um Knoten zu bearbeiten.",
"enableSubmittableProfile": "Aktivieren Sie ein übertragbares Profil in den Einstellungen, um Knoten zu bearbeiten.",
"profileViewOnlyWarning": "Dieses Profil ist nur zum Anzeigen der Karte gedacht. Bitte wählen Sie ein übertragbares Profil aus, um Knoten zu bearbeiten.",
"loadingAreaData": "Lade Bereichsdaten... Bitte warten Sie vor dem Übertragen.",
"cannotMoveConstrainedNode": "Kann diese Kamera nicht verschieben - sie ist mit einem anderen Kartenelement verbunden (OSM-Weg/Relation). Sie können trotzdem ihre Tags und Richtung bearbeiten.",
"zoomInRequiredMessage": "Zoomen Sie auf mindestens Stufe {} heran, um Überwachungsknoten hinzuzufügen oder zu bearbeiten. Dies gewährleistet eine präzise Positionierung für genaues Kartieren.",
"extractFromWay": "Knoten aus Weg/Relation extrahieren",
"extractFromWaySubtitle": "Neuen Knoten mit gleichen Tags erstellen, Verschieben an neuen Ort ermöglichen",
"refineTags": "Tags Verfeinern",
"refineTagsWithProfile": "Tags Verfeinern ({})"
"existingTags": "<Vorhandene Tags>",
"noChangesDetected": "Keine Änderungen erkannt - nichts zu übertragen",
"noChangesTitle": "Keine Änderungen zu Übertragen",
"noChangesMessage": "Sie haben keine Änderungen an diesem Knoten vorgenommen. Um eine Bearbeitung zu übertragen, müssen Sie den Standort, das Profil, die Richtungen oder die Tags ändern."
},
"download": {
"title": "Kartenbereich Herunterladen",
@@ -137,7 +144,10 @@
"offlineModeWarning": "Downloads im Offline-Modus deaktiviert. Deaktivieren Sie den Offline-Modus, um neue Bereiche herunterzuladen.",
"areaTooBigMessage": "Zoomen Sie auf mindestens Stufe {} heran, um Offline-Bereiche herunterzuladen. Downloads großer Gebiete können die App zum Absturz bringen.",
"downloadStarted": "Download gestartet! Lade Kacheln und Knoten...",
"downloadFailed": "Download konnte nicht gestartet werden: {}"
"downloadFailed": "Download konnte nicht gestartet werden: {}",
"offlineNotPermitted": "Der {}-Server erlaubt keine Offline-Downloads. Wechseln Sie zu einem Kachelanbieter, der Offline-Nutzung unterstützt (z. B. Bing Maps, Mapbox oder ein selbst gehosteter Kachelserver).",
"currentTileProvider": "aktuelle Kachel",
"noTileProviderSelected": "Kein Kachelanbieter ausgewählt. Bitte wählen Sie einen Kartenstil, bevor Sie einen Offlinebereich herunterladen."
},
"downloadStarted": {
"title": "Download gestartet",
@@ -279,12 +289,22 @@
"view": "Anzeigen",
"deleteProfile": "Profil Löschen",
"deleteProfileConfirm": "Sind Sie sicher, dass Sie \"{}\" löschen möchten?",
"profileDeleted": "Profil gelöscht"
"profileDeleted": "Profil gelöscht",
"getMore": "Weitere anzeigen...",
"addProfileChoice": "Profil Hinzufügen",
"addProfileChoiceMessage": "Wie möchten Sie ein Profil hinzufügen?",
"createCustomProfile": "Benutzerdefiniertes Profil Erstellen",
"createCustomProfileDescription": "Erstellen Sie ein Profil von Grund auf mit Ihren eigenen Tags",
"importFromWebsite": "Von Webseite Importieren",
"importFromWebsiteDescription": "Profile von deflock.me/identify durchsuchen und importieren"
},
"mapTiles": {
"title": "Karten-Kacheln",
"manageProviders": "Anbieter Verwalten",
"attribution": "Karten-Zuschreibung"
"attribution": "Karten-Zuschreibung",
"mapAttribution": "Kartenquelle: {}",
"couldNotOpenLink": "Link konnte nicht geöffnet werden",
"openLicense": "Lizenz öffnen: {}"
},
"profileEditor": {
"viewProfile": "Profil Anzeigen",
@@ -311,7 +331,7 @@
},
"operatorProfileEditor": {
"newOperatorProfile": "Neues Betreiber-Profil",
"editOperatorProfile": "Betreiber-Profil Bearbeiten",
"editOperatorProfile": "Betreiber-Profil Bearbeiten",
"operatorName": "Betreiber-Name",
"operatorNameHint": "z.B. Polizei Austin",
"operatorNameRequired": "Betreiber-Name ist erforderlich",
@@ -374,7 +394,11 @@
"profileTagsDescription": "Geben Sie Werte für Tags an, die verfeinert werden müssen:",
"selectValue": "Wert auswählen...",
"noValue": "(Kein Wert)",
"noSuggestions": "Keine Vorschläge verfügbar"
"noSuggestions": "Keine Vorschläge verfügbar",
"existingTagsTitle": "Vorhandene Tags",
"existingTagsDescription": "Bearbeiten Sie die vorhandenen Tags auf diesem Gerät. Hinzufügen, entfernen oder ändern Sie beliebige Tags:",
"existingOperator": "<Vorhandener Betreiber>",
"existingOperatorTags": "vorhandene Betreiber-Tags"
},
"layerSelector": {
"cannotChangeTileTypes": "Kachel-Typen können während des Herunterladens von Offline-Bereichen nicht geändert werden",
@@ -409,7 +433,9 @@
"timedOut": "Anfrage Zeitüberschreitung",
"noData": "Keine Offline-Daten",
"success": "Überwachungsdaten geladen",
"nodeDataSlow": "Überwachungsdaten langsam"
"nodeDataSlow": "Überwachungsdaten langsam",
"rateLimited": "Server-Limitierung",
"networkError": "Netzwerkfehler"
},
"nodeLimitIndicator": {
"message": "Zeige {rendered} von {total} Geräten",
@@ -481,13 +507,7 @@
"avoidanceDistance": "Vermeidungsabstand",
"avoidanceDistanceSubtitle": "Mindestabstand zu Überwachungsgeräten",
"searchHistory": "Max. Suchverlauf",
"searchHistorySubtitle": "Maximale Anzahl kürzlicher Suchen zum Merken",
"units": "Einheiten",
"unitsSubtitle": "Anzeigeeinheiten für Entfernungen und Messungen",
"metric": "Metrisch (km, m)",
"imperial": "Britisch (mi, ft)",
"meters": "Meter",
"feet": "Fuß"
"searchHistorySubtitle": "Maximale Anzahl kürzlicher Suchen zum Merken"
},
"suspectedLocations": {
"title": "Verdächtige Standorte",
@@ -506,7 +526,7 @@
"updateFailed": "Aktualisierung der verdächtigen Standorte fehlgeschlagen",
"neverFetched": "Nie abgerufen",
"daysAgo": "vor {} Tagen",
"hoursAgo": "vor {} Stunden",
"hoursAgo": "vor {} Stunden",
"minutesAgo": "vor {} Minuten",
"justNow": "Gerade eben"
},
@@ -514,7 +534,7 @@
"title": "Verdächtiger Standort #{}",
"ticketNo": "Ticket-Nr.",
"address": "Adresse",
"street": "Straße",
"street": "Straße",
"city": "Stadt",
"state": "Bundesland",
"intersectingStreet": "Kreuzende Straße",
@@ -523,5 +543,19 @@
"url": "URL",
"coordinates": "Koordinaten",
"noAddressAvailable": "Keine Adresse verfügbar"
},
"units": {
"meters": "m",
"feet": "ft",
"kilometers": "km",
"miles": "mi",
"metersLong": "Meter",
"feetLong": "Fuß",
"kilometersLong": "Kilometer",
"milesLong": "Meilen",
"metric": "Metrisch",
"imperial": "Imperial",
"metricDescription": "Metrisch (km, m)",
"imperialDescription": "Imperial (mi, ft)"
}
}
}

View File

@@ -70,7 +70,7 @@
"submitAnyway": "Submit Anyway",
"nodeType": {
"alpr": "ALPR/ANPR Camera",
"publicCamera": "Public Surveillance Camera",
"publicCamera": "Public Surveillance Camera",
"camera": "Surveillance Camera",
"amenity": "{}",
"device": "{} Device",
@@ -84,12 +84,16 @@
},
"settings": {
"title": "Settings",
"language": "Language",
"language": "Language & Region",
"systemDefault": "System Default",
"aboutInfo": "About / Info",
"aboutThisApp": "About This App",
"aboutSubtitle": "App information and credits",
"languageSubtitle": "Choose your preferred language",
"languageSubtitle": "Choose your preferred language and units",
"distanceUnit": "Distance Units",
"distanceUnitSubtitle": "Choose between metric (km/m) or imperial (mi/ft) units",
"metricUnits": "Metric (km, m)",
"imperialUnits": "Imperial (mi, ft)",
"maxNodes": "Max nodes drawn",
"maxNodesSubtitle": "Set an upper limit for the number of nodes on the map.",
"maxNodesWarning": "You probably don't want to do that unless you are absolutely sure you have a good reason for it.",
@@ -119,8 +123,7 @@
"enableNotifications": "Enable Notifications",
"checkingPermissions": "Checking permissions...",
"alertDistance": "Alert distance: ",
"meters": "meters",
"rangeInfo": "Range: {}-{} meters (default: {})"
"rangeInfo": "Range: {}-{} {} (default: {})"
},
"node": {
"title": "Node #{}",
@@ -140,8 +143,8 @@
"mustBeLoggedIn": "You must be logged in to submit new nodes. Please log in via Settings.",
"enableSubmittableProfile": "Enable a submittable profile in Settings to submit new nodes.",
"profileViewOnlyWarning": "This profile is for map viewing only. Please select a submittable profile to submit new nodes.",
"refineTags": "Refine Tags",
"refineTagsWithProfile": "Refine Tags ({})"
"loadingAreaData": "Loading area data... Please wait before submitting.",
"refineTags": "Refine Tags"
},
"editNode": {
"title": "Edit Node #{}",
@@ -155,12 +158,16 @@
"sandboxModeWarning": "Cannot submit edits on production nodes to sandbox. Switch to Production mode in Settings to edit nodes.",
"enableSubmittableProfile": "Enable a submittable profile in Settings to edit nodes.",
"profileViewOnlyWarning": "This profile is for map viewing only. Please select a submittable profile to edit nodes.",
"loadingAreaData": "Loading area data... Please wait before submitting.",
"cannotMoveConstrainedNode": "Cannot move this camera - it's connected to another map element (OSM way/relation). You can still edit its tags and direction.",
"zoomInRequiredMessage": "Zoom in to at least level {} to add or edit surveillance nodes. This ensures precise positioning for accurate mapping.",
"extractFromWay": "Extract node from way/relation",
"extractFromWaySubtitle": "Create new node with same tags, allow moving to new location",
"refineTags": "Refine Tags",
"refineTagsWithProfile": "Refine Tags ({})"
"existingTags": "<Existing tags>",
"noChangesDetected": "No changes detected - nothing to submit",
"noChangesTitle": "No Changes to Submit",
"noChangesMessage": "You haven't made any changes to this node. To submit an edit, you need to change the location, profile, directions, or tags."
},
"download": {
"title": "Download Map Area",
@@ -174,7 +181,10 @@
"offlineModeWarning": "Downloads disabled while in offline mode. Disable offline mode to download new areas.",
"areaTooBigMessage": "Zoom in to at least level {} to download offline areas. Large area downloads can cause the app to become unresponsive.",
"downloadStarted": "Download started! Fetching tiles and nodes...",
"downloadFailed": "Failed to start download: {}"
"downloadFailed": "Failed to start download: {}",
"offlineNotPermitted": "The {} server does not permit offline downloads. Switch to a tile provider that allows offline use (e.g., Bing Maps, Mapbox, or a self-hosted tile server).",
"currentTileProvider": "current tile",
"noTileProviderSelected": "No tile provider is selected. Please select a map style before downloading an offline area."
},
"downloadStarted": {
"title": "Download Started",
@@ -316,12 +326,22 @@
"view": "View",
"deleteProfile": "Delete Profile",
"deleteProfileConfirm": "Are you sure you want to delete \"{}\"?",
"profileDeleted": "Profile deleted"
"profileDeleted": "Profile deleted",
"getMore": "Get more...",
"addProfileChoice": "Add Profile",
"addProfileChoiceMessage": "How would you like to add a profile?",
"createCustomProfile": "Create Custom Profile",
"createCustomProfileDescription": "Build a profile from scratch with your own tags",
"importFromWebsite": "Import from Website",
"importFromWebsiteDescription": "Browse and import profiles from deflock.me/identify"
},
"mapTiles": {
"title": "Map Tiles",
"manageProviders": "Manage Providers",
"attribution": "Map Attribution"
"attribution": "Map Attribution",
"mapAttribution": "Map attribution: {}",
"couldNotOpenLink": "Could not open link",
"openLicense": "Open license: {}"
},
"profileEditor": {
"viewProfile": "View Profile",
@@ -348,7 +368,7 @@
},
"operatorProfileEditor": {
"newOperatorProfile": "New Operator Profile",
"editOperatorProfile": "Edit Operator Profile",
"editOperatorProfile": "Edit Operator Profile",
"operatorName": "Operator name",
"operatorNameHint": "e.g., Austin Police Department",
"operatorNameRequired": "Operator name is required",
@@ -411,7 +431,11 @@
"profileTagsDescription": "Complete these optional tag values for more detailed submissions:",
"selectValue": "Select value...",
"noValue": "(leave empty)",
"noSuggestions": "No suggestions available"
"noSuggestions": "No suggestions available",
"existingTagsTitle": "Existing Tags",
"existingTagsDescription": "Edit the existing tags on this device. Add, remove, or modify any tag:",
"existingOperator": "<Existing operator>",
"existingOperatorTags": "existing operator tags"
},
"layerSelector": {
"cannotChangeTileTypes": "Cannot change tile types while downloading offline areas",
@@ -425,7 +449,7 @@
"mobileEditors": "Mobile Editors",
"iDEditor": "iD Editor",
"iDEditorSubtitle": "Full-featured web editor - always works",
"rapidEditor": "RapiD Editor",
"rapidEditor": "RapiD Editor",
"rapidEditorSubtitle": "AI-assisted editing with Facebook data",
"vespucci": "Vespucci",
"vespucciSubtitle": "Advanced Android OSM editor",
@@ -446,7 +470,9 @@
"timedOut": "Request timed out",
"noData": "No offline data",
"success": "Surveillance data loaded",
"nodeDataSlow": "Surveillance data slow"
"nodeDataSlow": "Surveillance data slow",
"rateLimited": "Rate limited by server",
"networkError": "Network error"
},
"nodeLimitIndicator": {
"message": "Showing {rendered} of {total} devices",
@@ -481,13 +507,7 @@
"avoidanceDistance": "Avoidance Distance",
"avoidanceDistanceSubtitle": "Minimum distance to stay away from surveillance devices",
"searchHistory": "Max Search History",
"searchHistorySubtitle": "Maximum number of recent searches to remember",
"units": "Units",
"unitsSubtitle": "Display units for distances and measurements",
"metric": "Metric (km, m)",
"imperial": "Imperial (mi, ft)",
"meters": "meters",
"feet": "feet"
"searchHistorySubtitle": "Maximum number of recent searches to remember"
},
"suspectedLocations": {
"title": "Suspected Locations",
@@ -506,7 +526,7 @@
"updateFailed": "Failed to update suspected locations",
"neverFetched": "Never fetched",
"daysAgo": "{} days ago",
"hoursAgo": "{} hours ago",
"hoursAgo": "{} hours ago",
"minutesAgo": "{} minutes ago",
"justNow": "Just now"
},
@@ -514,7 +534,7 @@
"title": "Suspected Location #{}",
"ticketNo": "Ticket No",
"address": "Address",
"street": "Street",
"street": "Street",
"city": "City",
"state": "State",
"intersectingStreet": "Intersecting Street",
@@ -523,5 +543,19 @@
"url": "URL",
"coordinates": "Coordinates",
"noAddressAvailable": "No address available"
},
"units": {
"meters": "m",
"feet": "ft",
"kilometers": "km",
"miles": "mi",
"metersLong": "meters",
"feetLong": "feet",
"kilometersLong": "kilometers",
"milesLong": "miles",
"metric": "Metric",
"imperial": "Imperial",
"metricDescription": "Metric (km, m)",
"imperialDescription": "Imperial (mi, ft)"
}
}
}

View File

@@ -84,12 +84,16 @@
},
"settings": {
"title": "Configuración",
"language": "Idioma",
"language": "Idioma y Región",
"systemDefault": "Sistema por Defecto",
"aboutInfo": "Acerca de / Información",
"aboutThisApp": "Acerca de Esta App",
"aboutSubtitle": "Información de la aplicación y créditos",
"languageSubtitle": "Elige tu idioma preferido",
"languageSubtitle": "Elige tu idioma preferido y unidades",
"distanceUnit": "Unidades de Distancia",
"distanceUnitSubtitle": "Elige entre unidades métricas (km/m) o imperiales (mi/ft)",
"metricUnits": "Métrico (km, m)",
"imperialUnits": "Imperial (mi, ft)",
"maxNodes": "Máx. nodos dibujados",
"maxNodesSubtitle": "Establecer un límite superior para el número de nodos en el mapa.",
"maxNodesWarning": "Probablemente no quieras hacer eso a menos que estés absolutamente seguro de que tienes una buena razón para ello.",
@@ -119,8 +123,7 @@
"enableNotifications": "Habilitar Notificaciones",
"checkingPermissions": "Verificando permisos...",
"alertDistance": "Distancia de alerta: ",
"meters": "metros",
"rangeInfo": "Rango: {}-{} metros (predeterminado: {})"
"rangeInfo": "Rango: {}-{} {} (predeterminado: {})"
},
"node": {
"title": "Nodo #{}",
@@ -140,8 +143,8 @@
"mustBeLoggedIn": "Debe estar conectado para enviar nuevos nodos. Por favor, inicie sesión a través de Configuración.",
"enableSubmittableProfile": "Habilite un perfil envíable en Configuración para enviar nuevos nodos.",
"profileViewOnlyWarning": "Este perfil es solo para visualización del mapa. Por favor, seleccione un perfil envíable para enviar nuevos nodos.",
"refineTags": "Refinar Etiquetas",
"refineTagsWithProfile": "Refinar Etiquetas ({})"
"loadingAreaData": "Cargando datos del área... Por favor espere antes de enviar.",
"refineTags": "Refinar Etiquetas"
},
"editNode": {
"title": "Editar Nodo #{}",
@@ -155,12 +158,16 @@
"sandboxModeWarning": "No se pueden enviar ediciones de nodos de producción al sandbox. Cambie al modo Producción en Configuración para editar nodos.",
"enableSubmittableProfile": "Habilite un perfil envíable en Configuración para editar nodos.",
"profileViewOnlyWarning": "Este perfil es solo para visualización del mapa. Por favor, seleccione un perfil envíable para editar nodos.",
"loadingAreaData": "Cargando datos del área... Por favor espere antes de enviar.",
"cannotMoveConstrainedNode": "No se puede mover esta cámara - está conectada a otro elemento del mapa (OSM way/relation). Aún puede editar sus etiquetas y dirección.",
"zoomInRequiredMessage": "Amplíe al menos al nivel {} para agregar o editar nodos de vigilancia. Esto garantiza un posicionamiento preciso para un mapeo exacto.",
"extractFromWay": "Extraer nodo de way/relation",
"extractFromWaySubtitle": "Crear nuevo nodo con las mismas etiquetas, permitir mover a nueva ubicación",
"refineTags": "Refinar Etiquetas",
"refineTagsWithProfile": "Refinar Etiquetas ({})"
"existingTags": "<Etiquetas existentes>",
"noChangesDetected": "No se detectaron cambios - nada que enviar",
"noChangesTitle": "No Hay Cambios que Enviar",
"noChangesMessage": "No ha realizado ningún cambio en este nodo. Para enviar una edición, necesita cambiar la ubicación, el perfil, las direcciones o las etiquetas."
},
"download": {
"title": "Descargar Área del Mapa",
@@ -174,7 +181,10 @@
"offlineModeWarning": "Descargas deshabilitadas en modo sin conexión. Deshabilite el modo sin conexión para descargar nuevas áreas.",
"areaTooBigMessage": "Amplíe al menos al nivel {} para descargar áreas sin conexión. Las descargas de áreas grandes pueden hacer que la aplicación deje de responder.",
"downloadStarted": "¡Descarga iniciada! Obteniendo mosaicos y nodos...",
"downloadFailed": "Error al iniciar la descarga: {}"
"downloadFailed": "Error al iniciar la descarga: {}",
"offlineNotPermitted": "El servidor {} no permite descargas sin conexión. Cambie a un proveedor de mosaicos que permita el uso sin conexión (p. ej., Bing Maps, Mapbox o un servidor de mosaicos propio).",
"currentTileProvider": "mosaico actual",
"noTileProviderSelected": "No hay proveedor de mosaicos seleccionado. Seleccione un estilo de mapa antes de descargar un área sin conexión."
},
"downloadStarted": {
"title": "Descarga Iniciada",
@@ -316,12 +326,22 @@
"view": "Ver",
"deleteProfile": "Eliminar Perfil",
"deleteProfileConfirm": "¿Está seguro de que desea eliminar \"{}\"?",
"profileDeleted": "Perfil eliminado"
"profileDeleted": "Perfil eliminado",
"getMore": "Obtener más...",
"addProfileChoice": "Añadir Perfil",
"addProfileChoiceMessage": "¿Cómo desea añadir un perfil?",
"createCustomProfile": "Crear Perfil Personalizado",
"createCustomProfileDescription": "Crear un perfil desde cero con sus propias etiquetas",
"importFromWebsite": "Importar desde Sitio Web",
"importFromWebsiteDescription": "Explorar e importar perfiles desde deflock.me/identify"
},
"mapTiles": {
"title": "Tiles de Mapa",
"manageProviders": "Gestionar Proveedores",
"attribution": "Atribución del Mapa"
"attribution": "Atribución del Mapa",
"mapAttribution": "Atribución del mapa: {}",
"couldNotOpenLink": "No se pudo abrir el enlace",
"openLicense": "Abrir licencia: {}"
},
"profileEditor": {
"viewProfile": "Ver Perfil",
@@ -348,7 +368,7 @@
},
"operatorProfileEditor": {
"newOperatorProfile": "Nuevo Perfil de Operador",
"editOperatorProfile": "Editar Perfil de Operador",
"editOperatorProfile": "Editar Perfil de Operador",
"operatorName": "Nombre del operador",
"operatorNameHint": "ej., Departamento de Policía de Austin",
"operatorNameRequired": "El nombre del operador es requerido",
@@ -411,7 +431,11 @@
"profileTagsDescription": "Especifique valores para etiquetas que necesitan refinamiento:",
"selectValue": "Seleccionar un valor...",
"noValue": "(Sin valor)",
"noSuggestions": "No hay sugerencias disponibles"
"noSuggestions": "No hay sugerencias disponibles",
"existingTagsTitle": "Etiquetas Existentes",
"existingTagsDescription": "Edite las etiquetas existentes en este dispositivo. Agregue, elimine o modifique cualquier etiqueta:",
"existingOperator": "<Operador existente>",
"existingOperatorTags": "etiquetas de operador existentes"
},
"layerSelector": {
"cannotChangeTileTypes": "No se pueden cambiar los tipos de teselas mientras se descargan áreas sin conexión",
@@ -446,7 +470,9 @@
"timedOut": "Solicitud agotada",
"noData": "Sin datos sin conexión",
"success": "Datos de vigilancia cargados",
"nodeDataSlow": "Datos de vigilancia lentos"
"nodeDataSlow": "Datos de vigilancia lentos",
"rateLimited": "Limitado por el servidor",
"networkError": "Error de red"
},
"nodeLimitIndicator": {
"message": "Mostrando {rendered} de {total} dispositivos",
@@ -481,13 +507,7 @@
"avoidanceDistance": "Distancia de evitación",
"avoidanceDistanceSubtitle": "Distancia mínima para mantenerse alejado de dispositivos de vigilancia",
"searchHistory": "Historial máximo de búsqueda",
"searchHistorySubtitle": "Número máximo de búsquedas recientes para recordar",
"units": "Unidades",
"unitsSubtitle": "Unidades de visualización para distancias y medidas",
"metric": "Métrico (km, m)",
"imperial": "Imperial (mi, ft)",
"meters": "metros",
"feet": "pies"
"searchHistorySubtitle": "Número máximo de búsquedas recientes para recordar"
},
"suspectedLocations": {
"title": "Ubicaciones Sospechosas",
@@ -506,7 +526,7 @@
"updateFailed": "Error al actualizar ubicaciones sospechosas",
"neverFetched": "Nunca obtenido",
"daysAgo": "hace {} días",
"hoursAgo": "hace {} horas",
"hoursAgo": "hace {} horas",
"minutesAgo": "hace {} minutos",
"justNow": "Ahora mismo"
},
@@ -514,7 +534,7 @@
"title": "Ubicación Sospechosa #{}",
"ticketNo": "No. de Ticket",
"address": "Dirección",
"street": "Calle",
"street": "Calle",
"city": "Ciudad",
"state": "Estado",
"intersectingStreet": "Calle que Intersecta",
@@ -523,5 +543,19 @@
"url": "URL",
"coordinates": "Coordenadas",
"noAddressAvailable": "No hay dirección disponible"
},
"units": {
"meters": "m",
"feet": "ft",
"kilometers": "km",
"miles": "mi",
"metersLong": "metros",
"feetLong": "pies",
"kilometersLong": "kilómetros",
"milesLong": "millas",
"metric": "Métrico",
"imperial": "Imperial",
"metricDescription": "Métrico (km, m)",
"imperialDescription": "Imperial (mi, ft)"
}
}
}

View File

@@ -89,7 +89,11 @@
"aboutInfo": "À Propos / Informations",
"aboutThisApp": "À Propos de Cette App",
"aboutSubtitle": "Informations sur l'application et crédits",
"languageSubtitle": "Choisissez votre langue préférée",
"languageSubtitle": "Choisissez votre langue préférée et unités",
"distanceUnit": "Unités de Distance",
"distanceUnitSubtitle": "Choisir entre unités métriques (km/m) ou impériales (mi/ft)",
"metricUnits": "Métrique (km, m)",
"imperialUnits": "Impérial (mi, ft)",
"maxNodes": "Max. nœuds dessinés",
"maxNodesSubtitle": "Définir une limite supérieure pour le nombre de nœuds sur la carte.",
"maxNodesWarning": "Vous ne voulez probablement pas faire cela à moins d'être absolument sûr d'avoir une bonne raison de le faire.",
@@ -119,8 +123,7 @@
"enableNotifications": "Activer les Notifications",
"checkingPermissions": "Vérification des autorisations...",
"alertDistance": "Distance d'alerte : ",
"meters": "mètres",
"rangeInfo": "Plage : {}-{} mètres (par défaut : {})"
"rangeInfo": "Plage : {}-{} {} (par défaut : {})"
},
"node": {
"title": "Nœud #{}",
@@ -140,8 +143,8 @@
"mustBeLoggedIn": "Vous devez être connecté pour soumettre de nouveaux nœuds. Veuillez vous connecter via les Paramètres.",
"enableSubmittableProfile": "Activez un profil soumissible dans les Paramètres pour soumettre de nouveaux nœuds.",
"profileViewOnlyWarning": "Ce profil est uniquement pour la visualisation de la carte. Veuillez sélectionner un profil soumissible pour soumettre de nouveaux nœuds.",
"refineTags": "Affiner Balises",
"refineTagsWithProfile": "Affiner Balises ({})"
"loadingAreaData": "Chargement des données de zone... Veuillez patienter avant de soumettre.",
"refineTags": "Affiner Balises"
},
"editNode": {
"title": "Modifier Nœud #{}",
@@ -155,12 +158,16 @@
"sandboxModeWarning": "Impossible de soumettre des modifications de nœuds de production au sandbox. Passez au mode Production dans les Paramètres pour modifier les nœuds.",
"enableSubmittableProfile": "Activez un profil soumissible dans les Paramètres pour modifier les nœuds.",
"profileViewOnlyWarning": "Ce profil est uniquement pour la visualisation de la carte. Veuillez sélectionner un profil soumissible pour modifier les nœuds.",
"loadingAreaData": "Chargement des données de zone... Veuillez patienter avant de soumettre.",
"cannotMoveConstrainedNode": "Impossible de déplacer cette caméra - elle est connectée à un autre élément de carte (OSM way/relation). Vous pouvez toujours modifier ses balises et sa direction.",
"zoomInRequiredMessage": "Zoomez au moins au niveau {} pour ajouter ou modifier des nœuds de surveillance. Cela garantit un positionnement précis pour une cartographie exacte.",
"extractFromWay": "Extraire le nœud du way/relation",
"extractFromWaySubtitle": "Créer un nouveau nœud avec les mêmes balises, permettre le déplacement vers un nouvel emplacement",
"refineTags": "Affiner Balises",
"refineTagsWithProfile": "Affiner Balises ({})"
"existingTags": "<Balises existantes>",
"noChangesDetected": "Aucun changement détecté - rien à soumettre",
"noChangesTitle": "Aucun Changement à Soumettre",
"noChangesMessage": "Vous n'avez apporté aucun changement à ce nœud. Pour soumettre une modification, vous devez changer l'emplacement, le profil, les directions ou les balises."
},
"download": {
"title": "Télécharger Zone de Carte",
@@ -174,7 +181,10 @@
"offlineModeWarning": "Téléchargements désactivés en mode hors ligne. Désactivez le mode hors ligne pour télécharger de nouvelles zones.",
"areaTooBigMessage": "Zoomez au moins au niveau {} pour télécharger des zones hors ligne. Les téléchargements de grandes zones peuvent rendre l'application non réactive.",
"downloadStarted": "Téléchargement démarré ! Récupération des tuiles et nœuds...",
"downloadFailed": "Échec du démarrage du téléchargement: {}"
"downloadFailed": "Échec du démarrage du téléchargement: {}",
"offlineNotPermitted": "Le serveur {} ne permet pas les téléchargements hors ligne. Passez à un fournisseur de tuiles qui autorise l'utilisation hors ligne (par ex., Bing Maps, Mapbox ou un serveur de tuiles auto-hébergé).",
"currentTileProvider": "tuile actuelle",
"noTileProviderSelected": "Aucun fournisseur de tuiles sélectionné. Veuillez choisir un style de carte avant de télécharger une zone hors ligne."
},
"downloadStarted": {
"title": "Téléchargement Démarré",
@@ -316,12 +326,22 @@
"view": "Voir",
"deleteProfile": "Supprimer Profil",
"deleteProfileConfirm": "Êtes-vous sûr de vouloir supprimer \"{}\"?",
"profileDeleted": "Profil supprimé"
"profileDeleted": "Profil supprimé",
"getMore": "En obtenir plus...",
"addProfileChoice": "Ajouter Profil",
"addProfileChoiceMessage": "Comment souhaitez-vous ajouter un profil?",
"createCustomProfile": "Créer Profil Personnalisé",
"createCustomProfileDescription": "Créer un profil à partir de zéro avec vos propres balises",
"importFromWebsite": "Importer depuis Site Web",
"importFromWebsiteDescription": "Parcourir et importer des profils depuis deflock.me/identify"
},
"mapTiles": {
"title": "Tuiles de Carte",
"manageProviders": "Gérer Fournisseurs",
"attribution": "Attribution de Carte"
"attribution": "Attribution de Carte",
"mapAttribution": "Attribution de la carte : {}",
"couldNotOpenLink": "Impossible d'ouvrir le lien",
"openLicense": "Ouvrir la licence : {}"
},
"profileEditor": {
"viewProfile": "Voir Profil",
@@ -348,7 +368,7 @@
},
"operatorProfileEditor": {
"newOperatorProfile": "Nouveau Profil d'Opérateur",
"editOperatorProfile": "Modifier Profil d'Opérateur",
"editOperatorProfile": "Modifier Profil d'Opérateur",
"operatorName": "Nom de l'opérateur",
"operatorNameHint": "ex., Département de Police d'Austin",
"operatorNameRequired": "Le nom de l'opérateur est requis",
@@ -411,7 +431,11 @@
"profileTagsDescription": "Spécifiez des valeurs pour les étiquettes qui nécessitent un raffinement :",
"selectValue": "Sélectionner une valeur...",
"noValue": "(Aucune valeur)",
"noSuggestions": "Aucune suggestion disponible"
"noSuggestions": "Aucune suggestion disponible",
"existingTagsTitle": "Balises Existantes",
"existingTagsDescription": "Modifiez les balises existantes sur cet appareil. Ajoutez, supprimez ou modifiez n'importe quelle balise :",
"existingOperator": "<Opérateur existant>",
"existingOperatorTags": "balises d'opérateur existantes"
},
"layerSelector": {
"cannotChangeTileTypes": "Impossible de changer les types de tuiles pendant le téléchargement des zones hors ligne",
@@ -446,7 +470,9 @@
"timedOut": "Demande expirée",
"noData": "Aucune donnée hors ligne",
"success": "Données de surveillance chargées",
"nodeDataSlow": "Données de surveillance lentes"
"nodeDataSlow": "Données de surveillance lentes",
"rateLimited": "Limité par le serveur",
"networkError": "Erreur réseau"
},
"nodeLimitIndicator": {
"message": "Affichage de {rendered} sur {total} appareils",
@@ -481,13 +507,7 @@
"avoidanceDistance": "Distance d'évitement",
"avoidanceDistanceSubtitle": "Distance minimale pour éviter les dispositifs de surveillance",
"searchHistory": "Historique de recherche max",
"searchHistorySubtitle": "Nombre maximum de recherches récentes à retenir",
"units": "Unités",
"unitsSubtitle": "Unités d'affichage pour distances et mesures",
"metric": "Métrique (km, m)",
"imperial": "Impérial (mi, ft)",
"meters": "mètres",
"feet": "pieds"
"searchHistorySubtitle": "Nombre maximum de recherches récentes à retenir"
},
"suspectedLocations": {
"title": "Emplacements Suspects",
@@ -506,7 +526,7 @@
"updateFailed": "Échec de la mise à jour des emplacements suspects",
"neverFetched": "Jamais récupéré",
"daysAgo": "il y a {} jours",
"hoursAgo": "il y a {} heures",
"hoursAgo": "il y a {} heures",
"minutesAgo": "il y a {} minutes",
"justNow": "À l'instant"
},
@@ -514,7 +534,7 @@
"title": "Emplacement Suspect #{}",
"ticketNo": "N° de Ticket",
"address": "Adresse",
"street": "Rue",
"street": "Rue",
"city": "Ville",
"state": "État",
"intersectingStreet": "Rue Transversale",
@@ -523,5 +543,19 @@
"url": "URL",
"coordinates": "Coordonnées",
"noAddressAvailable": "Aucune adresse disponible"
},
"units": {
"meters": "m",
"feet": "ft",
"kilometers": "km",
"miles": "mi",
"metersLong": "mètres",
"feetLong": "pieds",
"kilometersLong": "kilomètres",
"milesLong": "milles",
"metric": "Métrique",
"imperial": "Impérial",
"metricDescription": "Métrique (km, m)",
"imperialDescription": "Impérial (mi, ft)"
}
}
}

View File

@@ -89,7 +89,11 @@
"aboutInfo": "Informazioni",
"aboutThisApp": "Informazioni su questa App",
"aboutSubtitle": "Informazioni sull'applicazione e crediti",
"languageSubtitle": "Scegli la tua lingua preferita",
"languageSubtitle": "Scegli la tua lingua preferita e unità",
"distanceUnit": "Unità di Distanza",
"distanceUnitSubtitle": "Scegli tra unità metriche (km/m) o imperiali (mi/ft)",
"metricUnits": "Metrico (km, m)",
"imperialUnits": "Imperiale (mi, ft)",
"maxNodes": "Max nodi disegnati",
"maxNodesSubtitle": "Imposta un limite superiore per il numero di nodi sulla mappa.",
"maxNodesWarning": "Probabilmente non vuoi farlo a meno che non sei assolutamente sicuro di avere una buona ragione per farlo.",
@@ -119,8 +123,7 @@
"enableNotifications": "Abilita Notifiche",
"checkingPermissions": "Controllo autorizzazioni...",
"alertDistance": "Distanza di avviso: ",
"meters": "metri",
"rangeInfo": "Intervallo: {}-{} metri (predefinito: {})"
"rangeInfo": "Intervallo: {}-{} {} (predefinito: {})"
},
"node": {
"title": "Nodo #{}",
@@ -140,8 +143,8 @@
"mustBeLoggedIn": "Devi essere loggato per inviare nuovi nodi. Per favore accedi tramite Impostazioni.",
"enableSubmittableProfile": "Abilita un profilo inviabile nelle Impostazioni per inviare nuovi nodi.",
"profileViewOnlyWarning": "Questo profilo è solo per la visualizzazione della mappa. Per favore seleziona un profilo inviabile per inviare nuovi nodi.",
"refineTags": "Affina Tag",
"refineTagsWithProfile": "Affina Tag ({})"
"loadingAreaData": "Caricamento dati area... Per favore attendi prima di inviare.",
"refineTags": "Affina Tag"
},
"editNode": {
"title": "Modifica Nodo #{}",
@@ -155,12 +158,16 @@
"sandboxModeWarning": "Impossibile inviare modifiche di nodi di produzione alla sandbox. Passa alla modalità Produzione nelle Impostazioni per modificare i nodi.",
"enableSubmittableProfile": "Abilita un profilo inviabile nelle Impostazioni per modificare i nodi.",
"profileViewOnlyWarning": "Questo profilo è solo per la visualizzazione della mappa. Per favore seleziona un profilo inviabile per modificare i nodi.",
"loadingAreaData": "Caricamento dati area... Per favore attendi prima di inviare.",
"cannotMoveConstrainedNode": "Impossibile spostare questa telecamera - è collegata a un altro elemento della mappa (OSM way/relation). Puoi ancora modificare i suoi tag e direzione.",
"zoomInRequiredMessage": "Ingrandisci almeno al livello {} per aggiungere o modificare nodi di sorveglianza. Questo garantisce un posizionamento preciso per una mappatura accurata.",
"extractFromWay": "Estrai nodo da way/relation",
"extractFromWaySubtitle": "Crea nuovo nodo con gli stessi tag, consenti spostamento in nuova posizione",
"refineTags": "Affina Tag",
"refineTagsWithProfile": "Affina Tag ({})"
"existingTags": "<Tag esistenti>",
"noChangesDetected": "Nessuna modifica rilevata - niente da inviare",
"noChangesTitle": "Nessuna Modifica da Inviare",
"noChangesMessage": "Non hai apportato modifiche a questo nodo. Per inviare una modifica, devi cambiare la posizione, il profilo, le direzioni o i tag."
},
"download": {
"title": "Scarica Area Mappa",
@@ -174,7 +181,10 @@
"offlineModeWarning": "Download disabilitati in modalità offline. Disabilita la modalità offline per scaricare nuove aree.",
"areaTooBigMessage": "Ingrandisci almeno al livello {} per scaricare aree offline. I download di aree grandi possono rendere l'app non reattiva.",
"downloadStarted": "Download avviato! Recupero tile e nodi...",
"downloadFailed": "Impossibile avviare il download: {}"
"downloadFailed": "Impossibile avviare il download: {}",
"offlineNotPermitted": "Il server {} non consente i download offline. Passa a un fornitore di tile che consenta l'uso offline (ad es., Bing Maps, Mapbox o un server di tile auto-ospitato).",
"currentTileProvider": "tile attuale",
"noTileProviderSelected": "Nessun provider di tile selezionato. Seleziona uno stile di mappa prima di scaricare un'area offline."
},
"downloadStarted": {
"title": "Download Avviato",
@@ -316,12 +326,22 @@
"view": "Visualizza",
"deleteProfile": "Elimina Profilo",
"deleteProfileConfirm": "Sei sicuro di voler eliminare \"{}\"?",
"profileDeleted": "Profilo eliminato"
"profileDeleted": "Profilo eliminato",
"getMore": "Ottieni altri...",
"addProfileChoice": "Aggiungi Profilo",
"addProfileChoiceMessage": "Come desideri aggiungere un profilo?",
"createCustomProfile": "Crea Profilo Personalizzato",
"createCustomProfileDescription": "Crea un profilo da zero con i tuoi tag",
"importFromWebsite": "Importa da Sito Web",
"importFromWebsiteDescription": "Sfoglia e importa profili da deflock.me/identify"
},
"mapTiles": {
"title": "Tile Mappa",
"manageProviders": "Gestisci Fornitori",
"attribution": "Attribuzione Mappa"
"attribution": "Attribuzione Mappa",
"mapAttribution": "Attribuzione mappa: {}",
"couldNotOpenLink": "Impossibile aprire il link",
"openLicense": "Apri licenza: {}"
},
"profileEditor": {
"viewProfile": "Visualizza Profilo",
@@ -348,7 +368,7 @@
},
"operatorProfileEditor": {
"newOperatorProfile": "Nuovo Profilo Operatore",
"editOperatorProfile": "Modifica Profilo Operatore",
"editOperatorProfile": "Modifica Profilo Operatore",
"operatorName": "Nome operatore",
"operatorNameHint": "es., Dipartimento di Polizia di Austin",
"operatorNameRequired": "Il nome dell'operatore è obbligatorio",
@@ -411,7 +431,11 @@
"profileTagsDescription": "Specificare valori per i tag che necessitano di raffinamento:",
"selectValue": "Seleziona un valore...",
"noValue": "(Nessun valore)",
"noSuggestions": "Nessun suggerimento disponibile"
"noSuggestions": "Nessun suggerimento disponibile",
"existingTagsTitle": "Tag Esistenti",
"existingTagsDescription": "Modifica i tag esistenti su questo dispositivo. Aggiungi, rimuovi o modifica qualsiasi tag:",
"existingOperator": "<Operatore esistente>",
"existingOperatorTags": "tag operatore esistenti"
},
"layerSelector": {
"cannotChangeTileTypes": "Impossibile cambiare tipi di tile durante il download di aree offline",
@@ -446,7 +470,9 @@
"timedOut": "Richiesta scaduta",
"noData": "Nessun dato offline",
"success": "Dati di sorveglianza caricati",
"nodeDataSlow": "Dati di sorveglianza lenti"
"nodeDataSlow": "Dati di sorveglianza lenti",
"rateLimited": "Limitato dal server",
"networkError": "Errore di rete"
},
"nodeLimitIndicator": {
"message": "Mostra {rendered} di {total} dispositivi",
@@ -481,13 +507,7 @@
"avoidanceDistance": "Distanza di evitamento",
"avoidanceDistanceSubtitle": "Distanza minima da mantenere dai dispositivi di sorveglianza",
"searchHistory": "Cronologia ricerca max",
"searchHistorySubtitle": "Numero massimo di ricerche recenti da ricordare",
"units": "Unità",
"unitsSubtitle": "Unità di visualizzazione per distanze e misure",
"metric": "Metrico (km, m)",
"imperial": "Imperiale (mi, ft)",
"meters": "metri",
"feet": "piedi"
"searchHistorySubtitle": "Numero massimo di ricerche recenti da ricordare"
},
"suspectedLocations": {
"title": "Posizioni Sospette",
@@ -506,7 +526,7 @@
"updateFailed": "Aggiornamento posizioni sospette fallito",
"neverFetched": "Mai recuperato",
"daysAgo": "{} giorni fa",
"hoursAgo": "{} ore fa",
"hoursAgo": "{} ore fa",
"minutesAgo": "{} minuti fa",
"justNow": "Proprio ora"
},
@@ -514,7 +534,7 @@
"title": "Posizione Sospetta #{}",
"ticketNo": "N. Ticket",
"address": "Indirizzo",
"street": "Via",
"street": "Via",
"city": "Città",
"state": "Stato",
"intersectingStreet": "Via che Interseca",
@@ -523,5 +543,19 @@
"url": "URL",
"coordinates": "Coordinate",
"noAddressAvailable": "Nessun indirizzo disponibile"
},
"units": {
"meters": "m",
"feet": "ft",
"kilometers": "km",
"miles": "mi",
"metersLong": "metri",
"feetLong": "piedi",
"kilometersLong": "chilometri",
"milesLong": "miglia",
"metric": "Metrico",
"imperial": "Imperiale",
"metricDescription": "Metrico (km, m)",
"imperialDescription": "Imperiale (mi, ft)"
}
}
}

561
lib/localizations/nl.json Normal file
View File

@@ -0,0 +1,561 @@
{
"language": {
"name": "Nederlands"
},
"app": {
"title": "DeFlock"
},
"about": {
"title": "DeFlock - Surveillance Transparantie",
"description": "DeFlock is een privacy-gerichte mobiele app voor het in kaart brengen van openbare surveillance infrastructuur met behulp van OpenStreetMap. Documenteer camera's, ALPR's, schot detectoren en andere surveillance apparaten in uw gemeenschap om deze infrastructuur zichtbaar en doorzoekbaar te maken.",
"features": "• Offline-capabel karteren met downloadbare gebieden\n• Direct uploaden naar OpenStreetMap met OAuth2\n• Ingebouwde profielen voor grote fabrikanten\n• Privacy-respecterend - geen gebruikersgegevens verzameld\n• Meerdere kaart tile providers (OSM, satellietbeelden)",
"initiative": "Onderdeel van het bredere DeFlock initiatief om surveillance transparantie te bevorderen.",
"footer": "Bezoek: deflock.me\nGebouwd met Flutter • Open Source",
"showWelcome": "Toon Welkomstbericht",
"showSubmissionGuide": "Toon Inzendingsgids",
"viewReleaseNotes": "Bekijk Release Notes"
},
"welcome": {
"title": "Welkom bij DeFlock",
"description": "DeFlock werd opgericht op het idee dat openbare surveillance tools transparant zouden moeten zijn. Binnen deze mobiele app, net zoals op de website, zult u de locatie van ALPR's en andere surveillance infrastructuur in uw lokale gebied en in het buitenland kunnen bekijken.",
"mission": "Echter, dit project is niet geautomatiseerd; het vraagt ons allemaal om dit project beter te maken. Bij het bekijken van de kaart kunt u op \"Nieuwe Node\" tikken om een voorheen onbekende installatie toe te voegen. Met uw hulp kunnen we ons doel van verhoogde transparantie en publiek bewustzijn van surveillance infrastructuur bereiken.",
"firsthandKnowledge": "BELANGRIJK: Draag alleen surveillance apparaten bij die u persoonlijk uit de eerste hand heeft waargenomen. OpenStreetMap en Google beleid verbiedt het gebruik van bronnen zoals Street View beelden voor inzendingen. Uw bijdragen moeten gebaseerd zijn op uw eigen directe waarnemingen.",
"privacy": "Privacy Opmerking: Deze app draait volledig lokaal op uw apparaat en gebruikt de derde partij OpenStreetMap API voor gegevensopslag en inzendingen. DeFlock verzamelt of slaat geen gebruikersgegevens op van welke aard dan ook, en is niet verantwoordelijk voor accountbeheer.",
"tileNote": "OPMERKING: De gratis kaart tiles van OpenStreetMap kunnen erg traag laden. Alternatieve tile providers kunnen geconfigureerd worden in Instellingen > Geavanceerd.",
"moreInfo": "U kunt meer links vinden onder Instellingen > Over.",
"dontShowAgain": "Toon dit welkomstbericht niet opnieuw",
"getStarted": "Laten we beginnen met DeFlocking!"
},
"submissionGuide": {
"title": "Inzending Beste Praktijken",
"description": "Voordat u uw eerste surveillance apparaat inzendt, neem even de tijd om deze belangrijke richtlijnen door te nemen om hoogwaardige bijdragen aan OpenStreetMap te garanderen.",
"bestPractices": "• Breng alleen apparaten in kaart die u persoonlijk uit de eerste hand heeft waargenomen\n• Neem de tijd om het apparaattype en fabrikant nauwkeurig te identificeren\n• Gebruik precieze positionering - zoom dichtbij voordat u de marker plaatst\n• Neem richtingsinformatie mee wanneer van toepassing\n• Controleer uw tag selecties dubbel voordat u inzendt",
"placementNote": "Onthoud: Nauwkeurige, eerste hands gegevens zijn essentieel voor de DeFlock gemeenschap en OpenStreetMap project.",
"moreInfo": "Voor gedetailleerde begeleiding bij apparaat identificatie en kartering beste praktijken:",
"identificationGuide": "Identificatie Gids",
"osmWiki": "OpenStreetMap Wiki",
"dontShowAgain": "Toon deze gids niet opnieuw",
"gotIt": "Begrepen!"
},
"positioningTutorial": {
"title": "Verfijn Uw Locatie",
"instructions": "Sleep de kaart om de apparaat marker precies over de locatie van het surveillance apparaat te positioneren.",
"hint": "U kunt inzoomen voor betere nauwkeurigheid voordat u positioneert."
},
"actions": {
"tagNode": "Nieuwe Node",
"download": "Download",
"settings": "Instellingen",
"edit": "Bewerken",
"delete": "Verwijderen",
"cancel": "Annuleren",
"ok": "OK",
"close": "Sluiten",
"submit": "Indienen",
"logIn": "Inloggen",
"saveEdit": "Bewerking Opslaan",
"clear": "Wissen",
"viewOnOSM": "Bekijk op OSM",
"advanced": "Geavanceerd",
"useAdvancedEditor": "Gebruik Geavanceerde Editor"
},
"proximityWarning": {
"title": "Node Zeer Dichtbij Bestaand Apparaat",
"message": "Deze node is slechts {} meter van een bestaand surveillance apparaat.",
"suggestion": "Als meerdere apparaten op dezelfde paal staan, gebruik dan meerdere richtingen op een enkele node in plaats van aparte nodes te creëren.",
"nearbyNodes": "Nabijgelegen apparaat/apparaten gevonden ({}):",
"nodeInfo": "Node #{} - {}",
"andMore": "...en {} meer",
"goBack": "Ga Terug",
"submitAnyway": "Toch Indienen",
"nodeType": {
"alpr": "ALPR/ANPR Camera",
"publicCamera": "Openbare Surveillance Camera",
"camera": "Surveillance Camera",
"amenity": "{}",
"device": "{} Apparaat",
"unknown": "Onbekend Apparaat"
}
},
"followMe": {
"off": "Schakel volg-me in",
"follow": "Schakel volg-me in (roterend)",
"rotating": "Schakel volg-me uit"
},
"settings": {
"title": "Instellingen",
"language": "Taal & Regio",
"systemDefault": "Systeem Standaard",
"aboutInfo": "Over / Info",
"aboutThisApp": "Over Deze App",
"aboutSubtitle": "App informatie en credits",
"languageSubtitle": "Kies uw voorkeurtaal en eenheden",
"distanceUnit": "Afstand Eenheden",
"distanceUnitSubtitle": "Kies tussen metrische (km/m) of imperiale (mijl/voet) eenheden",
"metricUnits": "Metrisch (km, m)",
"imperialUnits": "Imperiaal (mijl, voet)",
"maxNodes": "Max getekende nodes",
"maxNodesSubtitle": "Stel een bovengrens in voor het aantal nodes op de kaart.",
"maxNodesWarning": "U wilt dit waarschijnlijk niet doen tenzij u absoluut zeker weet dat u daar een goede reden voor heeft.",
"offlineMode": "Offline Modus",
"offlineModeSubtitle": "Schakel alle netwerk verzoeken uit behalve voor lokale/offline gebieden.",
"pauseQueueProcessing": "Pauzeer Upload Wachtrij",
"pauseQueueProcessingSubtitle": "Stop het uploaden van wachtrij veranderingen terwijl live data toegang behouden blijft.",
"offlineModeWarningTitle": "Actieve Downloads",
"offlineModeWarningMessage": "Het inschakelen van offline modus zal alle actieve gebied downloads annuleren. Wilt u doorgaan?",
"enableOfflineMode": "Schakel Offline Modus In",
"profiles": "Profielen",
"profilesSubtitle": "Beheer node en operator profielen",
"offlineSettings": "Offline Instellingen",
"offlineSettingsSubtitle": "Beheer offline modus en gedownloade gebieden",
"advancedSettings": "Geavanceerde Instellingen",
"advancedSettingsSubtitle": "Prestaties, waarschuwingen en tile provider instellingen",
"proximityAlerts": "Nabijheids Waarschuwingen",
"networkStatusIndicator": "Netwerk Status Indicator"
},
"proximityAlerts": {
"getNotified": "Krijg meldingen wanneer u surveillance apparaten nadert",
"batteryUsage": "Gebruikt extra batterij voor continue locatie monitoring",
"notificationsEnabled": "✓ Meldingen ingeschakeld",
"notificationsDisabled": "⚠ Meldingen uitgeschakeld",
"permissionRequired": "Melding toestemming vereist",
"permissionExplanation": "Push meldingen zijn uitgeschakeld. U ziet alleen in-app waarschuwingen en wordt niet gewaarschuwd wanneer de app op de achtergrond draait.",
"enableNotifications": "Schakel Meldingen In",
"checkingPermissions": "Toestemmingen controleren...",
"alertDistance": "Waarschuwingsafstand: ",
"rangeInfo": "Bereik: {}-{} {} (standaard: {})"
},
"node": {
"title": "Node #{}",
"tagSheetTitle": "Surveillance Apparaat Tags",
"queuedForUpload": "Node in wachtrij geplaatst voor upload",
"editQueuedForUpload": "Node bewerking in wachtrij geplaatst voor upload",
"deleteQueuedForUpload": "Node verwijdering in wachtrij geplaatst voor upload",
"confirmDeleteTitle": "Verwijder Node",
"confirmDeleteMessage": "Weet u zeker dat u node #{} wilt verwijderen? Deze actie kan niet ongedaan worden gemaakt."
},
"addNode": {
"profile": "Profiel",
"selectProfile": "Selecteer een profiel...",
"profileRequired": "Selecteer een profiel om door te gaan.",
"direction": "Richting {}°",
"profileNoDirectionInfo": "Dit profiel vereist geen richting.",
"mustBeLoggedIn": "U moet ingelogd zijn om nieuwe nodes in te dienen. Log in via Instellingen.",
"enableSubmittableProfile": "Schakel een indienbaar profiel in via Instellingen om nieuwe nodes in te dienen.",
"profileViewOnlyWarning": "Dit profiel is alleen voor kaart weergave. Selecteer een indienbaar profiel om nieuwe nodes in te dienen.",
"loadingAreaData": "Gebied gegevens laden... Wacht even voordat u indient.",
"refineTags": "Tags Verfijnen"
},
"editNode": {
"title": "Bewerk Node #{}",
"profile": "Profiel",
"selectProfile": "Selecteer een profiel...",
"profileRequired": "Selecteer een profiel om door te gaan.",
"direction": "Richting {}°",
"profileNoDirectionInfo": "Dit profiel vereist geen richting.",
"temporarilyDisabled": "Bewerkingen zijn tijdelijk uitgeschakeld terwijl we een bug oplossen - excuses - controleer binnenkort opnieuw.",
"mustBeLoggedIn": "U moet ingelogd zijn om nodes te bewerken. Log in via Instellingen.",
"sandboxModeWarning": "Kan geen bewerkingen op productie nodes naar sandbox versturen. Schakel naar Productie modus in Instellingen om nodes te bewerken.",
"enableSubmittableProfile": "Schakel een indienbaar profiel in via Instellingen om nodes te bewerken.",
"profileViewOnlyWarning": "Dit profiel is alleen voor kaart weergave. Selecteer een indienbaar profiel om nodes te bewerken.",
"loadingAreaData": "Gebied gegevens laden... Wacht even voordat u indient.",
"cannotMoveConstrainedNode": "Kan deze camera niet verplaatsen - het is verbonden met een ander kaart element (OSM weg/relatie). U kunt nog steeds de tags en richting bewerken.",
"zoomInRequiredMessage": "Zoom in tot ten minste niveau {} om surveillance nodes toe te voegen of te bewerken. Dit zorgt voor precieze positionering voor nauwkeurige kartering.",
"extractFromWay": "Haal node uit weg/relatie",
"extractFromWaySubtitle": "Maak nieuwe node met dezelfde tags, sta verplaatsing naar nieuwe locatie toe",
"refineTags": "Tags Verfijnen",
"existingTags": "<Bestaande tags>",
"noChangesDetected": "Geen wijzigingen gedetecteerd - niets om in te dienen",
"noChangesTitle": "Geen Wijzigingen om In Te Dienen",
"noChangesMessage": "U heeft geen wijzigingen gemaakt aan deze node. Om een bewerking in te dienen, moet u de locatie, profiel, richtingen of tags wijzigen."
},
"download": {
"title": "Download Kaart Gebied",
"maxZoomLevel": "Max zoom niveau",
"storageEstimate": "Opslag schatting:",
"tilesAndSize": "{} tiles, {} MB",
"minZoom": "Min zoom:",
"maxRecommendedZoom": "Max aanbevolen zoom: Z{}",
"withinTileLimit": "Binnen {} tile limiet",
"exceedsTileLimit": "Huidige selectie overschrijdt {} tile limiet",
"offlineModeWarning": "Downloads uitgeschakeld in offline modus. Schakel offline modus uit om nieuwe gebieden te downloaden.",
"areaTooBigMessage": "Zoom in tot ten minste niveau {} om offline gebieden te downloaden. Grote gebied downloads kunnen ervoor zorgen dat de app niet meer reageert.",
"downloadStarted": "Download gestart! Tiles en nodes ophalen...",
"downloadFailed": "Download starten mislukt: {}",
"offlineNotPermitted": "De {}-server staat geen offline downloads toe. Schakel over naar een tegelserver die offline gebruik toestaat (bijv. Bing Maps, Mapbox of een zelf gehoste tegelserver).",
"currentTileProvider": "huidige tegel",
"noTileProviderSelected": "Geen tegelprovider geselecteerd. Selecteer een kaartstijl voordat u een offlinegebied downloadt."
},
"downloadStarted": {
"title": "Download Gestart",
"message": "Download gestart! Tiles en nodes ophalen...",
"ok": "OK",
"viewProgress": "Bekijk Voortgang in Instellingen"
},
"uploadMode": {
"title": "Upload Bestemming",
"subtitle": "Kies waar camera's geüpload worden",
"production": "Productie",
"sandbox": "Sandbox",
"simulate": "Simuleren",
"productionDescription": "Upload naar de live OSM database (zichtbaar voor alle gebruikers)",
"sandboxDescription": "Uploads gaan naar de OSM Sandbox (veilig voor testen, wordt regelmatig gereset).",
"simulateDescription": "Simuleer uploads (neemt geen contact op met OSM servers)",
"cannotChangeWithQueue": "Kan upload bestemming niet wijzigen terwijl {} items in wachtrij staan. Wis eerst de wachtrij."
},
"auth": {
"osmAccountTitle": "OpenStreetMap Account",
"osmAccountSubtitle": "Beheer uw OSM login en bekijk uw bijdragen",
"loggedInAs": "Ingelogd als {}",
"loginToOSM": "Inloggen bij OpenStreetMap",
"tapToLogout": "Tik om uit te loggen",
"requiredToSubmit": "Vereist om camera gegevens in te dienen",
"loggedOut": "Uitgelogd",
"testConnection": "Test Verbinding",
"testConnectionSubtitle": "Verifieer dat OSM credentials werken",
"connectionOK": "Verbinding OK - credentials zijn geldig",
"connectionFailed": "Verbinding mislukt - log alstublieft opnieuw in",
"viewMyEdits": "Bekijk Mijn Bewerkingen op OSM",
"viewMyEditsSubtitle": "Zie uw bewerkingsgeschiedenis op OpenStreetMap",
"aboutOSM": "Over OpenStreetMap",
"aboutOSMDescription": "OpenStreetMap is een collaboratief, open-source kaartproject waar bijdragers een gratis, bewerkbare kaart van de wereld maken en onderhouden. Uw surveillance apparaat bijdragen helpen deze infrastructuur zichtbaar en doorzoekbaar te maken.",
"visitOSM": "Bezoek OpenStreetMap",
"deleteAccount": "Verwijder OSM Account",
"deleteAccountSubtitle": "Beheer uw OpenStreetMap account",
"deleteAccountExplanation": "Om uw OpenStreetMap account te verwijderen, moet u de OpenStreetMap website bezoeken. Dit zal permanent uw OSM account en alle bijbehorende gegevens verwijderen.",
"deleteAccountWarning": "Waarschuwing: Deze actie kan niet ongedaan worden gemaakt en zal permanent uw OSM account verwijderen.",
"goToOSM": "Ga naar OpenStreetMap",
"accountManagement": "Account Beheer",
"accountManagementDescription": "Om uw OpenStreetMap account te verwijderen, moet u de juiste OpenStreetMap website bezoeken. Dit zal permanent uw account en alle bijbehorende gegevens verwijderen.",
"currentDestinationProduction": "Momenteel verbonden met: Productie OpenStreetMap",
"currentDestinationSandbox": "Momenteel verbonden met: Sandbox OpenStreetMap",
"currentDestinationSimulate": "Momenteel in: Simuleer modus (geen echt account)",
"viewMessages": "Bekijk Berichten op OSM",
"unreadMessagesCount": "U heeft {} ongelezen berichten",
"noUnreadMessages": "Geen ongelezen berichten",
"reauthRequired": "Ververs Authenticatie",
"reauthExplanation": "U moet uw authenticatie verversen om OSM bericht meldingen te ontvangen via de app.",
"reauthBenefit": "Dit zal melding stippen inschakelen wanneer u ongelezen berichten heeft op OpenStreetMap.",
"reauthNow": "Doe Dat Nu",
"reauthLater": "Later"
},
"queue": {
"title": "Upload Wachtrij",
"subtitle": "Beheer wachtende surveillance apparaat uploads",
"pendingUploads": "Wachtende uploads: {}",
"pendingItemsCount": "Wachtende Items: {}",
"nothingInQueue": "Niets in wachtrij",
"simulateModeEnabled": "Simuleer modus ingeschakeld uploads gesimuleerd",
"sandboxMode": "Sandbox modus uploads gaan naar OSM Sandbox",
"tapToViewQueue": "Tik om wachtrij te bekijken",
"clearUploadQueue": "Wis Upload Wachtrij",
"removeAllPending": "Verwijder alle {} wachtende uploads",
"clearQueueTitle": "Wis Wachtrij",
"clearQueueConfirm": "Alle {} wachtende uploads verwijderen?",
"queueCleared": "Wachtrij gewist",
"uploadQueueTitle": "Upload Wachtrij ({} items)",
"queueIsEmpty": "Wachtrij is leeg",
"itemWithIndex": "Item {}",
"error": " (Fout)",
"completing": " (Voltooien...)",
"destination": "Bestemming: {}",
"latitude": "Breedtegraad: {}",
"longitude": "Lengtegraad: {}",
"direction": "Richting: {}°",
"attempts": "Pogingen: {}",
"uploadFailedRetry": "Upload mislukt. Tik opnieuw proberen om nog eens te proberen.",
"retryUpload": "Probeer upload opnieuw",
"clearAll": "Wis Alles",
"errorDetails": "Fout Details",
"creatingChangeset": " (Changeset maken...)",
"uploading": " (Uploaden...)",
"closingChangeset": " (Changeset sluiten...)",
"processingPaused": "Wachtrij Verwerking Gepauzeerd",
"pausedDueToOffline": "Upload verwerking is gepauzeerd omdat offline modus is ingeschakeld.",
"pausedByUser": "Upload verwerking is handmatig gepauzeerd."
},
"tileProviders": {
"title": "Tile Providers",
"noProvidersConfigured": "Geen tile providers geconfigureerd",
"tileTypesCount": "{} tile types",
"apiKeyConfigured": "API Key geconfigureerd",
"needsApiKey": "Heeft API key nodig",
"editProvider": "Bewerk Provider",
"addProvider": "Voeg Provider Toe",
"deleteProvider": "Verwijder Provider",
"deleteProviderConfirm": "Weet u zeker dat u \"{}\" wilt verwijderen?",
"providerName": "Provider Naam",
"providerNameHint": "bijv., Aangepaste Kaarten B.V.",
"providerNameRequired": "Provider naam is vereist",
"apiKey": "API Key (Optioneel)",
"apiKeyHint": "Voer API key in indien vereist door tile types",
"tileTypes": "Tile Types",
"addType": "Voeg Type Toe",
"noTileTypesConfigured": "Geen tile types geconfigureerd",
"atLeastOneTileTypeRequired": "Minstens één tile type is vereist",
"manageTileProviders": "Beheer Providers"
},
"tileTypeEditor": {
"editTileType": "Bewerk Tile Type",
"addTileType": "Voeg Tile Type Toe",
"name": "Naam",
"nameHint": "bijv., Satelliet",
"nameRequired": "Naam is vereist",
"urlTemplate": "URL Template",
"urlTemplateHint": "https://example.com/{z}/{x}/{y}.png",
"urlTemplateRequired": "URL template is vereist",
"urlTemplatePlaceholders": "URL moet ofwel {quadkey} of {z}, {x}, en {y} placeholders bevatten",
"attribution": "Attributie",
"attributionHint": "© Kaart Provider",
"attributionRequired": "Attributie is vereist",
"maxZoom": "Max Zoom Niveau",
"maxZoomHint": "Maximum zoom niveau (1-23)",
"maxZoomRequired": "Max zoom is vereist",
"maxZoomInvalid": "Max zoom moet een nummer zijn",
"maxZoomRange": "Max zoom moet tussen {} en {} zijn",
"fetchPreview": "Haal Voorbeeld Op",
"previewTileLoaded": "Voorbeeld tile succesvol geladen",
"previewTileFailed": "Kon voorbeeld niet ophalen: {}",
"save": "Opslaan"
},
"profiles": {
"nodeProfiles": "Node Profielen",
"newProfile": "Nieuw Profiel",
"builtIn": "Ingebouwd",
"custom": "Aangepast",
"view": "Bekijk",
"deleteProfile": "Verwijder Profiel",
"deleteProfileConfirm": "Weet u zeker dat u \"{}\" wilt verwijderen?",
"profileDeleted": "Profiel verwijderd",
"getMore": "Krijg meer...",
"addProfileChoice": "Voeg Profiel Toe",
"addProfileChoiceMessage": "Hoe wilt u een profiel toevoegen?",
"createCustomProfile": "Maak Aangepast Profiel",
"createCustomProfileDescription": "Bouw een profiel vanaf nul met uw eigen tags",
"importFromWebsite": "Importeer van Website",
"importFromWebsiteDescription": "Blader en importeer profielen van deflock.me/identify"
},
"mapTiles": {
"title": "Kaart Tiles",
"manageProviders": "Beheer Providers",
"attribution": "Kaart Attributie",
"mapAttribution": "Kaartbron: {}",
"couldNotOpenLink": "Kon link niet openen",
"openLicense": "Open licentie: {}"
},
"profileEditor": {
"viewProfile": "Bekijk Profiel",
"newProfile": "Nieuw Profiel",
"editProfile": "Bewerk Profiel",
"profileName": "Profiel naam",
"profileNameHint": "bijv., Aangepaste ALPR Camera",
"profileNameRequired": "Profiel naam is vereist",
"requiresDirection": "Vereist Richting",
"requiresDirectionSubtitle": "Of camera's van dit type een richting tag nodig hebben",
"fov": "Gezichtsveld",
"fovHint": "FOV in graden (laat leeg voor standaard)",
"fovSubtitle": "Camera gezichtsveld - gebruikt voor kegel breedte en bereik inzending formaat",
"fovInvalid": "FOV moet tussen 1 en 360 graden zijn",
"submittable": "Indienbaar",
"submittableSubtitle": "Of dit profiel gebruikt kan worden voor camera inzendingen",
"osmTags": "OSM Tags",
"addTag": "Voeg tag toe",
"saveProfile": "Sla Profiel Op",
"keyHint": "sleutel",
"valueHint": "waarde",
"atLeastOneTagRequired": "Minstens één tag is vereist",
"profileSaved": "Profiel \"{}\" opgeslagen"
},
"operatorProfileEditor": {
"newOperatorProfile": "Nieuw Operator Profiel",
"editOperatorProfile": "Bewerk Operator Profiel",
"operatorName": "Operator naam",
"operatorNameHint": "bijv., Amsterdam Politie",
"operatorNameRequired": "Operator naam is vereist",
"operatorProfileSaved": "Operator profiel \"{}\" opgeslagen"
},
"operatorProfiles": {
"title": "Operator Profielen",
"noProfilesMessage": "Geen operator profielen gedefinieerd. Maak er een om operator tags toe te passen op node inzendingen.",
"tagsCount": "{} tags",
"deleteOperatorProfile": "Verwijder Operator Profiel",
"deleteOperatorProfileConfirm": "Weet u zeker dat u \"{}\" wilt verwijderen?",
"operatorProfileDeleted": "Operator profiel verwijderd"
},
"offlineAreas": {
"title": "Offline Gebieden",
"noAreasTitle": "Geen offline gebieden",
"noAreasSubtitle": "Download een kaart gebied voor offline gebruik.",
"provider": "Provider",
"maxZoom": "Max zoom",
"zoomLevels": "Z{}-{}",
"latitude": "Breedtegraad",
"longitude": "Lengtegraad",
"tiles": "Tiles",
"size": "Grootte",
"nodes": "Nodes",
"areaIdFallback": "Gebied {}...",
"renameArea": "Hernoem gebied",
"refreshWorldTiles": "Ververs/herdownload wereld tiles",
"deleteOfflineArea": "Verwijder offline gebied",
"cancelDownload": "Annuleer download",
"renameAreaDialogTitle": "Hernoem Offline Gebied",
"areaNameLabel": "Gebied Naam",
"renameButton": "Hernoem",
"megabytes": "MB",
"kilobytes": "KB",
"progress": "{}%",
"refreshArea": "Ververs gebied",
"refreshAreaDialogTitle": "Ververs Offline Gebied",
"refreshAreaDialogSubtitle": "Kies wat te verversen voor dit gebied:",
"refreshTiles": "Ververs Kaart Tiles",
"refreshTilesSubtitle": "Herdownload alle tiles voor bijgewerkte beelden",
"refreshNodes": "Ververs Nodes",
"refreshNodesSubtitle": "Haal node gegevens opnieuw op voor dit gebied",
"startRefresh": "Start Verversen",
"refreshStarted": "Verversen gestart!",
"refreshFailed": "Verversen mislukt: {}"
},
"refineTagsSheet": {
"title": "Verfijn Tags",
"operatorProfile": "Operator Profiel",
"done": "Klaar",
"none": "Geen",
"noAdditionalOperatorTags": "Geen aanvullende operator tags",
"additionalTags": "aanvullende tags",
"additionalTagsTitle": "Aanvullende Tags",
"noTagsDefinedForProfile": "Geen tags gedefinieerd voor dit operator profiel.",
"noOperatorProfiles": "Geen operator profielen gedefinieerd",
"noOperatorProfilesMessage": "Maak operator profielen in Instellingen om aanvullende tags toe te passen op uw node inzendingen.",
"profileTags": "Profiel Tags",
"profileTagsDescription": "Vul deze optionele tag waarden in voor meer gedetailleerde inzendingen:",
"selectValue": "Selecteer waarde...",
"noValue": "(laat leeg)",
"noSuggestions": "Geen suggesties beschikbaar",
"existingTagsTitle": "Bestaande Tags",
"existingTagsDescription": "Bewerk de bestaande tags op dit apparaat. Voeg toe, verwijder of wijzig elke tag:",
"existingOperator": "<Bestaande operator>",
"existingOperatorTags": "bestaande operator tags"
},
"layerSelector": {
"cannotChangeTileTypes": "Kan tile types niet wijzigen tijdens het downloaden van offline gebieden",
"selectMapLayer": "Selecteer Kaart Laag",
"noTileProvidersAvailable": "Geen tile providers beschikbaar"
},
"advancedEdit": {
"title": "Geavanceerde Bewerkingsopties",
"subtitle": "Deze editors bieden meer geavanceerde functies voor complexe bewerkingen.",
"webEditors": "Web Editors",
"mobileEditors": "Mobiele Editors",
"iDEditor": "iD Editor",
"iDEditorSubtitle": "Volledig uitgeruste web editor - werkt altijd",
"rapidEditor": "RapiD Editor",
"rapidEditorSubtitle": "AI-geassisteerde bewerking met Facebook data",
"vespucci": "Vespucci",
"vespucciSubtitle": "Geavanceerde Android OSM editor",
"streetComplete": "StreetComplete",
"streetCompleteSubtitle": "Enquête-gebaseerde mapping app",
"everyDoor": "EveryDoor",
"everyDoorSubtitle": "Snelle POI bewerking",
"goMap": "Go Map!!",
"goMapSubtitle": "iOS OSM editor",
"couldNotOpenEditor": "Kon editor niet openen - app is mogelijk niet geïnstalleerd",
"couldNotOpenURL": "Kon URL niet openen",
"couldNotOpenOSMWebsite": "Kon OSM website niet openen"
},
"networkStatus": {
"showIndicator": "Toon netwerk status indicator",
"showIndicatorSubtitle": "Toon surveillance data laden en fout status",
"loading": "Surveillance data laden...",
"timedOut": "Verzoek verlopen",
"noData": "Geen offline data",
"success": "Surveillance data geladen",
"nodeDataSlow": "Surveillance data traag",
"rateLimited": "Snelheid beperkt door server",
"networkError": "Netwerk fout"
},
"nodeLimitIndicator": {
"message": "{rendered} van {total} apparaten getoond",
"editingDisabledMessage": "Te veel apparaten getoond om veilig te bewerken. Zoom verder in om het aantal zichtbare apparaten te verminderen, probeer dan opnieuw."
},
"navigation": {
"searchLocation": "Zoek Locatie",
"searchPlaceholder": "Zoek plaatsen of coördinaten...",
"routeTo": "Route Naar",
"routeFrom": "Route Vanaf",
"selectLocation": "Selecteer Locatie",
"calculatingRoute": "Route berekenen...",
"routeCalculationFailed": "Route berekening mislukt",
"start": "Start",
"resume": "Hervatten",
"endRoute": "Beëindig Route",
"routeOverview": "Route Overzicht",
"retry": "Opnieuw Proberen",
"cancelSearch": "Annuleer zoeken",
"noResultsFound": "Geen resultaten gevonden",
"searching": "Zoeken...",
"location": "Locatie",
"startPoint": "Start",
"endPoint": "Einde",
"startSelect": "Start (selecteer)",
"endSelect": "Einde (selecteer)",
"distance": "Afstand: {} km",
"routeActive": "Route actief",
"locationsTooClose": "Start en eind locaties zijn te dicht bij elkaar",
"navigationSettings": "Navigatie",
"navigationSettingsSubtitle": "Route planning en vermijding instellingen",
"avoidanceDistance": "Vermijding Afstand",
"avoidanceDistanceSubtitle": "Minimum afstand om weg te blijven van surveillance apparaten",
"searchHistory": "Max Zoekgeschiedenis",
"searchHistorySubtitle": "Maximum aantal recente zoekopdrachten om te onthouden"
},
"suspectedLocations": {
"title": "Verdachte Locaties",
"showSuspectedLocations": "Toon Verdachte Locaties",
"showSuspectedLocationsSubtitle": "Toon vraagteken markers voor verdachte surveillance sites van nutsbedrijf vergunning data",
"lastUpdated": "Laatst Bijgewerkt",
"refreshNow": "Ververs nu",
"dataSource": "Gegevensbron",
"dataSourceDescription": "Nutsbedrijf vergunning data die mogelijke surveillance infrastructuur installatie sites aangeeft",
"dataSourceCredit": "Gegevens verzameling en hosting geleverd door alprwatch.org",
"minimumDistance": "Minimum Afstand van Echte Nodes",
"minimumDistanceSubtitle": "Verberg verdachte locaties binnen {}m van bestaande surveillance apparaten",
"updating": "Verdachte Locaties Bijwerken",
"downloadingAndProcessing": "Data downloaden en verwerken...",
"updateSuccess": "Verdachte locaties succesvol bijgewerkt",
"updateFailed": "Kon verdachte locaties niet bijwerken",
"neverFetched": "Nooit opgehaald",
"daysAgo": "{} dagen geleden",
"hoursAgo": "{} uur geleden",
"minutesAgo": "{} minuten geleden",
"justNow": "Zojuist"
},
"suspectedLocation": {
"title": "Verdachte Locatie #{}",
"ticketNo": "Ticket Nr",
"address": "Adres",
"street": "Straat",
"city": "Stad",
"state": "Provincie",
"intersectingStreet": "Kruisende Straat",
"workDoneFor": "Werk Gedaan Voor",
"remarks": "Opmerkingen",
"url": "URL",
"coordinates": "Coördinaten",
"noAddressAvailable": "Geen adres beschikbaar"
},
"units": {
"meters": "m",
"feet": "ft",
"kilometers": "km",
"miles": "mijl",
"metersLong": "meters",
"feetLong": "voet",
"kilometersLong": "kilometers",
"milesLong": "mijlen",
"metric": "Metrisch",
"imperial": "Imperiaal",
"metricDescription": "Metrisch (km, m)",
"imperialDescription": "Imperiaal (mijl, ft)"
}
}

561
lib/localizations/pl.json Normal file
View File

@@ -0,0 +1,561 @@
{
"language": {
"name": "Polski"
},
"app": {
"title": "DeFlock"
},
"about": {
"title": "DeFlock - Przejrzystość Nadzoru",
"description": "DeFlock to mobilna aplikacja skoncentrowana na prywatności do mapowania publicznej infrastruktury nadzoru przy użyciu OpenStreetMap. Dokumentuj kamery, ALPR, detektory wystrzałów i inne urządzenia nadzoru w swojej społeczności, aby uczynić tę infrastrukturę widoczną i możliwą do przeszukiwania.",
"features": "• Mapowanie offline z obszarami do pobrania\n• Przesyłanie bezpośrednio do OpenStreetMap z OAuth2\n• Wbudowane profile dla głównych producentów\n• Szanujące prywatność - nie zbierane są dane użytkownika\n• Wielu dostawców kafelków map (OSM, zdjęcia satelitarne)",
"initiative": "Część szerszej inicjatywy DeFlock promującej przejrzystość nadzoru.",
"footer": "Odwiedź: deflock.me\nZbudowane z Flutter • Open Source",
"showWelcome": "Pokaż Wiadomość Powitalną",
"showSubmissionGuide": "Pokaż Przewodnik Zgłaszania",
"viewReleaseNotes": "Zobacz Notatki Wydania"
},
"welcome": {
"title": "Witamy w DeFlock",
"description": "DeFlock został założony na idei, że narzędzia publicznego nadzoru powinny być przejrzyste. W tej aplikacji mobilnej, jak i na stronie internetowej, będziesz mógł przeglądać lokalizacje ALPR i innych infrastruktur nadzoru w Twoim lokalnym obszarze i za granicą.",
"mission": "Jednak ten projekt nie jest zautomatyzowany; potrzeba nas wszystkich, aby ten projekt uczynić lepszym. Podczas przeglądania mapy możesz stuknąć \"Nowy Węzeł\", aby dodać wcześniej nieznaną instalację. Z Twoją pomocą możemy osiągnąć nasz cel zwiększonej przejrzystości i publicznej świadomości infrastruktury nadzoru.",
"firsthandKnowledge": "WAŻNE: Dodawaj tylko urządzenia nadzoru, które osobiście obserwowałeś z pierwszej ręki. Polityki OpenStreetMap i Google zabraniają używania źródeł takich jak zdjęcia Street View do zgłoszeń. Twoje wkłady powinny być oparte na Twoich własnych bezpośrednich obserwacjach.",
"privacy": "Uwaga o Prywatności: Ta aplikacja działa całkowicie lokalnie na Twoim urządzeniu i używa zewnętrznego API OpenStreetMap do przechowywania danych i zgłoszeń. DeFlock nie zbiera ani nie przechowuje żadnych danych użytkownika jakiegokolwiek rodzaju i nie jest odpowiedzialny za zarządzanie kontami.",
"tileNote": "UWAGA: Darmowe kafelki map z OpenStreetMap mogą ładować się bardzo wolno. Alternatywni dostawcy kafelków mogą być skonfigurowani w Ustawieniach > Zaawansowane.",
"moreInfo": "Więcej linków znajdziesz w Ustawieniach > O aplikacji.",
"dontShowAgain": "Nie pokazuj ponownie tej wiadomości powitalnej",
"getStarted": "Zacznijmy DeFlocking!"
},
"submissionGuide": {
"title": "Najlepsze Praktyki Zgłaszania",
"description": "Przed zgłoszeniem Twojego pierwszego urządzenia nadzoru, poświęć chwilę na przejrzenie tych ważnych wytycznych, aby zapewnić wysokiej jakości wkłady do OpenStreetMap.",
"bestPractices": "• Mapuj tylko urządzenia, które osobiście obserwowałeś z pierwszej ręki\n• Poświęć czas na dokładną identyfikację typu urządzenia i producenta\n• Używaj precyzyjnego pozycjonowania - przybliż przed umieszczeniem znacznika\n• Dołączaj informacje o kierunku, gdy ma to zastosowanie\n• Sprawdź dwukrotnie swoje wybory tagów przed zgłoszeniem",
"placementNote": "Pamiętaj: Dokładne dane z pierwszej ręki są kluczowe dla społeczności DeFlock i projektu OpenStreetMap.",
"moreInfo": "Dla szczegółowego przewodnika po identyfikacji urządzeń i najlepszych praktykach mapowania:",
"identificationGuide": "Przewodnik Identyfikacji",
"osmWiki": "OpenStreetMap Wiki",
"dontShowAgain": "Nie pokazuj ponownie tego przewodnika",
"gotIt": "Rozumiem!"
},
"positioningTutorial": {
"title": "Doprecyzuj Swoją Lokalizację",
"instructions": "Przeciągnij mapę, aby precyzyjnie ustawić znacznik urządzenia nad lokalizacją urządzenia nadzoru.",
"hint": "Możesz przybliżyć dla lepszej dokładności przed pozycjonowaniem."
},
"actions": {
"tagNode": "Nowy Węzeł",
"download": "Pobierz",
"settings": "Ustawienia",
"edit": "Edytuj",
"delete": "Usuń",
"cancel": "Anuluj",
"ok": "OK",
"close": "Zamknij",
"submit": "Zgłoś",
"logIn": "Zaloguj",
"saveEdit": "Zapisz Edycję",
"clear": "Wyczyść",
"viewOnOSM": "Zobacz w OSM",
"advanced": "Zaawansowane",
"useAdvancedEditor": "Użyj Zaawansowanego Edytora"
},
"proximityWarning": {
"title": "Węzeł Bardzo Blisko Istniejącego Urządzenia",
"message": "Ten węzeł jest tylko {} metrów od istniejącego urządzenia nadzoru.",
"suggestion": "Jeśli wiele urządzeń znajduje się na tym samym słupie, użyj wielu kierunków na jednym węźle zamiast tworzenia oddzielnych węzłów.",
"nearbyNodes": "Znaleziono pobliskie urządzenie/urządzenia ({}):",
"nodeInfo": "Węzeł #{} - {}",
"andMore": "...i {} więcej",
"goBack": "Wróć",
"submitAnyway": "Zgłoś Mimo To",
"nodeType": {
"alpr": "Kamera ALPR/ANPR",
"publicCamera": "Kamera Nadzoru Publicznego",
"camera": "Kamera Nadzoru",
"amenity": "{}",
"device": "Urządzenie {}",
"unknown": "Nieznane Urządzenie"
}
},
"followMe": {
"off": "Włącz śledzenie",
"follow": "Włącz śledzenie (obracające)",
"rotating": "Wyłącz śledzenie"
},
"settings": {
"title": "Ustawienia",
"language": "Język i Region",
"systemDefault": "Domyślne Systemowe",
"aboutInfo": "O / Informacje",
"aboutThisApp": "O Tej Aplikacji",
"aboutSubtitle": "Informacje o aplikacji i autorzy",
"languageSubtitle": "Wybierz preferowany język i jednostki",
"distanceUnit": "Jednostki Odległości",
"distanceUnitSubtitle": "Wybierz między jednostkami metrycznymi (km/m) lub imperialnymi (mila/stopa)",
"metricUnits": "Metryczne (km, m)",
"imperialUnits": "Imperialne (mila, stopa)",
"maxNodes": "Maksymalna liczba rysowanych węzłów",
"maxNodesSubtitle": "Ustaw górny limit liczby węzłów na mapie.",
"maxNodesWarning": "Prawdopodobnie nie chcesz tego robić, chyba że jesteś absolutnie pewien, że masz dobry powód.",
"offlineMode": "Tryb Offline",
"offlineModeSubtitle": "Wyłącz wszystkie żądania sieciowe z wyjątkiem lokalnych/offline obszarów.",
"pauseQueueProcessing": "Wstrzymaj Przetwarzanie Kolejki Przesyłania",
"pauseQueueProcessingSubtitle": "Zatrzymaj przesyłanie kolejkowanych zmian zachowując dostęp do danych na żywo.",
"offlineModeWarningTitle": "Aktywne Pobierania",
"offlineModeWarningMessage": "Włączenie trybu offline anuluje wszystkie aktywne pobierania obszarów. Czy chcesz kontynuować?",
"enableOfflineMode": "Włącz Tryb Offline",
"profiles": "Profile",
"profilesSubtitle": "Zarządzaj profilami węzłów i operatorów",
"offlineSettings": "Ustawienia Offline",
"offlineSettingsSubtitle": "Zarządzaj trybem offline i pobranymi obszarami",
"advancedSettings": "Ustawienia Zaawansowane",
"advancedSettingsSubtitle": "Wydajność, alerty i ustawienia dostawców kafelków",
"proximityAlerts": "Alerty Bliskości",
"networkStatusIndicator": "Wskaźnik Stanu Sieci"
},
"proximityAlerts": {
"getNotified": "Otrzymuj powiadomienia przy zbliżaniu się do urządzeń nadzoru",
"batteryUsage": "Używa dodatkowej baterii do ciągłego monitorowania lokalizacji",
"notificationsEnabled": "✓ Powiadomienia włączone",
"notificationsDisabled": "⚠ Powiadomienia wyłączone",
"permissionRequired": "Wymagane uprawnienie do powiadomień",
"permissionExplanation": "Powiadomienia push są wyłączone. Będziesz widzieć tylko alerty w aplikacji i nie będziesz powiadamiany, gdy aplikacja jest w tle.",
"enableNotifications": "Włącz Powiadomienia",
"checkingPermissions": "Sprawdzanie uprawnień...",
"alertDistance": "Odległość alertu: ",
"rangeInfo": "Zakres: {}-{} {} (domyślnie: {})"
},
"node": {
"title": "Węzeł #{}",
"tagSheetTitle": "Tagi Urządzenia Nadzoru",
"queuedForUpload": "Węzeł umieszczony w kolejce do przesłania",
"editQueuedForUpload": "Edycja węzła umieszczona w kolejce do przesłania",
"deleteQueuedForUpload": "Usuwanie węzła umieszczone w kolejce do przesłania",
"confirmDeleteTitle": "Usuń Węzeł",
"confirmDeleteMessage": "Czy na pewno chcesz usunąć węzeł #{}? Tej akcji nie można cofnąć."
},
"addNode": {
"profile": "Profil",
"selectProfile": "Wybierz profil...",
"profileRequired": "Proszę wybrać profil, aby kontynuować.",
"direction": "Kierunek {}°",
"profileNoDirectionInfo": "Ten profil nie wymaga kierunku.",
"mustBeLoggedIn": "Musisz być zalogowany, aby zgłaszać nowe węzły. Zaloguj się przez Ustawienia.",
"enableSubmittableProfile": "Włącz profil możliwy do zgłoszenia w Ustawieniach, aby zgłaszać nowe węzły.",
"profileViewOnlyWarning": "Ten profil służy tylko do przeglądania mapy. Proszę wybrać profil możliwy do zgłoszenia, aby zgłaszać nowe węzły.",
"loadingAreaData": "Ładowanie danych obszaru... Poczekaj przed zgłoszeniem.",
"refineTags": "Doprecyzuj Tagi"
},
"editNode": {
"title": "Edytuj Węzeł #{}",
"profile": "Profil",
"selectProfile": "Wybierz profil...",
"profileRequired": "Proszę wybrać profil, aby kontynuować.",
"direction": "Kierunek {}°",
"profileNoDirectionInfo": "Ten profil nie wymaga kierunku.",
"temporarilyDisabled": "Edycje zostały tymczasowo wyłączone, gdy rozwiązujemy błąd - przepraszamy - sprawdź wkrótce.",
"mustBeLoggedIn": "Musisz być zalogowany, aby edytować węzły. Zaloguj się przez Ustawienia.",
"sandboxModeWarning": "Nie można przesyłać edycji węzłów produkcyjnych do piaskownicy. Przełącz na tryb Produkcyjny w Ustawieniach, aby edytować węzły.",
"enableSubmittableProfile": "Włącz profil możliwy do zgłoszenia w Ustawieniach, aby edytować węzły.",
"profileViewOnlyWarning": "Ten profil służy tylko do przeglądania mapy. Proszę wybrać profil możliwy do zgłoszenia, aby edytować węzły.",
"loadingAreaData": "Ładowanie danych obszaru... Poczekaj przed zgłoszeniem.",
"cannotMoveConstrainedNode": "Nie można przenieść tej kamery - jest połączona z innym elementem mapy (droga/relacja OSM). Nadal możesz edytować jej tagi i kierunek.",
"zoomInRequiredMessage": "Przybliż do co najmniej poziomu {}, aby dodawać lub edytować węzły nadzoru. Zapewnia to precyzyjne pozycjonowanie dla dokładnego mapowania.",
"extractFromWay": "Wyciągnij węzeł z drogi/relacji",
"extractFromWaySubtitle": "Utwórz nowy węzeł z tymi samymi tagami, pozwalając na przeniesienie do nowej lokalizacji",
"refineTags": "Doprecyzuj Tagi",
"existingTags": "<Istniejące tagi>",
"noChangesDetected": "Nie wykryto zmian - nie ma nic do zgłoszenia",
"noChangesTitle": "Brak Zmian do Zgłoszenia",
"noChangesMessage": "Nie wprowadziłeś żadnych zmian do tego węzła. Aby zgłosić edycję, musisz zmienić lokalizację, profil, kierunki lub tagi."
},
"download": {
"title": "Pobierz Obszar Mapy",
"maxZoomLevel": "Maksymalny poziom przybliżenia",
"storageEstimate": "Oszacowanie pamięci:",
"tilesAndSize": "{} kafelków, {} MB",
"minZoom": "Min przybliżenie:",
"maxRecommendedZoom": "Maksymalne zalecane przybliżenie: Z{}",
"withinTileLimit": "W granicach {} limitu kafelków",
"exceedsTileLimit": "Obecny wybór przekracza {} limit kafelków",
"offlineModeWarning": "Pobieranie wyłączone w trybie offline. Wyłącz tryb offline, aby pobierać nowe obszary.",
"areaTooBigMessage": "Przybliż do co najmniej poziomu {}, aby pobierać obszary offline. Duże pobieranie obszarów może sprawić, że aplikacja przestanie odpowiadać.",
"downloadStarted": "Pobieranie rozpoczęte! Pobieranie kafelków i węzłów...",
"downloadFailed": "Nie udało się rozpocząć pobierania: {}",
"offlineNotPermitted": "Serwer {} nie zezwala na pobieranie offline. Przełącz się na dostawcę kafelków, który obsługuje tryb offline (np. Bing Maps, Mapbox lub samodzielnie hostowany serwer kafelków).",
"currentTileProvider": "bieżący kafelek",
"noTileProviderSelected": "Nie wybrano dostawcy kafelków. Wybierz styl mapy przed pobraniem obszaru offline."
},
"downloadStarted": {
"title": "Pobieranie Rozpoczęte",
"message": "Pobieranie rozpoczęte! Pobieranie kafelków i węzłów...",
"ok": "OK",
"viewProgress": "Zobacz Postęp w Ustawieniach"
},
"uploadMode": {
"title": "Miejsce Docelowe Przesyłania",
"subtitle": "Wybierz gdzie przesyłane są kamery",
"production": "Produkcja",
"sandbox": "Piaskownica",
"simulate": "Symulacja",
"productionDescription": "Prześlij do aktywnej bazy danych OSM (widoczne dla wszystkich użytkowników)",
"sandboxDescription": "Przesłania trafiają do Piaskownicy OSM (bezpieczne do testowania, regularne resetowanie).",
"simulateDescription": "Symuluj przesyłanie (nie kontaktuje się z serwerami OSM)",
"cannotChangeWithQueue": "Nie można zmienić miejsca docelowego przesyłania, gdy {} elementów jest w kolejce. Najpierw wyczyść kolejkę."
},
"auth": {
"osmAccountTitle": "Konto OpenStreetMap",
"osmAccountSubtitle": "Zarządzaj logowaniem OSM i przeglądaj swoje wkłady",
"loggedInAs": "Zalogowany jako {}",
"loginToOSM": "Zaloguj się do OpenStreetMap",
"tapToLogout": "Stuknij aby się wylogować",
"requiredToSubmit": "Wymagane do zgłaszania danych kamer",
"loggedOut": "Wylogowany",
"testConnection": "Testuj Połączenie",
"testConnectionSubtitle": "Sprawdź czy dane logowania OSM działają",
"connectionOK": "Połączenie OK - dane logowania są ważne",
"connectionFailed": "Połączenie nie powiodło się - zaloguj się ponownie",
"viewMyEdits": "Zobacz Moje Edycje w OSM",
"viewMyEditsSubtitle": "Zobacz swoją historię edycji w OpenStreetMap",
"aboutOSM": "O OpenStreetMap",
"aboutOSMDescription": "OpenStreetMap to współpracujący projekt mapowania open-source, gdzie współtwórcy tworzą i utrzymują darmową, edytowalną mapę świata. Twoje wkłady urządzeń nadzoru pomagają uczynić tę infrastrukturę widoczną i możliwą do przeszukiwania.",
"visitOSM": "Odwiedź OpenStreetMap",
"deleteAccount": "Usuń Konto OSM",
"deleteAccountSubtitle": "Zarządzaj swoim kontem OpenStreetMap",
"deleteAccountExplanation": "Aby usunąć swoje konto OpenStreetMap, musisz odwiedzić stronę OpenStreetMap. To trwale usunie twoje konto OSM i wszystkie powiązane dane.",
"deleteAccountWarning": "Ostrzeżenie: Ta akcja nie może być cofnięta i trwale usunie twoje konto OSM.",
"goToOSM": "Przejdź do OpenStreetMap",
"accountManagement": "Zarządzanie Kontem",
"accountManagementDescription": "Aby usunąć swoje konto OpenStreetMap, musisz odwiedzić odpowiednią stronę OpenStreetMap. To trwale usunie twoje konto i wszystkie powiązane dane.",
"currentDestinationProduction": "Obecnie połączony z: Produkcyjny OpenStreetMap",
"currentDestinationSandbox": "Obecnie połączony z: Sandbox OpenStreetMap",
"currentDestinationSimulate": "Obecnie w: Trybie symulacji (brak rzeczywistego konta)",
"viewMessages": "Zobacz Wiadomości w OSM",
"unreadMessagesCount": "Masz {} nieprzeczytanych wiadomości",
"noUnreadMessages": "Brak nieprzeczytanych wiadomości",
"reauthRequired": "Odśwież Uwierzytelnienie",
"reauthExplanation": "Musisz odświeżyć uwierzytelnienie, aby otrzymywać powiadomienia o wiadomościach OSM przez aplikację.",
"reauthBenefit": "To włączy kropki powiadomień, gdy masz nieprzeczytane wiadomości w OpenStreetMap.",
"reauthNow": "Zrób To Teraz",
"reauthLater": "Później"
},
"queue": {
"title": "Kolejka Przesyłania",
"subtitle": "Zarządzaj oczekującymi przesłaniami urządzeń nadzoru",
"pendingUploads": "Oczekujące przesłania: {}",
"pendingItemsCount": "Oczekujące Elementy: {}",
"nothingInQueue": "Nic w kolejce",
"simulateModeEnabled": "Tryb symulacji włączony przesłania symulowane",
"sandboxMode": "Tryb piaskownicy przesłania idą do OSM Sandbox",
"tapToViewQueue": "Stuknij aby zobaczyć kolejkę",
"clearUploadQueue": "Wyczyść Kolejkę Przesyłania",
"removeAllPending": "Usuń wszystkie {} oczekujące przesłania",
"clearQueueTitle": "Wyczyść Kolejkę",
"clearQueueConfirm": "Usunąć wszystkie {} oczekujące przesłania?",
"queueCleared": "Kolejka wyczyszczona",
"uploadQueueTitle": "Kolejka Przesyłania ({} elementów)",
"queueIsEmpty": "Kolejka jest pusta",
"itemWithIndex": "Element {}",
"error": " (Błąd)",
"completing": " (Kończenie...)",
"destination": "Cel: {}",
"latitude": "Szerokość: {}",
"longitude": "Długość: {}",
"direction": "Kierunek: {}°",
"attempts": "Próby: {}",
"uploadFailedRetry": "Przesyłanie nie powiodło się. Stuknij ponownie aby spróbować ponownie.",
"retryUpload": "Spróbuj ponownie przesłać",
"clearAll": "Wyczyść Wszystko",
"errorDetails": "Szczegóły Błędu",
"creatingChangeset": " (Tworzenie zestawu zmian...)",
"uploading": " (Przesyłanie...)",
"closingChangeset": " (Zamykanie zestawu zmian...)",
"processingPaused": "Przetwarzanie Kolejki Wstrzymane",
"pausedDueToOffline": "Przetwarzanie przesyłania jest wstrzymane, ponieważ tryb offline jest włączony.",
"pausedByUser": "Przetwarzanie przesyłania jest ręcznie wstrzymane."
},
"tileProviders": {
"title": "Dostawcy Kafelków",
"noProvidersConfigured": "Brak skonfigurowanych dostawców kafelków",
"tileTypesCount": "{} typów kafelków",
"apiKeyConfigured": "Klucz API skonfigurowany",
"needsApiKey": "Potrzebuje klucz API",
"editProvider": "Edytuj Dostawcę",
"addProvider": "Dodaj Dostawcę",
"deleteProvider": "Usuń Dostawcę",
"deleteProviderConfirm": "Czy na pewno chcesz usunąć \"{}\"?",
"providerName": "Nazwa Dostawcy",
"providerNameHint": "np., Niestandardowe Mapy Sp. z o.o.",
"providerNameRequired": "Nazwa dostawcy jest wymagana",
"apiKey": "Klucz API (Opcjonalnie)",
"apiKeyHint": "Wprowadź klucz API jeśli wymagany przez typy kafelków",
"tileTypes": "Typy Kafelków",
"addType": "Dodaj Typ",
"noTileTypesConfigured": "Brak skonfigurowanych typów kafelków",
"atLeastOneTileTypeRequired": "Przynajmniej jeden typ kafelka jest wymagany",
"manageTileProviders": "Zarządzaj Dostawcami"
},
"tileTypeEditor": {
"editTileType": "Edytuj Typ Kafelka",
"addTileType": "Dodaj Typ Kafelka",
"name": "Nazwa",
"nameHint": "np., Satelita",
"nameRequired": "Nazwa jest wymagana",
"urlTemplate": "Szablon URL",
"urlTemplateHint": "https://example.com/{z}/{x}/{y}.png",
"urlTemplateRequired": "Szablon URL jest wymagany",
"urlTemplatePlaceholders": "URL musi zawierać albo {quadkey} albo {z}, {x} i {y} symbole zastępcze",
"attribution": "Atrybucja",
"attributionHint": "© Dostawca Map",
"attributionRequired": "Atrybucja jest wymagana",
"maxZoom": "Maksymalny Poziom Przybliżenia",
"maxZoomHint": "Maksymalny poziom przybliżenia (1-23)",
"maxZoomRequired": "Maksymalne przybliżenie jest wymagane",
"maxZoomInvalid": "Maksymalne przybliżenie musi być liczbą",
"maxZoomRange": "Maksymalne przybliżenie musi być między {} a {}",
"fetchPreview": "Pobierz Podgląd",
"previewTileLoaded": "Kafelek podglądu załadowany pomyślnie",
"previewTileFailed": "Nie udało się pobrać podglądu: {}",
"save": "Zapisz"
},
"profiles": {
"nodeProfiles": "Profile Węzłów",
"newProfile": "Nowy Profil",
"builtIn": "Wbudowany",
"custom": "Niestandardowy",
"view": "Zobacz",
"deleteProfile": "Usuń Profil",
"deleteProfileConfirm": "Czy na pewno chcesz usunąć \"{}\"?",
"profileDeleted": "Profil usunięty",
"getMore": "Pobierz więcej...",
"addProfileChoice": "Dodaj Profil",
"addProfileChoiceMessage": "Jak chciałbyś dodać profil?",
"createCustomProfile": "Utwórz Niestandardowy Profil",
"createCustomProfileDescription": "Zbuduj profil od zera z własnymi tagami",
"importFromWebsite": "Importuj ze Strony",
"importFromWebsiteDescription": "Przeglądaj i importuj profile z deflock.me/identify"
},
"mapTiles": {
"title": "Kafelki Mapy",
"manageProviders": "Zarządzaj Dostawcami",
"attribution": "Atrybucja Mapy",
"mapAttribution": "Źródło mapy: {}",
"couldNotOpenLink": "Nie udało się otworzyć linku",
"openLicense": "Otwórz licencję: {}"
},
"profileEditor": {
"viewProfile": "Zobacz Profil",
"newProfile": "Nowy Profil",
"editProfile": "Edytuj Profil",
"profileName": "Nazwa profilu",
"profileNameHint": "np., Niestandardowa Kamera ALPR",
"profileNameRequired": "Nazwa profilu jest wymagana",
"requiresDirection": "Wymaga Kierunku",
"requiresDirectionSubtitle": "Czy kamery tego typu potrzebują tagu kierunku",
"fov": "Pole Widzenia",
"fovHint": "FOV w stopniach (zostaw puste dla domyślnego)",
"fovSubtitle": "Pole widzenia kamery - używane dla szerokości stożka i formatu zgłaszania zasięgu",
"fovInvalid": "FOV musi być między 1 a 360 stopniami",
"submittable": "Możliwy do Zgłoszenia",
"submittableSubtitle": "Czy ten profil może być używany do zgłoszeń kamer",
"osmTags": "Tagi OSM",
"addTag": "Dodaj tag",
"saveProfile": "Zapisz Profil",
"keyHint": "klucz",
"valueHint": "wartość",
"atLeastOneTagRequired": "Przynajmniej jeden tag jest wymagany",
"profileSaved": "Profil \"{}\" zapisany"
},
"operatorProfileEditor": {
"newOperatorProfile": "Nowy Profil Operatora",
"editOperatorProfile": "Edytuj Profil Operatora",
"operatorName": "Nazwa operatora",
"operatorNameHint": "np., Policja Warszawska",
"operatorNameRequired": "Nazwa operatora jest wymagana",
"operatorProfileSaved": "Profil operatora \"{}\" zapisany"
},
"operatorProfiles": {
"title": "Profile Operatorów",
"noProfilesMessage": "Brak zdefiniowanych profili operatorów. Utwórz jeden, aby zastosować tagi operatorów do zgłoszeń węzłów.",
"tagsCount": "{} tagów",
"deleteOperatorProfile": "Usuń Profil Operatora",
"deleteOperatorProfileConfirm": "Czy na pewno chcesz usunąć \"{}\"?",
"operatorProfileDeleted": "Profil operatora usunięty"
},
"offlineAreas": {
"title": "Obszary Offline",
"noAreasTitle": "Brak obszarów offline",
"noAreasSubtitle": "Pobierz obszar mapy do użytku offline.",
"provider": "Dostawca",
"maxZoom": "Maksymalne przybliżenie",
"zoomLevels": "Z{}-{}",
"latitude": "Szerokość",
"longitude": "Długość",
"tiles": "Kafelki",
"size": "Rozmiar",
"nodes": "Węzły",
"areaIdFallback": "Obszar {}...",
"renameArea": "Zmień nazwę obszaru",
"refreshWorldTiles": "Odśwież/pobierz ponownie kafelki światowe",
"deleteOfflineArea": "Usuń obszar offline",
"cancelDownload": "Anuluj pobieranie",
"renameAreaDialogTitle": "Zmień Nazwę Obszaru Offline",
"areaNameLabel": "Nazwa Obszaru",
"renameButton": "Zmień Nazwę",
"megabytes": "MB",
"kilobytes": "KB",
"progress": "{}%",
"refreshArea": "Odśwież obszar",
"refreshAreaDialogTitle": "Odśwież Obszar Offline",
"refreshAreaDialogSubtitle": "Wybierz co odświeżyć dla tego obszaru:",
"refreshTiles": "Odśwież Kafelki Mapy",
"refreshTilesSubtitle": "Pobierz ponownie wszystkie kafelki dla zaktualizowanych obrazów",
"refreshNodes": "Odśwież Węzły",
"refreshNodesSubtitle": "Pobierz ponownie dane węzłów dla tego obszaru",
"startRefresh": "Rozpocznij Odświeżanie",
"refreshStarted": "Odświeżanie rozpoczęte!",
"refreshFailed": "Odświeżanie nie powiodło się: {}"
},
"refineTagsSheet": {
"title": "Doprecyzuj Tagi",
"operatorProfile": "Profil Operatora",
"done": "Gotowe",
"none": "Brak",
"noAdditionalOperatorTags": "Brak dodatkowych tagów operatora",
"additionalTags": "dodatkowe tagi",
"additionalTagsTitle": "Dodatkowe Tagi",
"noTagsDefinedForProfile": "Brak tagów zdefiniowanych dla tego profilu operatora.",
"noOperatorProfiles": "Brak zdefiniowanych profili operatorów",
"noOperatorProfilesMessage": "Utwórz profile operatorów w Ustawieniach, aby zastosować dodatkowe tagi do swoich zgłoszeń węzłów.",
"profileTags": "Tagi Profilu",
"profileTagsDescription": "Wypełnij te opcjonalne wartości tagów dla bardziej szczegółowych zgłoszeń:",
"selectValue": "Wybierz wartość...",
"noValue": "(zostaw puste)",
"noSuggestions": "Brak dostępnych sugestii",
"existingTagsTitle": "Istniejące Tagi",
"existingTagsDescription": "Edytuj istniejące tagi na tym urządzeniu. Dodaj, usuń lub zmodyfikuj dowolny tag:",
"existingOperator": "<Istniejący operator>",
"existingOperatorTags": "istniejące tagi operatora"
},
"layerSelector": {
"cannotChangeTileTypes": "Nie można zmieniać typów kafelków podczas pobierania obszarów offline",
"selectMapLayer": "Wybierz Warstwę Mapy",
"noTileProvidersAvailable": "Brak dostępnych dostawców kafelków"
},
"advancedEdit": {
"title": "Zaawansowane Opcje Edycji",
"subtitle": "Te edytory oferują bardziej zaawansowane funkcje dla złożonych edycji.",
"webEditors": "Edytory Webowe",
"mobileEditors": "Edytory Mobilne",
"iDEditor": "Edytor iD",
"iDEditorSubtitle": "W pełni funkcjonalny edytor webowy - zawsze działa",
"rapidEditor": "Edytor RapiD",
"rapidEditorSubtitle": "Edycja wspomagana AI z danymi Facebook",
"vespucci": "Vespucci",
"vespucciSubtitle": "Zaawansowany edytor OSM dla Androida",
"streetComplete": "StreetComplete",
"streetCompleteSubtitle": "Aplikacja do mapowania oparta na ankietach",
"everyDoor": "EveryDoor",
"everyDoorSubtitle": "Szybka edycja POI",
"goMap": "Go Map!!",
"goMapSubtitle": "Edytor OSM dla iOS",
"couldNotOpenEditor": "Nie można otworzyć edytora - aplikacja może nie być zainstalowana",
"couldNotOpenURL": "Nie można otworzyć URL",
"couldNotOpenOSMWebsite": "Nie można otworzyć strony OSM"
},
"networkStatus": {
"showIndicator": "Pokaż wskaźnik stanu sieci",
"showIndicatorSubtitle": "Wyświetl status ładowania danych nadzoru i błędów",
"loading": "Ładowanie danych nadzoru...",
"timedOut": "Żądanie przekroczyło limit czasu",
"noData": "Brak danych offline",
"success": "Dane nadzoru załadowane",
"nodeDataSlow": "Dane nadzoru powolne",
"rateLimited": "Ograniczone przez serwer",
"networkError": "Błąd sieci"
},
"nodeLimitIndicator": {
"message": "Pokazuje {rendered} z {total} urządzeń",
"editingDisabledMessage": "Pokazano zbyt wiele urządzeń, aby bezpiecznie edytować. Przybliż dalej, aby zmniejszyć liczbę widocznych urządzeń, następnie spróbuj ponownie."
},
"navigation": {
"searchLocation": "Szukaj Lokalizacji",
"searchPlaceholder": "Szukaj miejsc lub współrzędnych...",
"routeTo": "Trasa Do",
"routeFrom": "Trasa Od",
"selectLocation": "Wybierz Lokalizację",
"calculatingRoute": "Obliczanie trasy...",
"routeCalculationFailed": "Obliczanie trasy nie powiodło się",
"start": "Start",
"resume": "Wznów",
"endRoute": "Zakończ Trasę",
"routeOverview": "Przegląd Trasy",
"retry": "Spróbuj Ponownie",
"cancelSearch": "Anuluj wyszukiwanie",
"noResultsFound": "Nie znaleziono wyników",
"searching": "Wyszukiwanie...",
"location": "Lokalizacja",
"startPoint": "Start",
"endPoint": "Koniec",
"startSelect": "Start (wybierz)",
"endSelect": "Koniec (wybierz)",
"distance": "Odległość: {} km",
"routeActive": "Trasa aktywna",
"locationsTooClose": "Lokalizacje startu i mety są zbyt blisko siebie",
"navigationSettings": "Nawigacja",
"navigationSettingsSubtitle": "Planowanie tras i ustawienia unikania",
"avoidanceDistance": "Odległość Unikania",
"avoidanceDistanceSubtitle": "Minimalna odległość do utrzymania od urządzeń nadzoru",
"searchHistory": "Maksymalna Historia Wyszukiwania",
"searchHistorySubtitle": "Maksymalna liczba ostatnich wyszukiwań do zapamiętania"
},
"suspectedLocations": {
"title": "Podejrzane Lokalizacje",
"showSuspectedLocations": "Pokaż Podejrzane Lokalizacje",
"showSuspectedLocationsSubtitle": "Pokaż znaczniki znaku zapytania dla podejrzanych miejsc nadzoru z danych pozwoleń użyteczności publicznej",
"lastUpdated": "Ostatnio Zaktualizowane",
"refreshNow": "Odśwież teraz",
"dataSource": "Źródło Danych",
"dataSourceDescription": "Dane pozwoleń użyteczności publicznej wskazujące potencjalne miejsca instalacji infrastruktury nadzoru",
"dataSourceCredit": "Zbieranie danych i hosting zapewnione przez alprwatch.org",
"minimumDistance": "Minimalna Odległość od Rzeczywistych Węzłów",
"minimumDistanceSubtitle": "Ukryj podejrzane lokalizacje w promieniu {}m od istniejących urządzeń nadzoru",
"updating": "Aktualizowanie Podejrzanych Lokalizacji",
"downloadingAndProcessing": "Pobieranie i przetwarzanie danych...",
"updateSuccess": "Podejrzane lokalizacje zaktualizowane pomyślnie",
"updateFailed": "Nie udało się zaktualizować podejrzanych lokalizacji",
"neverFetched": "Nigdy nie pobrano",
"daysAgo": "{} dni temu",
"hoursAgo": "{} godzin temu",
"minutesAgo": "{} minut temu",
"justNow": "Właśnie teraz"
},
"suspectedLocation": {
"title": "Podejrzana Lokalizacja #{}",
"ticketNo": "Nr Biletu",
"address": "Adres",
"street": "Ulica",
"city": "Miasto",
"state": "Województwo",
"intersectingStreet": "Przecinająca Ulica",
"workDoneFor": "Praca Wykonana Dla",
"remarks": "Uwagi",
"url": "URL",
"coordinates": "Współrzędne",
"noAddressAvailable": "Brak dostępnego adresu"
},
"units": {
"meters": "m",
"feet": "ft",
"kilometers": "km",
"miles": "mila",
"metersLong": "metry",
"feetLong": "stopy",
"kilometersLong": "kilometry",
"milesLong": "mile",
"metric": "Metryczny",
"imperial": "Imperialny",
"metricDescription": "Metryczny (km, m)",
"imperialDescription": "Imperialny (mila, ft)"
}
}

View File

@@ -89,7 +89,11 @@
"aboutInfo": "Sobre / Informações",
"aboutThisApp": "Sobre este App",
"aboutSubtitle": "Informações do aplicativo e créditos",
"languageSubtitle": "Escolha seu idioma preferido",
"languageSubtitle": "Escolha seu idioma preferido e unidades",
"distanceUnit": "Unidades de Distância",
"distanceUnitSubtitle": "Escolha entre unidades métricas (km/m) ou imperiais (mi/ft)",
"metricUnits": "Métrico (km, m)",
"imperialUnits": "Imperial (mi, ft)",
"maxNodes": "Máx. de nós desenhados",
"maxNodesSubtitle": "Definir um limite superior para o número de nós no mapa.",
"maxNodesWarning": "Você provavelmente não quer fazer isso a menos que tenha certeza absoluta de que tem uma boa razão para isso.",
@@ -119,8 +123,7 @@
"enableNotifications": "Habilitar Notificações",
"checkingPermissions": "Verificando permissões...",
"alertDistance": "Distância de alerta: ",
"meters": "metros",
"rangeInfo": "Faixa: {}-{} metros (padrão: {})"
"rangeInfo": "Faixa: {}-{} {} (padrão: {})"
},
"node": {
"title": "Nó #{}",
@@ -140,8 +143,8 @@
"mustBeLoggedIn": "Você deve estar logado para enviar novos nós. Por favor, faça login via Configurações.",
"enableSubmittableProfile": "Ative um perfil enviável nas Configurações para enviar novos nós.",
"profileViewOnlyWarning": "Este perfil é apenas para visualização do mapa. Por favor, selecione um perfil enviável para enviar novos nós.",
"refineTags": "Refinar Tags",
"refineTagsWithProfile": "Refinar Tags ({})"
"loadingAreaData": "Carregando dados da área... Por favor aguarde antes de enviar.",
"refineTags": "Refinar Tags"
},
"editNode": {
"title": "Editar Nó #{}",
@@ -155,12 +158,16 @@
"sandboxModeWarning": "Não é possível enviar edições de nós de produção para o sandbox. Mude para o modo Produção nas Configurações para editar nós.",
"enableSubmittableProfile": "Ative um perfil enviável nas Configurações para editar nós.",
"profileViewOnlyWarning": "Este perfil é apenas para visualização do mapa. Por favor, selecione um perfil enviável para editar nós.",
"loadingAreaData": "Carregando dados da área... Por favor aguarde antes de enviar.",
"cannotMoveConstrainedNode": "Não é possível mover esta câmera - ela está conectada a outro elemento do mapa (OSM way/relation). Você ainda pode editar suas tags e direção.",
"zoomInRequiredMessage": "Amplie para pelo menos o nível {} para adicionar ou editar nós de vigilância. Isto garante um posicionamento preciso para mapeamento exato.",
"extractFromWay": "Extrair nó do way/relation",
"extractFromWaySubtitle": "Criar novo nó com as mesmas tags, permitir mover para nova localização",
"refineTags": "Refinar Tags",
"refineTagsWithProfile": "Refinar Tags ({})"
"existingTags": "<Tags existentes>",
"noChangesDetected": "Nenhuma alteração detectada - nada para enviar",
"noChangesTitle": "Nenhuma Alteração para Enviar",
"noChangesMessage": "Você não fez nenhuma alteração neste nó. Para enviar uma edição, você precisa alterar a localização, o perfil, as direções ou as tags."
},
"download": {
"title": "Baixar Área do Mapa",
@@ -174,7 +181,10 @@
"offlineModeWarning": "Downloads desabilitados no modo offline. Desative o modo offline para baixar novas áreas.",
"areaTooBigMessage": "Amplie para pelo menos o nível {} para baixar áreas offline. Downloads de áreas grandes podem tornar o aplicativo não responsivo.",
"downloadStarted": "Download iniciado! Buscando tiles e nós...",
"downloadFailed": "Falha ao iniciar o download: {}"
"downloadFailed": "Falha ao iniciar o download: {}",
"offlineNotPermitted": "O servidor {} não permite downloads offline. Mude para um provedor de tiles que permita uso offline (por ex., Bing Maps, Mapbox ou um servidor de tiles próprio).",
"currentTileProvider": "tile atual",
"noTileProviderSelected": "Nenhum provedor de tiles selecionado. Selecione um estilo de mapa antes de baixar uma área offline."
},
"downloadStarted": {
"title": "Download Iniciado",
@@ -316,12 +326,22 @@
"view": "Ver",
"deleteProfile": "Excluir Perfil",
"deleteProfileConfirm": "Tem certeza de que deseja excluir \"{}\"?",
"profileDeleted": "Perfil excluído"
"profileDeleted": "Perfil excluído",
"getMore": "Obter mais...",
"addProfileChoice": "Adicionar Perfil",
"addProfileChoiceMessage": "Como gostaria de adicionar um perfil?",
"createCustomProfile": "Criar Perfil Personalizado",
"createCustomProfileDescription": "Construir um perfil do zero com suas próprias tags",
"importFromWebsite": "Importar do Site",
"importFromWebsiteDescription": "Navegar e importar perfis do deflock.me/identify"
},
"mapTiles": {
"title": "Tiles do Mapa",
"manageProviders": "Gerenciar Provedores",
"attribution": "Atribuição do Mapa"
"attribution": "Atribuição do Mapa",
"mapAttribution": "Atribuição do mapa: {}",
"couldNotOpenLink": "Não foi possível abrir o link",
"openLicense": "Abrir licença: {}"
},
"profileEditor": {
"viewProfile": "Ver Perfil",
@@ -348,7 +368,7 @@
},
"operatorProfileEditor": {
"newOperatorProfile": "Novo Perfil de Operador",
"editOperatorProfile": "Editar Perfil de Operador",
"editOperatorProfile": "Editar Perfil de Operador",
"operatorName": "Nome do operador",
"operatorNameHint": "ex., Departamento de Polícia de Austin",
"operatorNameRequired": "Nome do operador é obrigatório",
@@ -411,7 +431,11 @@
"profileTagsDescription": "Especifique valores para tags que precisam de refinamento:",
"selectValue": "Selecionar um valor...",
"noValue": "(Sem valor)",
"noSuggestions": "Nenhuma sugestão disponível"
"noSuggestions": "Nenhuma sugestão disponível",
"existingTagsTitle": "Tags Existentes",
"existingTagsDescription": "Edite as tags existentes neste dispositivo. Adicione, remova ou modifique qualquer tag:",
"existingOperator": "<Operador existente>",
"existingOperatorTags": "tags de operador existentes"
},
"layerSelector": {
"cannotChangeTileTypes": "Não é possível alterar tipos de tiles durante o download de áreas offline",
@@ -446,7 +470,9 @@
"timedOut": "Solicitação expirada",
"noData": "Nenhum dado offline",
"success": "Dados de vigilância carregados",
"nodeDataSlow": "Dados de vigilância lentos"
"nodeDataSlow": "Dados de vigilância lentos",
"rateLimited": "Limitado pelo servidor",
"networkError": "Erro de rede"
},
"nodeLimitIndicator": {
"message": "Mostrando {rendered} de {total} dispositivos",
@@ -481,13 +507,7 @@
"avoidanceDistance": "Distância de evasão",
"avoidanceDistanceSubtitle": "Distância mínima para ficar longe de dispositivos de vigilância",
"searchHistory": "Histórico máximo de busca",
"searchHistorySubtitle": "Número máximo de buscas recentes para lembrar",
"units": "Unidades",
"unitsSubtitle": "Unidades de exibição para distâncias e medidas",
"metric": "Métrico (km, m)",
"imperial": "Imperial (mi, ft)",
"meters": "metros",
"feet": "pés"
"searchHistorySubtitle": "Número máximo de buscas recentes para lembrar"
},
"suspectedLocations": {
"title": "Localizações Suspeitas",
@@ -506,7 +526,7 @@
"updateFailed": "Falha ao atualizar localizações suspeitas",
"neverFetched": "Nunca buscado",
"daysAgo": "{} dias atrás",
"hoursAgo": "{} horas atrás",
"hoursAgo": "{} horas atrás",
"minutesAgo": "{} minutos atrás",
"justNow": "Agora mesmo"
},
@@ -514,7 +534,7 @@
"title": "Localização Suspeita #{}",
"ticketNo": "N° do Ticket",
"address": "Endereço",
"street": "Rua",
"street": "Rua",
"city": "Cidade",
"state": "Estado",
"intersectingStreet": "Rua que Cruza",
@@ -523,5 +543,19 @@
"url": "URL",
"coordinates": "Coordenadas",
"noAddressAvailable": "Nenhum endereço disponível"
},
"units": {
"meters": "m",
"feet": "ft",
"kilometers": "km",
"miles": "mi",
"metersLong": "metros",
"feetLong": "pés",
"kilometersLong": "quilômetros",
"milesLong": "milhas",
"metric": "Métrico",
"imperial": "Imperial",
"metricDescription": "Métrico (km, m)",
"imperialDescription": "Imperial (mi, ft)"
}
}
}

561
lib/localizations/tr.json Normal file
View File

@@ -0,0 +1,561 @@
{
"language": {
"name": "Türkçe"
},
"app": {
"title": "DeFlock"
},
"about": {
"title": "DeFlock - Gözetleme Şeffaflığı",
"description": "DeFlock, OpenStreetMap kullanarak kamusal gözetleme altyapısını haritalamak için tasarlanmış gizlilik odaklı bir mobil uygulamadır. Topluluğunuzdaki kameraları, ALPR'leri, silah sesi dedektörlerini ve diğer gözetleme cihazlarını belgeleyerek bu altyapıyı görünür ve aranabilir hale getirin.",
"features": "• İndirilebilir alanlarla çevrimdışı haritalama\n• OAuth2 ile doğrudan OpenStreetMap'e yükleme\n• Büyük üreticiler için yerleşik profiller\n• Gizlilik dostu - kullanıcı verisi toplanmaz\n• Çoklu harita döşemeleri (OSM, uydu görüntüleri)",
"initiative": "Gözetleme şeffaflığını destekleyen daha geniş DeFlock girişiminin parçasıdır.",
"footer": "Ziyaret edin: deflock.me\nFlutter ile yapıldı • Açık Kaynak",
"showWelcome": "Hoş Geldin Mesajını Göster",
"showSubmissionGuide": "Gönderim Rehberini Göster",
"viewReleaseNotes": "Sürüm Notlarını Görüntüle"
},
"welcome": {
"title": "DeFlock'a Hoş Geldiniz",
"description": "DeFlock, kamusal gözetleme araçlarının şeffaf olması gerektiği fikri üzerine kurulmuştur. Bu mobil uygulama içerisinde, web sitesinde olduğu gibi, yerel bölgenizdeki ve yurtdışındaki ALPR'lerin ve diğer gözetleme altyapılarının konumlarını görebileceksiniz.",
"mission": "Ancak bu proje otomatik değil; bu projeyi daha iyi hale getirmek hepimize bağlı. Haritayı görüntülerken, daha önce bilinmeyen bir kurulumu eklemek için \"Yeni Düğüm\"e dokunabilirsiniz. Yardımınızla, gözetleme altyapısının şeffaflığını ve kamusal farkındalığını artırma hedefimize ulaşabiliriz.",
"firsthandKnowledge": "ÖNEMLİ: Sadece kişisel olarak gözlemlediğiniz gözetleme cihazlarını ekleyin. OpenStreetMap ve Google politikaları, Street View görüntüleri gibi kaynaklarının gönderimler için kullanılmasını yasaklar. Katkılarınız kendi doğrudan gözlemlerinize dayanmalıdır.",
"privacy": "Gizlilik Notu: Bu uygulama tamamen cihazınızda yerel olarak çalışır ve veri depolama ve gönderimler için üçüncü taraf OpenStreetMap API'sini kullanır. DeFlock herhangi bir kullanıcı verisini toplamaz veya saklamaz ve hesap yönetiminden sorumlu değildir.",
"tileNote": "NOT: OpenStreetMap'den ücretsiz harita döşemeleri yüklenmesi çok yavaş olabilir. Alternatif döşeme sağlayıcıları Ayarlar > Gelişmiş'te yapılandırılabilir.",
"moreInfo": "Daha fazla bağlantıyı Ayarlar > Hakkında'da bulabilirsiniz.",
"dontShowAgain": "Bu hoş geldin mesajını bir daha gösterme",
"getStarted": "Hadi DeFlocking'e Başlayalım!"
},
"submissionGuide": {
"title": "Gönderim En İyi Uygulamaları",
"description": "İlk gözetleme cihazınızı göndermeden önce, OpenStreetMap'e yüksek kaliteli katkılar sağlamak için bu önemli yönergeleri gözden geçirin.",
"bestPractices": "• Sadece kişisel olarak gözlemlediğiniz cihazları haritalayın\n• Cihaz tipini ve üreticisini doğru şekilde belirlemeye zaman ayırın\n• Hassas konumlandırma kullanın - işaretçiyi yerleştirmeden önce yakınlaştırın\n• Uygun olduğunda yön bilgisini dahil edin\n• Göndermeden önce etiket seçimlerinizi iki kez kontrol edin",
"placementNote": "Unutmayın: Doğru, ilk elden veriler DeFlock topluluğu ve OpenStreetMap projesi için temeldir.",
"moreInfo": "Cihaz tanımlama ve haritalama en iyi uygulamaları için ayrıntılı rehberlik:",
"identificationGuide": "Tanımlama Rehberi",
"osmWiki": "OpenStreetMap Wiki",
"dontShowAgain": "Bu rehberi bir daha gösterme",
"gotIt": "Anladım!"
},
"positioningTutorial": {
"title": "Konumunuzu Hassaslaştırın",
"instructions": "Cihaz işaretçisini gözetleme cihazının konumu üzerine tam olarak yerleştirmek için haritayı sürükleyin.",
"hint": "Konumlandırmadan önce daha iyi doğruluk için yakınlaştırabilirsiniz."
},
"actions": {
"tagNode": "Yeni Düğüm",
"download": "İndir",
"settings": "Ayarlar",
"edit": "Düzenle",
"delete": "Sil",
"cancel": "İptal",
"ok": "Tamam",
"close": "Kapat",
"submit": "Gönder",
"logIn": "Giriş Yap",
"saveEdit": "Düzenlemeyi Kaydet",
"clear": "Temizle",
"viewOnOSM": "OSM'de Görüntüle",
"advanced": "Gelişmiş",
"useAdvancedEditor": "Gelişmiş Düzenleyiciyi Kullan"
},
"proximityWarning": {
"title": "Düğüm Mevcut Cihaza Çok Yakın",
"message": "Bu düğüm mevcut bir gözetleme cihazından sadece {} metre uzakta.",
"suggestion": "Aynı direk üzerinde birden fazla cihaz varsa, ayrı düğümler oluşturmak yerine lütfen tek bir düğümde birden fazla yön kullanın.",
"nearbyNodes": "Yakındaki cihaz(lar) bulundu ({}):",
"nodeInfo": "Düğüm #{} - {}",
"andMore": "...ve {} tane daha",
"goBack": "Geri Dön",
"submitAnyway": "Yine de Gönder",
"nodeType": {
"alpr": "ALPR/ANPR Kamerası",
"publicCamera": "Kamusal Güvenlik Kamerası",
"camera": "Güvenlik Kamerası",
"amenity": "{}",
"device": "{} Cihazı",
"unknown": "Bilinmeyen Cihaz"
}
},
"followMe": {
"off": "Takip etmeyi etkinleştir",
"follow": "Takip etmeyi etkinleştir (dönen)",
"rotating": "Takip etmeyi devre dışı bırak"
},
"settings": {
"title": "Ayarlar",
"language": "Dil ve Bölge",
"systemDefault": "Sistem Varsayılanı",
"aboutInfo": "Hakkında / Bilgi",
"aboutThisApp": "Bu Uygulama Hakkında",
"aboutSubtitle": "Uygulama bilgileri ve krediler",
"languageSubtitle": "Tercih ettiğiniz dili ve birimleri seçin",
"distanceUnit": "Mesafe Birimleri",
"distanceUnitSubtitle": "Metrik (km/m) veya imperial (mil/ft) birimler arasında seçim yapın",
"metricUnits": "Metrik (km, m)",
"imperialUnits": "İmperial (mil, ft)",
"maxNodes": "Çizilen maksimum düğüm",
"maxNodesSubtitle": "Haritadaki düğüm sayısı için üst limit belirleyin.",
"maxNodesWarning": "Bunu yapmak için kesinlikle iyi bir nedeniniz olduğundan emin değilseniz, bunu yapmak istemezsiniz.",
"offlineMode": "Çevrimdışı Mod",
"offlineModeSubtitle": "Yerel/çevrimdışı alanlar dışındaki tüm ağ isteklerini devre dışı bırak.",
"pauseQueueProcessing": "Yükleme Kuyruğunu Duraklat",
"pauseQueueProcessingSubtitle": "Canlı veri erişimini korurken sıraya alınan değişiklikleri yüklemeyi durdur.",
"offlineModeWarningTitle": "Aktif İndirmeler",
"offlineModeWarningMessage": "Çevrimdışı modu etkinleştirmek aktif alan indirmelerini iptal edecektir. Devam etmek istiyor musunuz?",
"enableOfflineMode": "Çevrimdışı Modu Etkinleştir",
"profiles": "Profiller",
"profilesSubtitle": "Düğüm ve operatör profillerini yönet",
"offlineSettings": "Çevrimdışı Ayarlar",
"offlineSettingsSubtitle": "Çevrimdışı mod ve indirilen alanları yönet",
"advancedSettings": "Gelişmiş Ayarlar",
"advancedSettingsSubtitle": "Performans, uyarılar ve döşeme sağlayıcı ayarları",
"proximityAlerts": "Yakınlık Uyarıları",
"networkStatusIndicator": "Ağ Durumu Göstergesi"
},
"proximityAlerts": {
"getNotified": "Gözetleme cihazlarına yaklaşırken bildirim al",
"batteryUsage": "Sürekli konum izleme için ekstra batarya kullanır",
"notificationsEnabled": "✓ Bildirimler etkinleştirildi",
"notificationsDisabled": "⚠ Bildirimler devre dışı",
"permissionRequired": "Bildirim izni gerekli",
"permissionExplanation": "Push bildirimleri devre dışı. Sadece uygulama içi uyarıları göreceksiniz ve uygulama arka plandayken bilgilendirilmeyeceksiniz.",
"enableNotifications": "Bildirimleri Etkinleştir",
"checkingPermissions": "İzinler kontrol ediliyor...",
"alertDistance": "Uyarı mesafesi: ",
"rangeInfo": "Aralık: {}-{} {} (varsayılan: {})"
},
"node": {
"title": "Düğüm #{}",
"tagSheetTitle": "Gözetleme Cihazı Etiketleri",
"queuedForUpload": "Düğüm yükleme için sıraya alındı",
"editQueuedForUpload": "Düğüm düzenlemesi yükleme için sıraya alındı",
"deleteQueuedForUpload": "Düğüm silme işlemi yükleme için sıraya alındı",
"confirmDeleteTitle": "Düğümü Sil",
"confirmDeleteMessage": "#{} düğümünü silmek istediğinizden emin misiniz? Bu işlem geri alınamaz."
},
"addNode": {
"profile": "Profil",
"selectProfile": "Bir profil seçin...",
"profileRequired": "Devam etmek için lütfen bir profil seçin.",
"direction": "Yön {}°",
"profileNoDirectionInfo": "Bu profil bir yön gerektirmez.",
"mustBeLoggedIn": "Yeni düğümler göndermek için giriş yapmalısınız. Lütfen Ayarlar üzerinden giriş yapın.",
"enableSubmittableProfile": "Yeni düğümler göndermek için Ayarlarda gönderilebilir bir profili etkinleştirin.",
"profileViewOnlyWarning": "Bu profil sadece harita görüntüleme içindir. Yeni düğümler göndermek için lütfen gönderilebilir bir profil seçin.",
"loadingAreaData": "Alan verisi yükleniyor... Göndermeden önce lütfen bekleyin.",
"refineTags": "Etiketleri Düzenle"
},
"editNode": {
"title": "Düğümü Düzenle #{}",
"profile": "Profil",
"selectProfile": "Bir profil seçin...",
"profileRequired": "Devam etmek için lütfen bir profil seçin.",
"direction": "Yön {}°",
"profileNoDirectionInfo": "Bu profil bir yön gerektirmez.",
"temporarilyDisabled": "Bir hatayı çözmemiz sırasında düzenlemeler geçici olarak devre dışı bırakıldı - özür dileriz - yakında tekrar kontrol edin.",
"mustBeLoggedIn": "Düğümleri düzenlemek için giriş yapmalısınız. Lütfen Ayarlar üzerinden giriş yapın.",
"sandboxModeWarning": "Üretim düğümlerinde düzenlemeleri sandbox'a gönderemezsiniz. Düğümleri düzenlemek için Ayarlar'da Üretim moduna geçin.",
"enableSubmittableProfile": "Düğümleri düzenlemek için Ayarlarda gönderilebilir bir profili etkinleştirin.",
"profileViewOnlyWarning": "Bu profil sadece harita görüntüleme içindir. Düğümleri düzenlemek için lütfen gönderilebilir bir profil seçin.",
"loadingAreaData": "Alan verisi yükleniyor... Göndermeden önce lütfen bekleyin.",
"cannotMoveConstrainedNode": "Bu kamerayı taşıyamazsınız - başka bir harita öğesine (OSM yolu/ilişkisi) bağlı. Yine de etiketlerini ve yönünü düzenleyebilirsiniz.",
"zoomInRequiredMessage": "Gözetleme düğümleri eklemek veya düzenlemek için en az {} seviyesine yakınlaştırın. Bu doğru haritalama için hassas konumlandırmayı sağlar.",
"extractFromWay": "Düğümü yol/ilişkiden çıkar",
"extractFromWaySubtitle": "Aynı etiketlerle yeni düğüm oluştur, yeni konuma taşımaya izin ver",
"refineTags": "Etiketleri Düzenle",
"existingTags": "<Mevcut etiketler>",
"noChangesDetected": "Değişiklik tespit edilmedi - gönderilecek bir şey yok",
"noChangesTitle": "Gönderilecek Değişiklik Yok",
"noChangesMessage": "Bu düğümde herhangi bir değişiklik yapmadınız. Düzenleme göndermek için konumu, profili, yönleri veya etiketleri değiştirmeniz gerekir."
},
"download": {
"title": "Harita Alanını İndir",
"maxZoomLevel": "Maksimum yakınlaştırma seviyesi",
"storageEstimate": "Depolama tahmini:",
"tilesAndSize": "{} döşeme, {} MB",
"minZoom": "Min yakınlaştırma:",
"maxRecommendedZoom": "Maksimum önerilen yakınlaştırma: Z{}",
"withinTileLimit": "{} döşeme sınırı içinde",
"exceedsTileLimit": "Mevcut seçim {} döşeme sınırınııyor",
"offlineModeWarning": "Çevrimdışı moddayken indirmeler devre dışı. Yeni alanları indirmek için çevrimdışı modu devre dışı bırakın.",
"areaTooBigMessage": "Çevrimdışı alanları indirmek için en az {} seviyesine yakınlaştırın. Büyük alan indirmeleri uygulamanın yanıt vermemesine neden olabilir.",
"downloadStarted": "İndirme başladı! Döşemeler ve düğümler getiriliyor...",
"downloadFailed": "İndirme başlatılamadı: {}",
"offlineNotPermitted": "{} sunucusu çevrimdışı indirmelere izin vermiyor. Çevrimdışı kullanıma izin veren bir döşeme sağlayıcısına geçin (ör. Bing Maps, Mapbox veya kendi barındırdığınız bir döşeme sunucusu).",
"currentTileProvider": "mevcut döşeme",
"noTileProviderSelected": "Döşeme sağlayıcı seçilmedi. Çevrimdışı alan indirmeden önce lütfen bir harita stili seçin."
},
"downloadStarted": {
"title": "İndirme Başladı",
"message": "İndirme başladı! Döşemeler ve düğümler getiriliyor...",
"ok": "Tamam",
"viewProgress": "Ayarlarda İlerlemeyi Görüntüle"
},
"uploadMode": {
"title": "Yükleme Hedefi",
"subtitle": "Kameraların nereye yüklendiğini seçin",
"production": "Üretim",
"sandbox": "Sandbox",
"simulate": "Simülasyon",
"productionDescription": "Canlı OSM veritabanına yükle (tüm kullanıcılara görünür)",
"sandboxDescription": "Yüklemeler OSM Sandbox'ına gider (test için güvenli, düzenli olarak sıfırlanır).",
"simulateDescription": "Yüklemeleri simüle et (OSM sunucularıyla iletişim kurmaz)",
"cannotChangeWithQueue": "Sırada {} öğe varken yükleme hedefi değiştirilemez. Önce sırayı temizleyin."
},
"auth": {
"osmAccountTitle": "OpenStreetMap Hesabı",
"osmAccountSubtitle": "OSM girişinizi yönetin ve katkılarınızı görüntüleyin",
"loggedInAs": "{} olarak giriş yapıldı",
"loginToOSM": "OpenStreetMap'e giriş yap",
"tapToLogout": ıkış yapmak için dokun",
"requiredToSubmit": "Kamera verisi göndermek için gerekli",
"loggedOut": ıkış yapıldı",
"testConnection": "Bağlantıyı Test Et",
"testConnectionSubtitle": "OSM kimlik bilgilerinin çalışıp çalışmadığını doğrulayın",
"connectionOK": "Bağlantı Tamam - kimlik bilgileri geçerli",
"connectionFailed": "Bağlantı başarısız - lütfen yeniden giriş yapın",
"viewMyEdits": "OSM'deki Düzenlemelerimi Görüntüle",
"viewMyEditsSubtitle": "OpenStreetMap'teki düzenleme geçmişinizi görün",
"aboutOSM": "OpenStreetMap Hakkında",
"aboutOSMDescription": "OpenStreetMap, katkıda bulunanların dünyanın ücretsiz, düzenlenebilir haritasını oluşturdukları ve sürdürdükleri işbirlikçi, açık kaynaklı bir haritalama projesidir. Gözetleme cihazı katkılarınız bu altyapıyı görünür ve aranabilir hale getirmeye yardımcı olur.",
"visitOSM": "OpenStreetMap'i Ziyaret Et",
"deleteAccount": "OSM Hesabını Sil",
"deleteAccountSubtitle": "OpenStreetMap hesabınızı yönetin",
"deleteAccountExplanation": "OpenStreetMap hesabınızı silmek için OpenStreetMap web sitesini ziyaret etmeniz gerekecek. Bu, OSM hesabınızı ve ilişkili tüm verileri kalıcı olarak kaldıracaktır.",
"deleteAccountWarning": "Uyarı: Bu işlem geri alınamaz ve OSM hesabınızı kalıcı olarak silecektir.",
"goToOSM": "OpenStreetMap'e Git",
"accountManagement": "Hesap Yönetimi",
"accountManagementDescription": "OpenStreetMap hesabınızı silmek için uygun OpenStreetMap web sitesini ziyaret etmeniz gerekecek. Bu, hesabınızı ve ilişkili tüm verileri kalıcı olarak kaldıracaktır.",
"currentDestinationProduction": "Şu anda bağlı: Üretim OpenStreetMap",
"currentDestinationSandbox": "Şu anda bağlı: Sandbox OpenStreetMap",
"currentDestinationSimulate": "Şu anda: Simülasyon modu (gerçek hesap yok)",
"viewMessages": "OSM'deki Mesajları Görüntüle",
"unreadMessagesCount": "{} okunmamış mesajınız var",
"noUnreadMessages": "Okunmamış mesaj yok",
"reauthRequired": "Kimlik Doğrulamayı Yenile",
"reauthExplanation": "Uygulama üzerinden OSM mesaj bildirimlerini alabilmek için kimlik doğrulamanızı yenilemeniz gerekir.",
"reauthBenefit": "Bu, OpenStreetMap'te okunmamış mesajlarınız olduğunda bildirim noktalarını etkinleştirecek.",
"reauthNow": "Şimdi Yap",
"reauthLater": "Sonra"
},
"queue": {
"title": "Yükleme Kuyruğu",
"subtitle": "Bekleyen gözetleme cihazı yüklemelerini yönet",
"pendingUploads": "Bekleyen yüklemeler: {}",
"pendingItemsCount": "Bekleyen Öğeler: {}",
"nothingInQueue": "Kuyrukta hiçbir şey yok",
"simulateModeEnabled": "Simülasyon modu etkin yüklemeler simüle ediliyor",
"sandboxMode": "Sandbox modu yüklemeler OSM Sandbox'ına gidiyor",
"tapToViewQueue": "Kuyruğu görüntülemek için dokun",
"clearUploadQueue": "Yükleme Kuyruğunu Temizle",
"removeAllPending": "Tüm {} bekleyen yüklemeyi kaldır",
"clearQueueTitle": "Kuyruğu Temizle",
"clearQueueConfirm": "Tüm {} bekleyen yükleme kaldırılsın mı?",
"queueCleared": "Kuyruk temizlendi",
"uploadQueueTitle": "Yükleme Kuyruğu ({} öğe)",
"queueIsEmpty": "Kuyruk boş",
"itemWithIndex": "Öğe {}",
"error": " (Hata)",
"completing": " (Tamamlanıyor...)",
"destination": "Hedef: {}",
"latitude": "Enlem: {}",
"longitude": "Boylam: {}",
"direction": "Yön: {}°",
"attempts": "Denemeler: {}",
"uploadFailedRetry": "Yükleme başarısız. Tekrar denemek için yeniden dene'ye dokun.",
"retryUpload": "Yüklemeyi yeniden dene",
"clearAll": "Tümünü Temizle",
"errorDetails": "Hata Detayları",
"creatingChangeset": " (Değişiklik seti oluşturuluyor...)",
"uploading": " (Yükleniyor...)",
"closingChangeset": " (Değişiklik seti kapatılıyor...)",
"processingPaused": "Kuyruk İşleme Duraklatıldı",
"pausedDueToOffline": "Çevrimdışı mod etkin olduğu için yükleme işleme duraklatıldı.",
"pausedByUser": "Yükleme işleme manuel olarak duraklatıldı."
},
"tileProviders": {
"title": "Döşeme Sağlayıcıları",
"noProvidersConfigured": "Döşeme sağlayıcısı yapılandırılmamış",
"tileTypesCount": "{} döşeme türü",
"apiKeyConfigured": "API Anahtarı yapılandırıldı",
"needsApiKey": "API anahtarı gerekiyor",
"editProvider": "Sağlayıcıyı Düzenle",
"addProvider": "Sağlayıcı Ekle",
"deleteProvider": "Sağlayıcıyı Sil",
"deleteProviderConfirm": "\"{}\" silmek istediğinizden emin misiniz?",
"providerName": "Sağlayıcı Adı",
"providerNameHint": "örn., Özel Haritalar A.Ş.",
"providerNameRequired": "Sağlayıcı adı gerekli",
"apiKey": "API Anahtarı (İsteğe Bağlı)",
"apiKeyHint": "Döşeme türleri gerektiriyorsa API anahtarını girin",
"tileTypes": "Döşeme Türleri",
"addType": "Tür Ekle",
"noTileTypesConfigured": "Döşeme türü yapılandırılmamış",
"atLeastOneTileTypeRequired": "En az bir döşeme türü gerekli",
"manageTileProviders": "Sağlayıcıları Yönet"
},
"tileTypeEditor": {
"editTileType": "Döşeme Türünü Düzenle",
"addTileType": "Döşeme Türü Ekle",
"name": "Ad",
"nameHint": "örn., Uydu",
"nameRequired": "Ad gerekli",
"urlTemplate": "URL Şablonu",
"urlTemplateHint": "https://example.com/{z}/{x}/{y}.png",
"urlTemplateRequired": "URL şablonu gerekli",
"urlTemplatePlaceholders": "URL ya {quadkey} ya da {z}, {x}, ve {y} yer tutucularını içermelidir",
"attribution": "Atıf",
"attributionHint": "© Harita Sağlayıcısı",
"attributionRequired": "Atıf gerekli",
"maxZoom": "Maksimum Yakınlaştırma Seviyesi",
"maxZoomHint": "Maksimum yakınlaştırma seviyesi (1-23)",
"maxZoomRequired": "Maksimum yakınlaştırma gerekli",
"maxZoomInvalid": "Maksimum yakınlaştırma bir sayı olmalıdır",
"maxZoomRange": "Maksimum yakınlaştırma {} ile {} arasında olmalıdır",
"fetchPreview": "Önizleme Getir",
"previewTileLoaded": "Önizleme döşemesi başarıyla yüklendi",
"previewTileFailed": "Önizleme getirilemedi: {}",
"save": "Kaydet"
},
"profiles": {
"nodeProfiles": "Düğüm Profilleri",
"newProfile": "Yeni Profil",
"builtIn": "Yerleşik",
"custom": "Özel",
"view": "Görüntüle",
"deleteProfile": "Profili Sil",
"deleteProfileConfirm": "\"{}\" silmek istediğinizden emin misiniz?",
"profileDeleted": "Profil silindi",
"getMore": "Daha fazla al...",
"addProfileChoice": "Profil Ekle",
"addProfileChoiceMessage": "Nasıl bir profil eklemek istersiniz?",
"createCustomProfile": "Özel Profil Oluştur",
"createCustomProfileDescription": "Kendi etiketlerinizle sıfırdan bir profil oluşturun",
"importFromWebsite": "Web Sitesinden İçe Aktar",
"importFromWebsiteDescription": "deflock.me/identify'dan profilleri inceleyin ve içe aktarın"
},
"mapTiles": {
"title": "Harita Döşemeleri",
"manageProviders": "Sağlayıcıları Yönet",
"attribution": "Harita Atfı",
"mapAttribution": "Harita kaynağı: {}",
"couldNotOpenLink": "Bağlantıılamadı",
"openLicense": "Lisansı aç: {}"
},
"profileEditor": {
"viewProfile": "Profili Görüntüle",
"newProfile": "Yeni Profil",
"editProfile": "Profili Düzenle",
"profileName": "Profil adı",
"profileNameHint": "örn., Özel ALPR Kamerası",
"profileNameRequired": "Profil adı gerekli",
"requiresDirection": "Yön Gerektirir",
"requiresDirectionSubtitle": "Bu türdeki kameraların yön etiketi gerekip gerekmediği",
"fov": "Görüş Alanı",
"fovHint": "FOV derece cinsinden (varsayılan için boş bırakın)",
"fovSubtitle": "Kamera görüş alanı - koni genişliği ve aralık gönderim formatı için kullanılır",
"fovInvalid": "FOV 1 ile 360 derece arasında olmalıdır",
"submittable": "Gönderilebilir",
"submittableSubtitle": "Bu profilin kamera gönderimlerinde kullanılıp kullanılamayacağı",
"osmTags": "OSM Etiketleri",
"addTag": "Etiket ekle",
"saveProfile": "Profili Kaydet",
"keyHint": "anahtar",
"valueHint": "değer",
"atLeastOneTagRequired": "En az bir etiket gerekli",
"profileSaved": "\"{}\" profili kaydedildi"
},
"operatorProfileEditor": {
"newOperatorProfile": "Yeni Operatör Profili",
"editOperatorProfile": "Operatör Profilini Düzenle",
"operatorName": "Operatör adı",
"operatorNameHint": "örn., Ankara Polis Müdürlüğü",
"operatorNameRequired": "Operatör adı gerekli",
"operatorProfileSaved": "\"{}\" operatör profili kaydedildi"
},
"operatorProfiles": {
"title": "Operatör Profilleri",
"noProfilesMessage": "Operatör profili tanımlanmamış. Düğüm gönderimlerine operatör etiketleri uygulamak için bir tane oluşturun.",
"tagsCount": "{} etiket",
"deleteOperatorProfile": "Operatör Profilini Sil",
"deleteOperatorProfileConfirm": "\"{}\" silmek istediğinizden emin misiniz?",
"operatorProfileDeleted": "Operatör profili silindi"
},
"offlineAreas": {
"title": "Çevrimdışı Alanlar",
"noAreasTitle": "Çevrimdışı alan yok",
"noAreasSubtitle": "Çevrimdışı kullanım için bir harita alanı indirin.",
"provider": "Sağlayıcı",
"maxZoom": "Maksimum yakınlaştırma",
"zoomLevels": "Z{}-{}",
"latitude": "Enlem",
"longitude": "Boylam",
"tiles": "Döşemeler",
"size": "Boyut",
"nodes": "Düğümler",
"areaIdFallback": "Alan {}...",
"renameArea": "Alanı yeniden adlandır",
"refreshWorldTiles": "Dünya döşemelerini yenile/yeniden indir",
"deleteOfflineArea": "Çevrimdışı alanı sil",
"cancelDownload": "İndirmeyi iptal et",
"renameAreaDialogTitle": "Çevrimdışı Alanı Yeniden Adlandır",
"areaNameLabel": "Alan Adı",
"renameButton": "Yeniden Adlandır",
"megabytes": "MB",
"kilobytes": "KB",
"progress": "{}%",
"refreshArea": "Alanı yenile",
"refreshAreaDialogTitle": "Çevrimdışı Alanı Yenile",
"refreshAreaDialogSubtitle": "Bu alan için ne yenilenecek seçin:",
"refreshTiles": "Harita Döşemelerini Yenile",
"refreshTilesSubtitle": "Güncellenmiş görüntüler için tüm döşemeleri yeniden indir",
"refreshNodes": "Düğümleri Yenile",
"refreshNodesSubtitle": "Bu alan için düğüm verisini yeniden getir",
"startRefresh": "Yenilemeyi Başlat",
"refreshStarted": "Yenileme başladı!",
"refreshFailed": "Yenileme başarısız: {}"
},
"refineTagsSheet": {
"title": "Etiketleri Düzenle",
"operatorProfile": "Operatör Profili",
"done": "Tamam",
"none": "Hiçbiri",
"noAdditionalOperatorTags": "Ek operatör etiketi yok",
"additionalTags": "ek etiketler",
"additionalTagsTitle": "Ek Etiketler",
"noTagsDefinedForProfile": "Bu operatör profili için etiket tanımlanmamış.",
"noOperatorProfiles": "Operatör profili tanımlanmamış",
"noOperatorProfilesMessage": "Düğüm gönderimlerinize ek etiketler uygulamak için Ayarlar'da operatör profilleri oluşturun.",
"profileTags": "Profil Etiketleri",
"profileTagsDescription": "Daha detaylı gönderimler için bu isteğe bağlı etiket değerlerini tamamlayın:",
"selectValue": "Değer seçin...",
"noValue": "(boş bırak)",
"noSuggestions": "Öneri bulunmuyor",
"existingTagsTitle": "Mevcut Etiketler",
"existingTagsDescription": "Bu cihazdaki mevcut etiketleri düzenleyin. Herhangi bir etiketi ekleyin, kaldırın veya değiştirin:",
"existingOperator": "<Mevcut operatör>",
"existingOperatorTags": "mevcut operatör etiketleri"
},
"layerSelector": {
"cannotChangeTileTypes": "Çevrimdışı alanlar indirilirken döşeme türleri değiştirilemez",
"selectMapLayer": "Harita Katmanını Seç",
"noTileProvidersAvailable": "Döşeme sağlayıcısı mevcut değil"
},
"advancedEdit": {
"title": "Gelişmiş Düzenleme Seçenekleri",
"subtitle": "Bu editörler karmaşık düzenlemeler için daha gelişmiş özellikler sunar.",
"webEditors": "Web Editörleri",
"mobileEditors": "Mobil Editörler",
"iDEditor": "iD Editörü",
"iDEditorSubtitle": "Tam özellikli web editörü - her zaman çalışır",
"rapidEditor": "RapiD Editörü",
"rapidEditorSubtitle": "Facebook verileriyle AI destekli düzenleme",
"vespucci": "Vespucci",
"vespucciSubtitle": "Gelişmiş Android OSM editörü",
"streetComplete": "StreetComplete",
"streetCompleteSubtitle": "Anket tabanlı haritalama uygulaması",
"everyDoor": "EveryDoor",
"everyDoorSubtitle": "Hızlı POI düzenleme",
"goMap": "Go Map!!",
"goMapSubtitle": "iOS OSM editörü",
"couldNotOpenEditor": "Editör açılamadı - uygulama yüklü olmayabilir",
"couldNotOpenURL": "URL açılamadı",
"couldNotOpenOSMWebsite": "OSM web sitesi açılamadı"
},
"networkStatus": {
"showIndicator": "Ağ durumu göstergesini göster",
"showIndicatorSubtitle": "Gözetleme verisi yükleme ve hata durumunu göster",
"loading": "Gözetleme verisi yükleniyor...",
"timedOut": "İstek zaman aşımına uğradı",
"noData": "Çevrimdışı veri yok",
"success": "Gözetleme verisi yüklendi",
"nodeDataSlow": "Gözetleme verisi yavaş",
"rateLimited": "Sunucu tarafından hız sınırlandı",
"networkError": "Ağ hatası"
},
"nodeLimitIndicator": {
"message": "{total} cihazdan {rendered} tanesi gösteriliyor",
"editingDisabledMessage": "Güvenli düzenleme için çok fazla cihaz gösteriliyor. Görünen cihaz sayısını azaltmak için daha fazla yakınlaştırın, sonra tekrar deneyin."
},
"navigation": {
"searchLocation": "Konum Ara",
"searchPlaceholder": "Yerler veya koordinatlar ara...",
"routeTo": "Buraya Yol Tarifi",
"routeFrom": "Buradan Yol Tarifi",
"selectLocation": "Konum Seç",
"calculatingRoute": "Rota hesaplanıyor...",
"routeCalculationFailed": "Rota hesaplama başarısız",
"start": "Başlat",
"resume": "Devam Et",
"endRoute": "Rotayı Bitir",
"routeOverview": "Rota Özeti",
"retry": "Yeniden Dene",
"cancelSearch": "Aramayı iptal et",
"noResultsFound": "Sonuç bulunamadı",
"searching": "Aranıyor...",
"location": "Konum",
"startPoint": "Başlangıç",
"endPoint": "Bitiş",
"startSelect": "Başlangıç (seç)",
"endSelect": "Bitiş (seç)",
"distance": "Mesafe: {} km",
"routeActive": "Rota aktif",
"locationsTooClose": "Başlangıç ve bitiş konumları birbirine çok yakın",
"navigationSettings": "Navigasyon",
"navigationSettingsSubtitle": "Rota planlama ve kaçınma ayarları",
"avoidanceDistance": "Kaçınma Mesafesi",
"avoidanceDistanceSubtitle": "Gözetleme cihazlarından uzak durmak için minimum mesafe",
"searchHistory": "Maksimum Arama Geçmişi",
"searchHistorySubtitle": "Hatırlanacak son aramaların maksimum sayısı"
},
"suspectedLocations": {
"title": "Şüpheli Konumlar",
"showSuspectedLocations": "Şüpheli Konumları Göster",
"showSuspectedLocationsSubtitle": "Altyapı izin verilerinden şüpheli gözetleme siteleri için soru işareti işaretçilerini göster",
"lastUpdated": "Son Güncellenme",
"refreshNow": "Şimdi yenile",
"dataSource": "Veri Kaynağı",
"dataSourceDescription": "Potansiyel gözetleme altyapısı kurulum sitelerini gösteren altyapı izin verileri",
"dataSourceCredit": "Veri toplama ve barındırma alprwatch.org tarafından sağlanır",
"minimumDistance": "Gerçek Düğümlerden Minimum Mesafe",
"minimumDistanceSubtitle": "Mevcut gözetleme cihazlarının {}m yakınındaki şüpheli konumları gizle",
"updating": "Şüpheli Konumlar Güncelleniyor",
"downloadingAndProcessing": "Veri indiriliyor ve işleniyor...",
"updateSuccess": "Şüpheli konumlar başarıyla güncellendi",
"updateFailed": "Şüpheli konumları güncelleme başarısız",
"neverFetched": "Hiç getirilmedi",
"daysAgo": "{} gün önce",
"hoursAgo": "{} saat önce",
"minutesAgo": "{} dakika önce",
"justNow": "Şimdi"
},
"suspectedLocation": {
"title": "Şüpheli Konum #{}",
"ticketNo": "Bilet No",
"address": "Adres",
"street": "Sokak",
"city": "Şehir",
"state": "Eyalet",
"intersectingStreet": "Kesişen Sokak",
"workDoneFor": "İş Yapılan",
"remarks": "Açıklamalar",
"url": "URL",
"coordinates": "Koordinatlar",
"noAddressAvailable": "Adres mevcut değil"
},
"units": {
"meters": "m",
"feet": "ft",
"kilometers": "km",
"miles": "mil",
"metersLong": "metre",
"feetLong": "fit",
"kilometersLong": "kilometre",
"milesLong": "mil",
"metric": "Metrik",
"imperial": "İmperial",
"metricDescription": "Metrik (km, m)",
"imperialDescription": "İmperial (mil, ft)"
}
}

561
lib/localizations/uk.json Normal file
View File

@@ -0,0 +1,561 @@
{
"language": {
"name": "Українська"
},
"app": {
"title": "DeFlock"
},
"about": {
"title": "DeFlock - Прозорість Спостереження",
"description": "DeFlock - це мобільний додаток, зосереджений на конфіденційності, для картування громадської інфраструктури спостереження з використанням OpenStreetMap. Документуйте камери, ALPR, детектори пострілів та інші пристрої спостереження у вашій громаді, щоб зробити цю інфраструктуру видимою та доступною для пошуку.",
"features": "• Картування в офлайн-режимі з завантажуваними областями\n• Завантаження безпосередньо в OpenStreetMap через OAuth2\n• Вбудовані профілі для великих виробників\n• Повага до приватності - дані користувача не збираються\n• Кілька постачальників карт (OSM, супутникові знімки)",
"initiative": "Частина ширшої ініціативи DeFlock з просування прозорості спостереження.",
"footer": "Відвідайте: deflock.me\nПобудовано з Flutter • Відкритий код",
"showWelcome": "Показати Привітальне Повідомлення",
"showSubmissionGuide": "Показати Посібник Подання",
"viewReleaseNotes": "Переглянути Примітки Випуску"
},
"welcome": {
"title": "Ласкаво просимо до DeFlock",
"description": "DeFlock був заснований на ідеї, що інструменти громадського спостереження повинні бути прозорими. В цьому мобільному додатку, як і на веб-сайті, ви зможете переглядати місця розташування ALPR та іншої інфраструктури спостереження у вашому районі та за кордоном.",
"mission": "Однак цей проект не автоматизований; потрібні зусилля всіх нас, щоб покращити цей проект. Переглядаючи карту, ви можете натиснути \"Новий Вузол\", щоб додати раніше невідому установку. З вашою допомогою ми можемо досягти нашої мети підвищення прозорості та громадської обізнаності щодо інфраструктури спостереження.",
"firsthandKnowledge": "ВАЖЛИВО: Додавайте лише пристрої спостереження, які ви особисто спостерігали власними очима. Політика OpenStreetMap та Google забороняє використання таких джерел, як зображення Street View для подань. Ваші внески повинні базуватися на ваших власних безпосередніх спостереженнях.",
"privacy": "Примітка щодо конфіденційності: Цей додаток працює повністю локально на вашому пристрої та використовує сторонній API OpenStreetMap для зберігання даних та подань. DeFlock не збирає та не зберігає жодних даних користувачів і не несе відповідальності за управління обліковими записами.",
"tileNote": "ПРИМІТКА: Безкоштовні плитки карт з OpenStreetMap можуть завантажуватися дуже повільно. Альтернативні постачальники плиток можна налаштувати в Налаштуваннях > Розширені.",
"moreInfo": "Більше посилань можна знайти в Налаштуваннях > Про програму.",
"dontShowAgain": "Не показувати це привітальне повідомлення знову",
"getStarted": "Давайте почнемо DeFlocking!"
},
"submissionGuide": {
"title": "Найкращі Практики Подання",
"description": "Перш ніж подати ваш перший пристрій спостереження, будь ласка, приділіть хвилину для перегляду цих важливих вказівок, щоб забезпечити високоякісні внески в OpenStreetMap.",
"bestPractices": "• Картуйте лише пристрої, які ви особисто спостерігали\n• Приділіть час точному визначенню типу пристрою та виробника\n• Використовуйте точне позиціонування - збільшуйте масштаб перед розміщенням маркера\n• Включайте інформацію про напрямок, коли це застосовно\n• Двічі перевірте ваші вибори тегів перед поданням",
"placementNote": "Пам'ятайте: Точні дані з перших рук є важливими для спільноти DeFlock та проекту OpenStreetMap.",
"moreInfo": "Для детального керівництва з ідентифікації пристроїв та найкращих практик картування:",
"identificationGuide": "Посібник Ідентифікації",
"osmWiki": "OpenStreetMap Wiki",
"dontShowAgain": "Не показувати цей посібник знову",
"gotIt": "Зрозуміло!"
},
"positioningTutorial": {
"title": "Уточнити Ваше Місце",
"instructions": "Перетягніть карту, щоб точно розмістити маркер пристрою над місцем розташування пристрою спостереження.",
"hint": "Ви можете збільшити масштаб для кращої точності перед позиціонуванням."
},
"actions": {
"tagNode": "Новий Вузол",
"download": "Завантажити",
"settings": "Налаштування",
"edit": "Редагувати",
"delete": "Видалити",
"cancel": "Скасувати",
"ok": "ОК",
"close": "Закрити",
"submit": "Подати",
"logIn": "Увійти",
"saveEdit": "Зберегти Редагування",
"clear": "Очистити",
"viewOnOSM": "Переглянути в OSM",
"advanced": "Розширені",
"useAdvancedEditor": "Використати Розширений Редактор"
},
"proximityWarning": {
"title": "Вузол Дуже Близько до Існуючого Пристрою",
"message": "Цей вузол знаходиться лише в {} метрах від існуючого пристрою спостереження.",
"suggestion": "Якщо кілька пристроїв знаходяться на одному стовпі, будь ласка, використовуйте кілька напрямків на одному вузлі замість створення окремих вузлів.",
"nearbyNodes": "Знайдено близькі пристрої ({}):",
"nodeInfo": "Вузол #{} - {}",
"andMore": "...та ще {}",
"goBack": "Повернутися",
"submitAnyway": "Все одно Подати",
"nodeType": {
"alpr": "ALPR/ANPR Камера",
"publicCamera": "Камера Громадського Спостереження",
"camera": "Камера Спостереження",
"amenity": "{}",
"device": "Пристрій {}",
"unknown": "Невідомий Пристрій"
}
},
"followMe": {
"off": "Увімкнути слідування",
"follow": "Увімкнути слідування (обертання)",
"rotating": "Вимкнути слідування"
},
"settings": {
"title": "Налаштування",
"language": "Мова та Регіон",
"systemDefault": "Системна За Замовчуванням",
"aboutInfo": "Про / Інформація",
"aboutThisApp": "Про Цей Додаток",
"aboutSubtitle": "Інформація про додаток та автори",
"languageSubtitle": "Оберіть вашу бажану мову та одиниці вимірювання",
"distanceUnit": "Одиниці Відстані",
"distanceUnitSubtitle": "Оберіть між метричними (км/м) або імперськими (миля/фут) одиницями",
"metricUnits": "Метричні (км, м)",
"imperialUnits": "Імперські (миля, фут)",
"maxNodes": "Максимум намальованих вузлів",
"maxNodesSubtitle": "Встановити верхню межу для кількості вузлів на карті.",
"maxNodesWarning": "Ви, мабуть, не хочете робити це, якщо ви абсолютно не впевнені, що у вас є вагома причина для цього.",
"offlineMode": "Офлайн Режим",
"offlineModeSubtitle": "Вимкнути всі мережеві запити, крім локальних/офлайн областей.",
"pauseQueueProcessing": "Призупинити Обробку Черги Завантаження",
"pauseQueueProcessingSubtitle": "Припинити завантаження змін у черзі, зберігаючи доступ до живих даних.",
"offlineModeWarningTitle": "Активні Завантаження",
"offlineModeWarningMessage": "Включення офлайн режиму скасує всі активні завантаження областей. Ви хочете продовжити?",
"enableOfflineMode": "Увімкнути Офлайн Режим",
"profiles": "Профілі",
"profilesSubtitle": "Управління профілями вузлів та операторів",
"offlineSettings": "Офлайн Налаштування",
"offlineSettingsSubtitle": "Управління офлайн режимом та завантаженими областями",
"advancedSettings": "Розширені Налаштування",
"advancedSettingsSubtitle": "Продуктивність, сповіщення та налаштування постачальників плиток",
"proximityAlerts": "Сповіщення Про Близькість",
"networkStatusIndicator": "Індикатор Стану Мережі"
},
"proximityAlerts": {
"getNotified": "Отримувати сповіщення при наближенні до пристроїв спостереження",
"batteryUsage": "Використовує додаткову батарею для безперервного моніторингу місцезнаходження",
"notificationsEnabled": "✓ Сповіщення увімкнено",
"notificationsDisabled": "⚠ Сповіщення вимкнено",
"permissionRequired": "Потрібен дозвіл на сповіщення",
"permissionExplanation": "Push-сповіщення вимкнено. Ви бачитимете лише сповіщення в додатку і не будете сповіщені, коли додаток працює у фоновому режимі.",
"enableNotifications": "Увімкнути Сповіщення",
"checkingPermissions": "Перевірка дозволів...",
"alertDistance": "Відстань сповіщення: ",
"rangeInfo": "Діапазон: {}-{} {} (за замовчуванням: {})"
},
"node": {
"title": "Вузол #{}",
"tagSheetTitle": "Теги Пристрою Спостереження",
"queuedForUpload": "Вузол поставлено в чергу для завантаження",
"editQueuedForUpload": "Редагування вузла поставлено в чергу для завантаження",
"deleteQueuedForUpload": "Видалення вузла поставлено в чергу для завантаження",
"confirmDeleteTitle": "Видалити Вузол",
"confirmDeleteMessage": "Ви впевнені, що хочете видалити вузол #{}? Цю дію не можна скасувати."
},
"addNode": {
"profile": "Профіль",
"selectProfile": "Оберіть профіль...",
"profileRequired": "Будь ласка, оберіть профіль для продовження.",
"direction": "Напрямок {}°",
"profileNoDirectionInfo": "Цей профіль не потребує напрямку.",
"mustBeLoggedIn": "Ви повинні увійти в систему, щоб подавати нові вузли. Будь ласка, увійдіть через Налаштування.",
"enableSubmittableProfile": "Увімкніть профіль, який можна подавати, в Налаштуваннях для подання нових вузлів.",
"profileViewOnlyWarning": "Цей профіль призначений лише для перегляду карти. Будь ласка, оберіть профіль, який можна подавати, для подання нових вузлів.",
"loadingAreaData": "Завантаження даних області... Будь ласка, зачекайте перед поданням.",
"refineTags": "Уточнити Теги"
},
"editNode": {
"title": "Редагувати Вузол #{}",
"profile": "Профіль",
"selectProfile": "Оберіть профіль...",
"profileRequired": "Будь ласка, оберіть профіль для продовження.",
"direction": "Напрямок {}°",
"profileNoDirectionInfo": "Цей профіль не потребує напрямку.",
"temporarilyDisabled": "Редагування тимчасово вимкнено, поки ми розбираємося з помилкою - вибачте - перевірте пізніше.",
"mustBeLoggedIn": "Ви повинні увійти в систему, щоб редагувати вузли. Будь ласка, увійдіть через Налаштування.",
"sandboxModeWarning": "Не можна подавати редагування виробничих вузлів в sandbox. Перейдіть в режим Виробництва в Налаштуваннях для редагування вузлів.",
"enableSubmittableProfile": "Увімкніть профіль, який можна подавати, в Налаштуваннях для редагування вузлів.",
"profileViewOnlyWarning": "Цей профіль призначений лише для перегляду карти. Будь ласка, оберіть профіль, який можна подавати, для редагування вузлів.",
"loadingAreaData": "Завантаження даних області... Будь ласка, зачекайте перед поданням.",
"cannotMoveConstrainedNode": "Неможливо перемістити цю камеру - вона підключена до іншого елементу карти (OSM шлях/відношення). Ви все ще можете редагувати її теги та напрямок.",
"zoomInRequiredMessage": "Збільште масштаб до принаймні рівня {} для додавання або редагування вузлів спостереження. Це забезпечує точне позиціонування для точного картування.",
"extractFromWay": "Витягнути вузол з шляху/відношення",
"extractFromWaySubtitle": "Створити новий вузол з тими ж тегами, дозволити переміщення до нового місця",
"refineTags": "Уточнити Теги",
"existingTags": "<Існуючі теги>",
"noChangesDetected": "Зміни не виявлено - нічого подавати",
"noChangesTitle": "Немає Змін для Подання",
"noChangesMessage": "Ви не внесли жодних змін до цього вузла. Щоб подати редагування, вам потрібно змінити місце, профіль, напрямки або теги."
},
"download": {
"title": "Завантажити Область Карти",
"maxZoomLevel": "Максимальний рівень масштабування",
"storageEstimate": "Оцінка сховища:",
"tilesAndSize": "{} плиток, {} МБ",
"minZoom": "Мін масштаб:",
"maxRecommendedZoom": "Максимальний рекомендований масштаб: Z{}",
"withinTileLimit": "В межах {} ліміту плиток",
"exceedsTileLimit": "Поточний вибір перевищує {} ліміт плиток",
"offlineModeWarning": "Завантаження вимкнено в офлайн режимі. Вимкніть офлайн режим для завантаження нових областей.",
"areaTooBigMessage": "Збільште масштаб до принаймні рівня {} для завантаження офлайн областей. Великі завантаження областей можуть призвести до того, що додаток перестане відповідати.",
"downloadStarted": "Завантаження почалося! Отримання плиток та вузлів...",
"downloadFailed": "Не вдалося почати завантаження: {}",
"offlineNotPermitted": "Сервер {} не дозволяє офлайн-завантаження. Перейдіть на постачальника плиток, який дозволяє офлайн-використання (наприклад, Bing Maps, Mapbox або власний сервер плиток).",
"currentTileProvider": "поточна плитка",
"noTileProviderSelected": "Постачальник плиток не вибраний. Виберіть стиль карти перед завантаженням офлайн-області."
},
"downloadStarted": {
"title": "Завантаження Почалося",
"message": "Завантаження почалося! Отримання плиток та вузлів...",
"ok": "ОК",
"viewProgress": "Переглянути Прогрес в Налаштуваннях"
},
"uploadMode": {
"title": "Місце Призначення Завантаження",
"subtitle": "Оберіть, куди завантажуються камери",
"production": "Виробництво",
"sandbox": "Sandbox",
"simulate": "Симуляція",
"productionDescription": "Завантажити в активну базу даних OSM (видима всім користувачам)",
"sandboxDescription": "Завантаження йдуть в OSM Sandbox (безпечно для тестування, регулярно скидається).",
"simulateDescription": "Симулювати завантаження (не зв'язується з серверами OSM)",
"cannotChangeWithQueue": "Неможливо змінити місце призначення завантаження, поки в черзі є {} елементів. Спочатку очистіть чергу."
},
"auth": {
"osmAccountTitle": "Обліковий Запис OpenStreetMap",
"osmAccountSubtitle": "Управління входом OSM та перегляд ваших внесків",
"loggedInAs": "Увійшли як {}",
"loginToOSM": "Увійти в OpenStreetMap",
"tapToLogout": "Натисніть для виходу",
"requiredToSubmit": "Потрібно для подання даних камер",
"loggedOut": "Вихід здійснено",
"testConnection": "Тестувати З'єднання",
"testConnectionSubtitle": "Перевірити, що облікові дані OSM працюють",
"connectionOK": "З'єднання в порядку - облікові дані дійсні",
"connectionFailed": "З'єднання не вдалося - будь ласка, увійдіть знову",
"viewMyEdits": "Переглянути Мої Редагування в OSM",
"viewMyEditsSubtitle": "Побачити вашу історію редагувань в OpenStreetMap",
"aboutOSM": "Про OpenStreetMap",
"aboutOSMDescription": "OpenStreetMap - це колаборативний проект картування з відкритим кодом, де учасники створюють і підтримують безкоштовну, редаговану карту світу. Ваші внески пристроїв спостереження допомагають зробити цю інфраструктуру видимою та доступною для пошуку.",
"visitOSM": "Відвідати OpenStreetMap",
"deleteAccount": "Видалити Обліковий Запис OSM",
"deleteAccountSubtitle": "Управління обліковим записом OpenStreetMap",
"deleteAccountExplanation": "Щоб видалити ваш обліковий запис OpenStreetMap, вам потрібно відвідати веб-сайт OpenStreetMap. Це назавжди видалить ваш обліковий запис OSM та всі пов'язані дані.",
"deleteAccountWarning": "Попередження: Цю дію не можна скасувати і вона назавжди видалить ваш обліковий запис OSM.",
"goToOSM": "Перейти до OpenStreetMap",
"accountManagement": "Управління Обліковим Записом",
"accountManagementDescription": "Щоб видалити ваш обліковий запис OpenStreetMap, вам потрібно відвідати відповідний веб-сайт OpenStreetMap. Це назавжди видалить ваш обліковий запис та всі пов'язані дані.",
"currentDestinationProduction": "Зараз підключено до: Виробничий OpenStreetMap",
"currentDestinationSandbox": "Зараз підключено до: Sandbox OpenStreetMap",
"currentDestinationSimulate": "Зараз в: Режимі симуляції (без справжнього облікового запису)",
"viewMessages": "Переглянути Повідомлення в OSM",
"unreadMessagesCount": "У вас {} непрочитаних повідомлень",
"noUnreadMessages": "Немає непрочитаних повідомлень",
"reauthRequired": "Оновити Автентифікацію",
"reauthExplanation": "Ви повинні оновити вашу автентифікацію, щоб отримувати сповіщення про повідомлення OSM через додаток.",
"reauthBenefit": "Це дозволить показувати точки сповіщень, коли у вас є непрочитані повідомлення в OpenStreetMap.",
"reauthNow": "Зробити Зараз",
"reauthLater": "Пізніше"
},
"queue": {
"title": "Черга Завантаження",
"subtitle": "Управління очікуваними завантаженнями пристроїв спостереження",
"pendingUploads": "Очікувані завантаження: {}",
"pendingItemsCount": "Очікуючі Елементи: {}",
"nothingInQueue": "Нічого в черзі",
"simulateModeEnabled": "Режим симуляції увімкнено завантаження симулюються",
"sandboxMode": "Режим sandbox завантаження йдуть в OSM Sandbox",
"tapToViewQueue": "Натисніть для перегляду черги",
"clearUploadQueue": "Очистити Чергу Завантаження",
"removeAllPending": "Видалити всі {} очікувані завантаження",
"clearQueueTitle": "Очистити Чергу",
"clearQueueConfirm": "Видалити всі {} очікувані завантаження?",
"queueCleared": "Чергу очищено",
"uploadQueueTitle": "Черга Завантаження ({} елементів)",
"queueIsEmpty": "Черга порожня",
"itemWithIndex": "Елемент {}",
"error": " (Помилка)",
"completing": " (Завершуємо...)",
"destination": "Місце призначення: {}",
"latitude": "Широта: {}",
"longitude": "Довгота: {}",
"direction": "Напрямок: {}°",
"attempts": "Спроби: {}",
"uploadFailedRetry": "Завантаження не вдалося. Натисніть повторити, щоб спробувати знову.",
"retryUpload": "Повторити завантаження",
"clearAll": "Очистити Все",
"errorDetails": "Деталі Помилки",
"creatingChangeset": " (Створення набору змін...)",
"uploading": " (Завантаження...)",
"closingChangeset": " (Закриття набору змін...)",
"processingPaused": "Обробка Черги Призупинена",
"pausedDueToOffline": "Обробка завантаження призупинена, оскільки увімкнено офлайн режим.",
"pausedByUser": "Обробка завантаження призупинена вручну."
},
"tileProviders": {
"title": "Постачальники Плиток",
"noProvidersConfigured": "Постачальників плиток не налаштовано",
"tileTypesCount": "{} типів плиток",
"apiKeyConfigured": "API ключ налаштовано",
"needsApiKey": "Потрібен API ключ",
"editProvider": "Редагувати Постачальника",
"addProvider": "Додати Постачальника",
"deleteProvider": "Видалити Постачальника",
"deleteProviderConfirm": "Ви впевнені, що хочете видалити \"{}\"?",
"providerName": "Назва Постачальника",
"providerNameHint": "напр., Кастомні Карти ТОВ",
"providerNameRequired": "Назва постачальника обов'язкова",
"apiKey": "API Ключ (Опціонально)",
"apiKeyHint": "Введіть API ключ, якщо потрібно для типів плиток",
"tileTypes": "Типи Плиток",
"addType": "Додати Тип",
"noTileTypesConfigured": "Типи плиток не налаштовано",
"atLeastOneTileTypeRequired": "Потрібен принаймні один тип плитки",
"manageTileProviders": "Управляти Постачальниками"
},
"tileTypeEditor": {
"editTileType": "Редагувати Тип Плитки",
"addTileType": "Додати Тип Плитки",
"name": "Назва",
"nameHint": "напр., Супутник",
"nameRequired": "Назва обов'язкова",
"urlTemplate": "Шаблон URL",
"urlTemplateHint": "https://example.com/{z}/{x}/{y}.png",
"urlTemplateRequired": "Шаблон URL обов'язковий",
"urlTemplatePlaceholders": "URL повинен містити або {quadkey}, або {z}, {x} і {y} заповнювачі",
"attribution": "Атрибуція",
"attributionHint": "© Постачальник Карт",
"attributionRequired": "Атрибуція обов'язкова",
"maxZoom": "Максимальний Рівень Масштабування",
"maxZoomHint": "Максимальний рівень масштабування (1-23)",
"maxZoomRequired": "Максимальний масштаб обов'язковий",
"maxZoomInvalid": "Максимальний масштаб повинен бути числом",
"maxZoomRange": "Максимальний масштаб повинен бути між {} і {}",
"fetchPreview": "Отримати Попередній Перегляд",
"previewTileLoaded": "Плитка попереднього перегляду успішно завантажена",
"previewTileFailed": "Не вдалося отримати попередній перегляд: {}",
"save": "Зберегти"
},
"profiles": {
"nodeProfiles": "Профілі Вузлів",
"newProfile": "Новий Профіль",
"builtIn": "Вбудований",
"custom": "Власний",
"view": "Переглянути",
"deleteProfile": "Видалити Профіль",
"deleteProfileConfirm": "Ви впевнені, що хочете видалити \"{}\"?",
"profileDeleted": "Профіль видалено",
"getMore": "Отримати більше...",
"addProfileChoice": "Додати Профіль",
"addProfileChoiceMessage": "Як би ви хотіли додати профіль?",
"createCustomProfile": "Створити Власний Профіль",
"createCustomProfileDescription": "Побудувати профіль з нуля з власними тегами",
"importFromWebsite": "Імпортувати з Веб-сайту",
"importFromWebsiteDescription": "Переглянути та імпортувати профілі з deflock.me/identify"
},
"mapTiles": {
"title": "Плитки Карти",
"manageProviders": "Управляти Постачальниками",
"attribution": "Атрибуція Карти",
"mapAttribution": "Джерело карти: {}",
"couldNotOpenLink": "Не вдалося відкрити посилання",
"openLicense": "Відкрити ліцензію: {}"
},
"profileEditor": {
"viewProfile": "Переглянути Профіль",
"newProfile": "Новий Профіль",
"editProfile": "Редагувати Профіль",
"profileName": "Назва профілю",
"profileNameHint": "напр., Власна ALPR Камера",
"profileNameRequired": "Назва профілю обов'язкова",
"requiresDirection": "Потребує Напрямку",
"requiresDirectionSubtitle": "Чи потрібен тег напрямку для камер цього типу",
"fov": "Поле Зору",
"fovHint": "FOV в градусах (залиште порожнім для значення за замовчуванням)",
"fovSubtitle": "Поле зору камери - використовується для ширини конуса та формату подання діапазону",
"fovInvalid": "FOV повинно бути між 1 і 360 градусами",
"submittable": "Можна Подавати",
"submittableSubtitle": "Чи можна використовувати цей профіль для подань камер",
"osmTags": "OSM Теги",
"addTag": "Додати тег",
"saveProfile": "Зберегти Профіль",
"keyHint": "ключ",
"valueHint": "значення",
"atLeastOneTagRequired": "Потрібен принаймні один тег",
"profileSaved": "Профіль \"{}\" збережено"
},
"operatorProfileEditor": {
"newOperatorProfile": "Новий Профіль Оператора",
"editOperatorProfile": "Редагувати Профіль Оператора",
"operatorName": "Назва оператора",
"operatorNameHint": "напр., Поліція Києва",
"operatorNameRequired": "Назва оператора обов'язкова",
"operatorProfileSaved": "Профіль оператора \"{}\" збережено"
},
"operatorProfiles": {
"title": "Профілі Операторів",
"noProfilesMessage": "Профілі операторів не визначено. Створіть один для застосування тегів операторів до подань вузлів.",
"tagsCount": "{} тегів",
"deleteOperatorProfile": "Видалити Профіль Оператора",
"deleteOperatorProfileConfirm": "Ви впевнені, що хочете видалити \"{}\"?",
"operatorProfileDeleted": "Профіль оператора видалено"
},
"offlineAreas": {
"title": "Офлайн Області",
"noAreasTitle": "Немає офлайн областей",
"noAreasSubtitle": "Завантажте область карти для офлайн використання.",
"provider": "Постачальник",
"maxZoom": "Максимальний масштаб",
"zoomLevels": "Z{}-{}",
"latitude": "Широта",
"longitude": "Довгота",
"tiles": "Плитки",
"size": "Розмір",
"nodes": "Вузли",
"areaIdFallback": "Область {}...",
"renameArea": "Перейменувати область",
"refreshWorldTiles": "Оновити/перезавантажити світові плитки",
"deleteOfflineArea": "Видалити офлайн область",
"cancelDownload": "Скасувати завантаження",
"renameAreaDialogTitle": "Перейменувати Офлайн Область",
"areaNameLabel": "Назва Області",
"renameButton": "Перейменувати",
"megabytes": "МБ",
"kilobytes": "КБ",
"progress": "{}%",
"refreshArea": "Оновити область",
"refreshAreaDialogTitle": "Оновити Офлайн Область",
"refreshAreaDialogSubtitle": "Виберіть що оновити для цієї області:",
"refreshTiles": "Оновити Плитки Карти",
"refreshTilesSubtitle": "Перезавантажити всі плитки для оновлених зображень",
"refreshNodes": "Оновити Вузли",
"refreshNodesSubtitle": "Повторно отримати дані вузлів для цієї області",
"startRefresh": "Почати Оновлення",
"refreshStarted": "Оновлення розпочато!",
"refreshFailed": "Оновлення не вдалося: {}"
},
"refineTagsSheet": {
"title": "Уточнити Теги",
"operatorProfile": "Профіль Оператора",
"done": "Готово",
"none": "Немає",
"noAdditionalOperatorTags": "Немає додаткових тегів оператора",
"additionalTags": "додаткові теги",
"additionalTagsTitle": "Додаткові Теги",
"noTagsDefinedForProfile": "Для цього профілю оператора не визначено тегів.",
"noOperatorProfiles": "Профілі операторів не визначено",
"noOperatorProfilesMessage": "Створіть профілі операторів в Налаштуваннях для застосування додаткових тегів до ваших подань вузлів.",
"profileTags": "Теги Профілю",
"profileTagsDescription": "Заповніть ці опціональні значення тегів для більш детальних подань:",
"selectValue": "Вибрати значення...",
"noValue": "(залишити порожнім)",
"noSuggestions": "Немає доступних пропозицій",
"existingTagsTitle": "Існуючі Теги",
"existingTagsDescription": "Редагуйте існуючі теги на цьому пристрої. Додайте, видаліть або змініть будь-який тег:",
"existingOperator": "<Існуючий оператор>",
"existingOperatorTags": "існуючі теги оператора"
},
"layerSelector": {
"cannotChangeTileTypes": "Неможливо змінити типи плиток під час завантаження офлайн областей",
"selectMapLayer": "Вибрати Шар Карти",
"noTileProvidersAvailable": "Немає доступних постачальників плиток"
},
"advancedEdit": {
"title": "Розширені Опції Редагування",
"subtitle": "Ці редактори пропонують більш розширені можливості для складних редагувань.",
"webEditors": "Веб Редактори",
"mobileEditors": "Мобільні Редактори",
"iDEditor": "iD Редактор",
"iDEditorSubtitle": "Повнофункціональний веб редактор - завжди працює",
"rapidEditor": "RapiD Редактор",
"rapidEditorSubtitle": "AI-асистоване редагування з даними Facebook",
"vespucci": "Vespucci",
"vespucciSubtitle": "Розширений Android OSM редактор",
"streetComplete": "StreetComplete",
"streetCompleteSubtitle": "Додаток для картування на основі опитувань",
"everyDoor": "EveryDoor",
"everyDoorSubtitle": "Швидке редагування POI",
"goMap": "Go Map!!",
"goMapSubtitle": "iOS OSM редактор",
"couldNotOpenEditor": "Не вдалося відкрити редактор - додаток може бути не встановлений",
"couldNotOpenURL": "Не вдалося відкрити URL",
"couldNotOpenOSMWebsite": "Не вдалося відкрити веб-сайт OSM"
},
"networkStatus": {
"showIndicator": "Показувати індикатор стану мережі",
"showIndicatorSubtitle": "Відображати стан завантаження та помилки даних спостереження",
"loading": "Завантаження даних спостереження...",
"timedOut": "Запит перевищив час очікування",
"noData": "Немає офлайн даних",
"success": "Дані спостереження завантажено",
"nodeDataSlow": "Повільні дані спостереження",
"rateLimited": "Обмежено швидкість сервером",
"networkError": "Помилка мережі"
},
"nodeLimitIndicator": {
"message": "Показано {rendered} з {total} пристроїв",
"editingDisabledMessage": "Показано забагато пристроїв для безпечного редагування. Збільште масштаб далі, щоб зменшити кількість видимих пристроїв, потім спробуйте знову."
},
"navigation": {
"searchLocation": "Пошук Локації",
"searchPlaceholder": "Шукати місця або координати...",
"routeTo": "Маршрут До",
"routeFrom": "Маршрут Від",
"selectLocation": "Вибрати Локацію",
"calculatingRoute": "Розрахунок маршруту...",
"routeCalculationFailed": "Розрахунок маршруту не вдався",
"start": "Почати",
"resume": "Відновити",
"endRoute": "Завершити Маршрут",
"routeOverview": "Огляд Маршруту",
"retry": "Повторити",
"cancelSearch": "Скасувати пошук",
"noResultsFound": "Результатів не знайдено",
"searching": "Пошук...",
"location": "Локація",
"startPoint": "Початок",
"endPoint": "Кінець",
"startSelect": "Початок (вибрати)",
"endSelect": "Кінець (вибрати)",
"distance": "Відстань: {} км",
"routeActive": "Маршрут активний",
"locationsTooClose": "Початкова та кінцева локації занадто близько одна до одної",
"navigationSettings": "Навігація",
"navigationSettingsSubtitle": "Планування маршруту та налаштування уникнення",
"avoidanceDistance": "Відстань Уникнення",
"avoidanceDistanceSubtitle": "Мінімальна відстань для уникнення пристроїв спостереження",
"searchHistory": "Макс Історія Пошуку",
"searchHistorySubtitle": "Максимальна кількість нещодавніх пошуків для запам'ятовування"
},
"suspectedLocations": {
"title": "Підозрілі Локації",
"showSuspectedLocations": "Показувати Підозрілі Локації",
"showSuspectedLocationsSubtitle": "Показувати маркери знаку питання для підозрілих сайтів спостереження з даних дозволів комунальних служб",
"lastUpdated": "Останнє Оновлення",
"refreshNow": "Оновити зараз",
"dataSource": "Джерело Даних",
"dataSourceDescription": "Дані дозволів комунальних служб, що вказують на потенційні сайти встановлення інфраструктури спостереження",
"dataSourceCredit": "Збір даних та хостинг надається alprwatch.org",
"minimumDistance": "Мінімальна Відстань від Реальних Вузлів",
"minimumDistanceSubtitle": "Приховати підозрілі локації в межах {}м від існуючих пристроїв спостереження",
"updating": "Оновлення Підозрілих Локацій",
"downloadingAndProcessing": "Завантаження та обробка даних...",
"updateSuccess": "Підозрілі локації успішно оновлено",
"updateFailed": "Не вдалося оновити підозрілі локації",
"neverFetched": "Ніколи не отримувалося",
"daysAgo": "{} днів тому",
"hoursAgo": "{} годин тому",
"minutesAgo": "{} хвилин тому",
"justNow": "Щойно"
},
"suspectedLocation": {
"title": "Підозріла Локація #{}",
"ticketNo": "Номер Квитка",
"address": "Адреса",
"street": "Вулиця",
"city": "Місто",
"state": "Область",
"intersectingStreet": "Перехрещувана Вулиця",
"workDoneFor": "Робота Виконана Для",
"remarks": "Зауваження",
"url": "URL",
"coordinates": "Координати",
"noAddressAvailable": "Адреса недоступна"
},
"units": {
"meters": "м",
"feet": "фут",
"kilometers": "км",
"miles": "миля",
"metersLong": "метри",
"feetLong": "фути",
"kilometersLong": "кілометри",
"milesLong": "милі",
"metric": "Метричні",
"imperial": "Імперські",
"metricDescription": "Метричні (км, м)",
"imperialDescription": "Імперські (миля, фут)"
}
}

View File

@@ -89,7 +89,11 @@
"aboutInfo": "关于 / 信息",
"aboutThisApp": "关于此应用",
"aboutSubtitle": "应用程序信息和鸣谢",
"languageSubtitle": "选择您的首选语言",
"languageSubtitle": "选择您的首选语言和单位",
"distanceUnit": "距离单位",
"distanceUnitSubtitle": "选择公制 (公里/米) 或英制 (英里/英尺) 单位",
"metricUnits": "公制 (公里, 米)",
"imperialUnits": "英制 (英里, 英尺)",
"maxNodes": "最大节点绘制数",
"maxNodesSubtitle": "设置地图上节点数量的上限。",
"maxNodesWarning": "除非您确定有充分的理由,否则您可能不想这样做。",
@@ -119,8 +123,7 @@
"enableNotifications": "启用通知",
"checkingPermissions": "检查权限中...",
"alertDistance": "警报距离:",
"meters": "米",
"rangeInfo": "范围:{}-{} 米(默认:{}"
"rangeInfo": "范围:{}-{} {}(默认:{}"
},
"node": {
"title": "节点 #{}",
@@ -140,8 +143,8 @@
"mustBeLoggedIn": "您必须登录才能提交新节点。请通过设置登录。",
"enableSubmittableProfile": "在设置中启用可提交的配置文件以提交新节点。",
"profileViewOnlyWarning": "此配置文件仅用于地图查看。请选择可提交的配置文件来提交新节点。",
"refineTags": "细化标签",
"refineTagsWithProfile": "细化标签{}"
"loadingAreaData": "正在加载区域数据...提交前请稍候。",
"refineTags": "细化标签"
},
"editNode": {
"title": "编辑节点 #{}",
@@ -155,12 +158,16 @@
"sandboxModeWarning": "无法将生产节点的编辑提交到沙盒。在设置中切换到生产模式以编辑节点。",
"enableSubmittableProfile": "在设置中启用可提交的配置文件以编辑节点。",
"profileViewOnlyWarning": "此配置文件仅用于地图查看。请选择可提交的配置文件来编辑节点。",
"loadingAreaData": "正在加载区域数据...提交前请稍候。",
"cannotMoveConstrainedNode": "无法移动此相机 - 它连接到另一个地图元素OSM way/relation。您仍可以编辑其标签和方向。",
"zoomInRequiredMessage": "请放大至至少第{}级来添加或编辑监控节点。这确保精确定位以便准确制图。",
"extractFromWay": "从way/relation中提取节点",
"extractFromWaySubtitle": "创建具有相同标签的新节点,允许移动到新位置",
"refineTags": "细化标签",
"refineTagsWithProfile": "细化标签({}"
"existingTags": "<现有标签>",
"noChangesDetected": "未检测到更改 - 无需提交",
"noChangesTitle": "无更改可提交",
"noChangesMessage": "您尚未对此节点进行任何更改。要提交编辑,您需要更改位置、配置文件、方向或标签。"
},
"download": {
"title": "下载地图区域",
@@ -174,7 +181,10 @@
"offlineModeWarning": "离线模式下禁用下载。禁用离线模式以下载新区域。",
"areaTooBigMessage": "请放大至至少第{}级来下载离线区域。下载大区域可能导致应用程序无响应。",
"downloadStarted": "下载已开始!正在获取瓦片和节点...",
"downloadFailed": "启动下载失败:{}"
"downloadFailed": "启动下载失败:{}",
"offlineNotPermitted": "{}服务器不允许离线下载。请切换到允许离线使用的瓦片提供商(例如 Bing Maps、Mapbox 或自托管的瓦片服务器)。",
"currentTileProvider": "当前瓦片",
"noTileProviderSelected": "未选择瓦片提供商。请在下载离线区域之前选择地图样式。"
},
"downloadStarted": {
"title": "下载已开始",
@@ -316,12 +326,22 @@
"view": "查看",
"deleteProfile": "删除配置文件",
"deleteProfileConfirm": "您确定要删除 \"{}\" 吗?",
"profileDeleted": "配置文件已删除"
"profileDeleted": "配置文件已删除",
"getMore": "获取更多...",
"addProfileChoice": "添加配置文件",
"addProfileChoiceMessage": "您希望如何添加配置文件?",
"createCustomProfile": "创建自定义配置文件",
"createCustomProfileDescription": "从头开始构建带有您自己标签的配置文件",
"importFromWebsite": "从网站导入",
"importFromWebsiteDescription": "浏览并从 deflock.me/identify 导入配置文件"
},
"mapTiles": {
"title": "地图瓦片",
"manageProviders": "管理提供商",
"attribution": "地图归属"
"attribution": "地图归属",
"mapAttribution": "地图来源:{}",
"couldNotOpenLink": "无法打开链接",
"openLicense": "打开许可证:{}"
},
"profileEditor": {
"viewProfile": "查看配置文件",
@@ -348,7 +368,7 @@
},
"operatorProfileEditor": {
"newOperatorProfile": "新建运营商配置文件",
"editOperatorProfile": "编辑运营商配置文件",
"editOperatorProfile": "编辑运营商配置文件",
"operatorName": "运营商名称",
"operatorNameHint": "例如,奥斯汀警察局",
"operatorNameRequired": "运营商名称为必填项",
@@ -411,7 +431,11 @@
"profileTagsDescription": "为需要细化的标签指定值:",
"selectValue": "选择值...",
"noValue": "(无值)",
"noSuggestions": "无建议可用"
"noSuggestions": "无建议可用",
"existingTagsTitle": "现有标签",
"existingTagsDescription": "编辑此设备上的现有标签。添加、删除或修改任何标签:",
"existingOperator": "<现有运营商>",
"existingOperatorTags": "现有运营商标签"
},
"layerSelector": {
"cannotChangeTileTypes": "在下载离线区域时无法更改瓦片类型",
@@ -446,7 +470,9 @@
"timedOut": "请求超时",
"noData": "无离线数据",
"success": "监控数据已加载",
"nodeDataSlow": "监控数据缓慢"
"nodeDataSlow": "监控数据缓慢",
"rateLimited": "服务器限流",
"networkError": "网络错误"
},
"nodeLimitIndicator": {
"message": "显示 {rendered} / {total} 设备",
@@ -481,13 +507,7 @@
"avoidanceDistance": "回避距离",
"avoidanceDistanceSubtitle": "与监控设备保持的最小距离",
"searchHistory": "最大搜索历史",
"searchHistorySubtitle": "要记住的最近搜索次数",
"units": "单位",
"unitsSubtitle": "距离和测量的显示单位",
"metric": "公制(公里,米)",
"imperial": "英制(英里,英尺)",
"meters": "米",
"feet": "英尺"
"searchHistorySubtitle": "要记住的最近搜索次数"
},
"suspectedLocations": {
"title": "疑似位置",
@@ -506,7 +526,7 @@
"updateFailed": "疑似位置更新失败",
"neverFetched": "从未获取",
"daysAgo": "{}天前",
"hoursAgo": "{}小时前",
"hoursAgo": "{}小时前",
"minutesAgo": "{}分钟前",
"justNow": "刚刚"
},
@@ -514,7 +534,7 @@
"title": "疑似位置 #{}",
"ticketNo": "工单号",
"address": "地址",
"street": "街道",
"street": "街道",
"city": "城市",
"state": "州/省",
"intersectingStreet": "交叉街道",
@@ -523,5 +543,19 @@
"url": "网址",
"coordinates": "坐标",
"noAddressAvailable": "无可用地址"
},
"units": {
"meters": "米",
"feet": "英尺",
"kilometers": "公里",
"miles": "英里",
"metersLong": "米",
"feetLong": "英尺",
"kilometersLong": "公里",
"milesLong": "英里",
"metric": "公制",
"imperial": "英制",
"metricDescription": "公制 (公里, 米)",
"imperialDescription": "英制 (英里, 英尺)"
}
}
}

View File

@@ -14,19 +14,28 @@ import 'screens/release_notes_screen.dart';
import 'screens/osm_account_screen.dart';
import 'screens/upload_queue_screen.dart';
import 'services/localization_service.dart';
import 'services/provider_tile_cache_manager.dart';
import 'services/version_service.dart';
import 'services/deep_link_service.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
// Initialize version service
await VersionService().init();
// Initialize localization service
await LocalizationService.instance.init();
// Resolve platform cache directory for per-provider tile caching
await ProviderTileCacheManager.init();
// Initialize deep link service
await DeepLinkService().init();
DeepLinkService().setNavigatorKey(_navigatorKey);
runApp(
ChangeNotifierProvider(
create: (_) => AppState(),
@@ -68,6 +77,7 @@ class DeFlockApp extends StatelessWidget {
),
useMaterial3: true,
),
navigatorKey: _navigatorKey,
routes: {
'/': (context) => const HomeScreen(),
'/settings': (context) => const SettingsScreen(),
@@ -82,7 +92,11 @@ class DeFlockApp extends StatelessWidget {
'/settings/release-notes': (context) => const ReleaseNotesScreen(),
},
initialRoute: '/',
);
}
}
// Global navigator key for deep link navigation
final GlobalKey<NavigatorState> _navigatorKey = GlobalKey<NavigatorState>();

View File

@@ -1,5 +1,4 @@
import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
@@ -115,6 +114,34 @@ class OneTimeMigrations {
}
}
/// Initialize profile ordering for existing users (v2.7.3)
static Future<void> migrate_2_7_3(AppState appState) async {
try {
final prefs = await SharedPreferences.getInstance();
const orderKey = 'profile_order';
// Check if user already has custom profile ordering
if (prefs.containsKey(orderKey)) {
debugPrint('[Migration] 2.7.3: Profile order already exists, skipping');
return;
}
// Initialize with current profile order (preserves existing UI order)
final currentProfiles = appState.profiles;
final initialOrder = currentProfiles.map((p) => p.id).toList();
if (initialOrder.isNotEmpty) {
await prefs.setStringList(orderKey, initialOrder);
debugPrint('[Migration] 2.7.3: Initialized profile order with ${initialOrder.length} profiles');
}
debugPrint('[Migration] 2.7.3 completed: initialized profile ordering');
} catch (e) {
debugPrint('[Migration] 2.7.3 ERROR: Failed to initialize profile ordering: $e');
// Don't rethrow - this is non-critical, profiles will just use default order
}
}
/// Get the migration function for a specific version
static Future<void> Function(AppState)? getMigrationForVersion(String version) {
switch (version) {
@@ -128,6 +155,8 @@ class OneTimeMigrations {
return migrate_1_8_0;
case '2.1.0':
return migrate_2_1_0;
case '2.7.3':
return migrate_2_7_3;
default:
return null;
}
@@ -147,7 +176,7 @@ class OneTimeMigrations {
debugPrint('[Migration] Stack trace: $stackTrace');
// Nuclear option: clear everything and show non-dismissible error dialog
if (context != null) {
if (context != null && context.mounted) {
NuclearResetDialog.show(context, error, stackTrace);
} else {
// If no context available, just log and hope for the best

View File

@@ -9,7 +9,7 @@ class DirectionFov {
DirectionFov(this.centerDegrees, this.fovDegrees);
@override
String toString() => 'DirectionFov(center: ${centerDegrees}°, fov: ${fovDegrees}°)';
String toString() => 'DirectionFov(center: $centerDegrees°, fov: $fovDegrees°)';
@override
bool operator ==(Object other) =>

View File

@@ -1,4 +1,7 @@
import 'package:uuid/uuid.dart';
import 'osm_node.dart';
/// Sentinel value for copyWith methods to distinguish between null and not provided
const Object _notProvided = Object();
/// A bundle of preset OSM tags that describe a particular surveillance node model/type.
class NodeProfile {
@@ -217,7 +220,7 @@ class NodeProfile {
bool? requiresDirection,
bool? submittable,
bool? editable,
double? fov,
Object? fov = _notProvided,
}) =>
NodeProfile(
id: id ?? this.id,
@@ -227,7 +230,7 @@ class NodeProfile {
requiresDirection: requiresDirection ?? this.requiresDirection,
submittable: submittable ?? this.submittable,
editable: editable ?? this.editable,
fov: fov ?? this.fov,
fov: fov == _notProvided ? this.fov : fov as double?,
);
Map<String, dynamic> toJson() => {
@@ -261,5 +264,53 @@ class NodeProfile {
@override
int get hashCode => id.hashCode;
/// Create a temporary empty profile for editing existing nodes
/// Used as the default `<Existing tags>` option when editing nodes
/// All existing tags will flow through as additionalExistingTags
static NodeProfile createExistingTagsProfile(OsmNode node) {
// Only assign FOV if the original direction string actually contained range notation
// (e.g., "90-270" or "55-125"), not if it was just single directions (e.g., "90")
double? calculatedFov;
final raw = node.tags['direction'] ?? node.tags['camera:direction'];
if (raw != null) {
// Check if any part of the direction string contains range notation (dash with numbers)
final parts = raw.split(';');
bool hasRangeNotation = false;
for (final part in parts) {
final trimmed = part.trim();
// Look for range pattern: numbers-numbers (e.g., "90-270", "55-125")
if (trimmed.contains('-') && RegExp(r'^\d+\.?\d*-\d+\.?\d*$').hasMatch(trimmed)) {
hasRangeNotation = true;
break;
}
}
// Only calculate FOV if the node originally had range notation
if (hasRangeNotation && node.directionFovPairs.isNotEmpty) {
final firstFov = node.directionFovPairs.first.fovDegrees;
// If all directions have the same FOV, use it for the profile
if (node.directionFovPairs.every((df) => df.fovDegrees == firstFov)) {
calculatedFov = firstFov;
}
}
}
return NodeProfile(
id: 'temp-empty-${node.id}',
name: '<Existing tags>', // Will be localized in UI
tags: {}, // Completely empty - all existing tags become additional
builtin: false,
requiresDirection: true,
submittable: true,
editable: false,
fov: calculatedFov, // Only use FOV if original had explicit range notation
);
}
}

View File

@@ -1,4 +1,4 @@
import 'package:uuid/uuid.dart';
import 'osm_node.dart';
/// A bundle of OSM tags that describe a particular surveillance operator.
/// These are applied on top of camera profile tags during submissions.
@@ -76,4 +76,56 @@ class OperatorProfile {
@override
int get hashCode => id.hashCode;
/// Create a temporary operator profile from existing operator tags on a node
/// First tries to match against saved operator profiles, otherwise creates temporary one
/// Used as the default operator profile when editing nodes
static OperatorProfile? createExistingOperatorProfile(OsmNode node, List<OperatorProfile> savedProfiles) {
final operatorTags = _extractOperatorTags(node.tags);
if (operatorTags.isEmpty) return null;
// First, try to find a perfect match among saved profiles
for (final savedProfile in savedProfiles) {
if (_tagsMatch(savedProfile.tags, operatorTags)) {
return savedProfile;
}
}
// No perfect match found, create temporary profile
final operatorName = operatorTags['operator'] ?? '<existing>';
return OperatorProfile(
id: 'temp-existing-operator-${node.id}',
name: operatorName,
tags: operatorTags,
);
}
/// Check if two tag maps are identical
static bool _tagsMatch(Map<String, String> tags1, Map<String, String> tags2) {
if (tags1.length != tags2.length) return false;
for (final entry in tags1.entries) {
if (tags2[entry.key] != entry.value) return false;
}
return true;
}
/// Extract all operator-related tags from a node's tags
static Map<String, String> _extractOperatorTags(Map<String, String> tags) {
final operatorTags = <String, String>{};
for (final entry in tags.entries) {
// Include operator= and any operator:*= tags
if (entry.key == 'operator' || entry.key.startsWith('operator:')) {
operatorTags[entry.key] = entry.value;
}
}
return operatorTags;
}
/// Returns true if this is a temporary "existing operator" profile
bool get isExistingOperatorProfile => id.startsWith('temp-existing-operator-');
}

View File

@@ -107,6 +107,11 @@ class OsmNode {
start = ((start % 360) + 360) % 360;
end = ((end % 360) + 360) % 360;
// Special case: if start equals end, this represents 360° FOV
if (start == end) {
return DirectionFov(start, 360.0);
}
double width, center;
if (start > end) {

View File

@@ -22,6 +22,8 @@ class PendingUpload {
final NodeProfile? profile;
final OperatorProfile? operatorProfile;
final Map<String, String> refinedTags; // User-selected values for empty profile tags
final Map<String, String> additionalExistingTags; // Tags that exist on node but not in profile
final String changesetComment; // User-editable changeset comment
final UploadMode uploadMode; // Capture upload destination when queued
final UploadOperation operation; // Type of operation: create, modify, or delete
final int? originalNodeId; // If this is modify/delete, the ID of the original OSM node
@@ -45,6 +47,8 @@ class PendingUpload {
this.profile,
this.operatorProfile,
Map<String, String>? refinedTags,
Map<String, String>? additionalExistingTags,
required this.changesetComment,
required this.uploadMode,
required this.operation,
this.originalNodeId,
@@ -62,6 +66,7 @@ class PendingUpload {
this.nodeSubmissionAttempts = 0,
this.lastNodeSubmissionAttemptAt,
}) : refinedTags = refinedTags ?? {},
additionalExistingTags = additionalExistingTags ?? {},
assert(
(operation == UploadOperation.create && originalNodeId == null) ||
(operation == UploadOperation.create) || (originalNodeId != null),
@@ -222,7 +227,7 @@ class PendingUpload {
return DateTime.now().isAfter(nextRetryTime);
}
// Get combined tags from node profile, operator profile, and refined tags
// Get combined tags from node profile, operator profile, refined tags, and additional existing tags
Map<String, String> getCombinedTags() {
// Deletions don't need tags
if (operation == UploadOperation.delete || profile == null) {
@@ -231,15 +236,21 @@ class PendingUpload {
final tags = Map<String, String>.from(profile!.tags);
// Add additional existing tags first (these have lower precedence)
tags.addAll(additionalExistingTags);
// Apply profile tags again to ensure they take precedence over additional existing tags
tags.addAll(profile!.tags);
// Apply refined tags (these fill in empty values from the profile)
for (final entry in refinedTags.entries) {
// Only apply refined tags if the profile tag value is empty
if (tags.containsKey(entry.key) && tags[entry.key]?.trim().isEmpty == true) {
if (profile!.tags.containsKey(entry.key) && profile!.tags[entry.key]?.trim().isEmpty == true) {
tags[entry.key] = entry.value;
}
}
// Add operator profile tags (they override node profile tags if there are conflicts)
// Add operator profile tags (they override everything if there are conflicts)
if (operatorProfile != null) {
tags.addAll(operatorProfile!.tags);
}
@@ -269,6 +280,8 @@ class PendingUpload {
'profile': profile?.toJson(),
'operatorProfile': operatorProfile?.toJson(),
'refinedTags': refinedTags,
'additionalExistingTags': additionalExistingTags,
'changesetComment': changesetComment,
'uploadMode': uploadMode.index,
'operation': operation.index,
'originalNodeId': originalNodeId,
@@ -299,6 +312,10 @@ class PendingUpload {
refinedTags: j['refinedTags'] != null
? Map<String, String>.from(j['refinedTags'])
: {}, // Default empty map for legacy entries
additionalExistingTags: j['additionalExistingTags'] != null
? Map<String, String>.from(j['additionalExistingTags'])
: {}, // Default empty map for legacy entries
changesetComment: j['changesetComment'] ?? _generateLegacyComment(j), // Default for legacy entries
uploadMode: j['uploadMode'] != null
? UploadMode.values[j['uploadMode']]
: UploadMode.production, // Default for legacy entries
@@ -338,5 +355,25 @@ class PendingUpload {
if (error) return UploadState.error;
return UploadState.pending;
}
/// Generate a default changeset comment for legacy uploads that don't have one
static String _generateLegacyComment(Map<String, dynamic> j) {
final operation = j['operation'] != null
? UploadOperation.values[j['operation']]
: (j['originalNodeId'] != null ? UploadOperation.modify : UploadOperation.create);
final profileName = j['profile']?['name'] ?? 'surveillance';
switch (operation) {
case UploadOperation.create:
return 'Add $profileName surveillance node';
case UploadOperation.modify:
return 'Update $profileName surveillance node';
case UploadOperation.delete:
return 'Delete $profileName surveillance node';
case UploadOperation.extract:
return 'Extract $profileName surveillance node';
}
}
}

View File

@@ -1,4 +1,5 @@
import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:latlong2/latlong.dart';
/// A suspected surveillance location from the CSV data
@@ -35,8 +36,8 @@ class SuspectedLocation {
bounds = coordinates.bounds;
} catch (e) {
// If GeoJSON parsing fails, use default coordinates
print('[SuspectedLocation] Failed to parse GeoJSON for ticket $ticketNo: $e');
print('[SuspectedLocation] Location string: $locationString');
debugPrint('[SuspectedLocation] Failed to parse GeoJSON for ticket $ticketNo: $e');
debugPrint('[SuspectedLocation] Location string: $locationString');
}
}
@@ -60,7 +61,7 @@ class SuspectedLocation {
// The geoJson IS the geometry object (not wrapped in a 'geometry' property)
final coordinates = geoJson['coordinates'] as List?;
if (coordinates == null || coordinates.isEmpty) {
print('[SuspectedLocation] No coordinates found in GeoJSON');
debugPrint('[SuspectedLocation] No coordinates found in GeoJSON');
return (centroid: const LatLng(0, 0), bounds: <LatLng>[]);
}
@@ -109,7 +110,7 @@ class SuspectedLocation {
}
break;
default:
print('Unsupported geometry type: $type');
debugPrint('Unsupported geometry type: $type');
}
if (points.isEmpty) {
@@ -127,7 +128,7 @@ class SuspectedLocation {
return (centroid: centroid, bounds: points);
} catch (e) {
print('Error extracting coordinates from GeoJSON: $e');
debugPrint('Error extracting coordinates from GeoJSON: $e');
return (centroid: const LatLng(0, 0), bounds: <LatLng>[]);
}
}

View File

@@ -1,6 +1,8 @@
import 'dart:convert';
import 'dart:typed_data';
import '../services/service_policy.dart';
/// A specific tile type within a provider
class TileType {
final String id;
@@ -10,7 +12,7 @@ class TileType {
final Uint8List? previewTile; // Single tile image data for preview
final int maxZoom; // Maximum zoom level for this tile type
const TileType({
TileType({
required this.id,
required this.name,
required this.urlTemplate,
@@ -76,6 +78,15 @@ class TileType {
/// Check if this tile type needs an API key
bool get requiresApiKey => urlTemplate.contains('{api_key}');
/// The service policy that applies to this tile type's server.
/// Cached because [urlTemplate] is immutable.
late final ServicePolicy servicePolicy =
ServicePolicyResolver.resolve(urlTemplate);
/// Whether this tile server's usage policy permits offline/bulk downloading.
/// Resolved via [ServicePolicyResolver] from the URL template.
bool get allowsOfflineDownload => servicePolicy.allowsOfflineDownload;
Map<String, dynamic> toJson() => {
'id': id,
'name': name,

View File

@@ -3,7 +3,6 @@ import 'settings/sections/max_nodes_section.dart';
import 'settings/sections/proximity_alerts_section.dart';
import 'settings/sections/suspected_locations_section.dart';
import 'settings/sections/tile_provider_section.dart';
import 'settings/sections/network_status_section.dart';
import '../services/localization_service.dart';
class AdvancedSettingsScreen extends StatelessWidget {

View File

@@ -138,7 +138,8 @@ class NavigationCoordinator {
// Enter search mode
try {
final center = mapController.mapController.camera.center;
appState.enterSearchMode(center);
final viewbox = mapController.mapController.camera.visibleBounds;
appState.enterSearchMode(center, viewbox: viewbox);
} catch (e) {
debugPrint('[NavigationCoordinator] Could not get map center for search: $e');
// Fallback to default location

View File

@@ -25,6 +25,9 @@ class SheetCoordinator {
// Flag to prevent map bounce when transitioning from tag sheet to edit sheet
bool _transitioningToEdit = false;
// Follow-me state restoration
FollowMeMode? _followMeModeBeforeSheet;
// Getters for accessing heights
double get addSheetHeight => _addSheetHeight;
@@ -88,7 +91,8 @@ class SheetCoordinator {
return;
}
// Disable follow-me when adding a node so the map doesn't jump around
// Save current follow-me mode and disable it while sheet is open
_followMeModeBeforeSheet = appState.followMeMode;
appState.setFollowMeMode(FollowMeMode.off);
appState.startAddSession();
@@ -113,13 +117,15 @@ class SheetCoordinator {
controller.closed.then((_) {
_addSheetHeight = 0.0;
onStateChanged();
// Handle dismissal by canceling session if still active
final appState = context.read<AppState>();
if (appState.session != null) {
debugPrint('[SheetCoordinator] AddNodeSheet dismissed - canceling session');
appState.cancelSession();
}
// Restore follow-me mode that was active before sheet opened
_restoreFollowMeMode(appState);
});
}
@@ -132,7 +138,8 @@ class SheetCoordinator {
}) {
final appState = context.read<AppState>();
// Disable follow-me when editing a node so the map doesn't jump around
// Save current follow-me mode and disable it while sheet is open
_followMeModeBeforeSheet = appState.followMeMode;
appState.setFollowMeMode(FollowMeMode.off);
final session = appState.editSession!; // should be non-null when this is called
@@ -178,13 +185,15 @@ class SheetCoordinator {
_editSheetHeight = 0.0;
_transitioningToEdit = false;
onStateChanged();
// Handle dismissal by canceling session if still active
final appState = context.read<AppState>();
if (appState.editSession != null) {
debugPrint('[SheetCoordinator] EditNodeSheet dismissed - canceling edit session');
appState.cancelEditSession();
}
// Restore follow-me mode that was active before sheet opened
_restoreFollowMeMode(appState);
});
}
@@ -250,4 +259,16 @@ class SheetCoordinator {
_tagSheetHeight = 0.0;
onStateChanged();
}
/// Restore the follow-me mode that was active before opening a node sheet
void _restoreFollowMeMode(AppState appState) {
if (_followMeModeBeforeSheet != null) {
debugPrint('[SheetCoordinator] Restoring follow-me mode: $_followMeModeBeforeSheet');
appState.setFollowMeMode(_followMeModeBeforeSheet!);
_followMeModeBeforeSheet = null; // Clear stored state
}
}
/// Check if any node editing/viewing sheet is currently open
bool get hasActiveNodeSheet => _addSheetHeight > 0 || _editSheetHeight > 0 || _tagSheetHeight > 0;
}

View File

@@ -1,8 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:flutter_map_animations/flutter_map_animations.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:latlong2/latlong.dart';
import 'package:provider/provider.dart';
import '../app_state.dart';
@@ -10,12 +8,9 @@ import '../dev_config.dart';
import '../widgets/map_view.dart';
import '../services/localization_service.dart';
import '../widgets/add_node_sheet.dart';
import '../widgets/edit_node_sheet.dart';
import '../widgets/node_tag_sheet.dart';
import '../widgets/download_area_dialog.dart';
import '../widgets/measured_sheet.dart';
import '../widgets/navigation_sheet.dart';
import '../widgets/search_bar.dart';
import '../widgets/suspected_location_sheet.dart';
import '../widgets/welcome_dialog.dart';
@@ -27,6 +22,7 @@ import '../services/changelog_service.dart';
import 'coordinators/sheet_coordinator.dart';
import 'coordinators/navigation_coordinator.dart';
import 'coordinators/map_interaction_handler.dart';
import 'package:geolocator/geolocator.dart';
class HomeScreen extends StatefulWidget {
const HomeScreen({super.key});
@@ -153,6 +149,33 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
);
}
// Request location permission on first launch
Future<void> _requestLocationPermissionIfFirstLaunch() async {
if (!mounted) return;
try {
// Only request on first launch or if user has never seen welcome
final isFirstLaunch = await ChangelogService().isFirstLaunch();
final hasSeenWelcome = await ChangelogService().hasSeenWelcome();
if (isFirstLaunch || !hasSeenWelcome) {
// Check if location services are enabled
bool serviceEnabled = await Geolocator.isLocationServiceEnabled();
if (!serviceEnabled) {
debugPrint('[HomeScreen] Location services disabled - skipping permission request');
return;
}
// Request location permission (this will show system dialog if needed)
final permission = await Geolocator.requestPermission();
debugPrint('[HomeScreen] First launch location permission result: $permission');
}
} catch (e) {
// Silently handle errors to avoid breaking the app launch
debugPrint('[HomeScreen] Error requesting location permission: $e');
}
}
// Check for and display welcome/changelog popup
Future<void> _checkForPopup() async {
if (!mounted) return;
@@ -162,6 +185,7 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
// Run any needed migrations first
final versionsNeedingMigration = await ChangelogService().getVersionsNeedingMigration();
if (!mounted) return;
for (final version in versionsNeedingMigration) {
await ChangelogService().runMigration(version, appState, context);
}
@@ -178,10 +202,15 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
barrierDismissible: false,
builder: (context) => const WelcomeDialog(),
);
// Request location permission right after welcome dialog on first launch
if (!mounted) return;
await _requestLocationPermissionIfFirstLaunch();
break;
case PopupType.changelog:
final changelogContent = await ChangelogService().getChangelogContentForDisplay();
if (!mounted) return;
if (changelogContent != null) {
await showDialog(
context: context,
@@ -220,35 +249,6 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
);
}
void _zoomAndCenterForRoute(bool followMeEnabled, LatLng? userLocation, LatLng? routeStart) {
try {
LatLng centerLocation;
if (followMeEnabled && userLocation != null) {
// Center on user if follow-me is enabled
centerLocation = userLocation;
debugPrint('[HomeScreen] Centering on user location for route start');
} else if (routeStart != null) {
// Center on start pin if user is far away or no GPS
centerLocation = routeStart;
debugPrint('[HomeScreen] Centering on route start pin');
} else {
debugPrint('[HomeScreen] No valid location to center on');
return;
}
// Animate to zoom 14 and center location
_mapController.animateTo(
dest: centerLocation,
zoom: 14.0,
duration: const Duration(milliseconds: 800),
curve: Curves.easeInOut,
);
} catch (e) {
debugPrint('[HomeScreen] Could not zoom/center for route: $e');
}
}
void _onResumeRoute() {
_navigationCoordinator.resumeRoute(
context: context,
@@ -370,9 +370,11 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
);
// Reset height and clear selection when sheet is dismissed
final appState = context.read<AppState>();
controller.closed.then((_) {
if (!mounted) return;
_sheetCoordinator.resetTagSheetHeight(() => setState(() {}));
context.read<AppState>().clearSuspectedLocationSelection();
appState.clearSuspectedLocationSelection();
});
}
@@ -433,7 +435,7 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
IconButton(
tooltip: _getFollowMeTooltip(appState.followMeMode),
icon: Icon(_getFollowMeIcon(appState.followMeMode)),
onPressed: _mapViewKey.currentState?.hasLocation == true
onPressed: (_mapViewKey.currentState?.hasLocation == true && !_sheetCoordinator.hasActiveNodeSheet)
? () {
final oldMode = appState.followMeMode;
final newMode = _getNextFollowMeMode(oldMode);
@@ -444,7 +446,7 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
_mapViewKey.currentState?.retryLocationInit();
}
}
: null, // Grey out when no location
: null, // Grey out when no location or when node sheet is open
),
AnimatedBuilder(
animation: LocalizationService.instance,
@@ -546,7 +548,7 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Theme.of(context).shadowColor.withOpacity(0.3),
color: Theme.of(context).shadowColor.withValues(alpha: 0.3),
blurRadius: 10,
offset: Offset(0, -2),
)
@@ -576,37 +578,41 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
flex: 3, // 30% for secondary action
child: AnimatedBuilder(
animation: LocalizationService.instance,
builder: (context, child) => FittedBox(
fit: BoxFit.scaleDown,
child: ElevatedButton.icon(
icon: Icon(Icons.download_for_offline),
label: Text(LocalizationService.instance.download),
onPressed: () {
// Check minimum zoom level before opening download dialog
final currentZoom = _mapController.mapController.camera.zoom;
if (currentZoom < kMinZoomForOfflineDownload) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
LocalizationService.instance.t('download.areaTooBigMessage',
params: [kMinZoomForOfflineDownload.toString()])
builder: (context, child) {
final appState = context.watch<AppState>();
final canDownload = appState.selectedTileType?.allowsOfflineDownload ?? false;
return FittedBox(
fit: BoxFit.scaleDown,
child: ElevatedButton.icon(
icon: Icon(Icons.download_for_offline),
label: Text(LocalizationService.instance.download),
onPressed: canDownload ? () {
// Check minimum zoom level before opening download dialog
final currentZoom = _mapController.mapController.camera.zoom;
if (currentZoom < kMinZoomForOfflineDownload) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
LocalizationService.instance.t('download.areaTooBigMessage',
params: [kMinZoomForOfflineDownload.toString()])
),
),
),
);
return;
}
showDialog(
context: context,
builder: (ctx) => DownloadAreaDialog(controller: _mapController.mapController),
);
return;
}
showDialog(
context: context,
builder: (ctx) => DownloadAreaDialog(controller: _mapController.mapController),
);
},
style: ElevatedButton.styleFrom(
minimumSize: Size(0, 48),
textStyle: TextStyle(fontSize: 16),
} : null,
style: ElevatedButton.styleFrom(
minimumSize: Size(0, 48),
textStyle: TextStyle(fontSize: 16),
),
),
),
),
);
},
),
),
],

View File

@@ -1,79 +1,115 @@
import 'package:flutter/material.dart';
import '../services/localization_service.dart';
import '../services/distance_service.dart';
import '../app_state.dart';
import '../state/settings_state.dart';
import 'package:provider/provider.dart';
class NavigationSettingsScreen extends StatelessWidget {
class NavigationSettingsScreen extends StatefulWidget {
const NavigationSettingsScreen({super.key});
@override
State<NavigationSettingsScreen> createState() => _NavigationSettingsScreenState();
}
class _NavigationSettingsScreenState extends State<NavigationSettingsScreen> {
late TextEditingController _distanceController;
@override
void initState() {
super.initState();
final appState = context.read<AppState>();
final displayValue = DistanceService.convertFromMeters(
appState.navigationAvoidanceDistance.toDouble(),
appState.distanceUnit
);
_distanceController = TextEditingController(
text: displayValue.round().toString(),
);
}
@override
void dispose() {
_distanceController.dispose();
super.dispose();
}
void _updateDistance(AppState appState, String value) {
final displayValue = double.tryParse(value) ?? (appState.distanceUnit == DistanceUnit.metric ? 250.0 : 820.0);
final metersValue = DistanceService.convertToMeters(displayValue, appState.distanceUnit, isSmallDistance: true);
appState.setNavigationAvoidanceDistance(metersValue.round().clamp(0, 2000));
}
@override
Widget build(BuildContext context) {
final appState = context.watch<AppState>();
final locService = LocalizationService.instance;
return AnimatedBuilder(
animation: LocalizationService.instance,
builder: (context, child) => Scaffold(
appBar: AppBar(
title: Text(locService.t('navigation.navigationSettings')),
),
body: Padding(
padding: EdgeInsets.fromLTRB(
16,
16,
16,
16 + MediaQuery.of(context).padding.bottom,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ListTile(
leading: const Icon(Icons.social_distance),
title: Text(locService.t('navigation.avoidanceDistance')),
subtitle: Text(locService.t('navigation.avoidanceDistanceSubtitle')),
trailing: SizedBox(
width: 80,
child: TextFormField(
initialValue: appState.navigationAvoidanceDistance.toString(),
keyboardType: const TextInputType.numberWithOptions(signed: false, decimal: false),
textInputAction: TextInputAction.done,
decoration: const InputDecoration(
isDense: true,
contentPadding: EdgeInsets.symmetric(vertical: 6, horizontal: 8),
border: OutlineInputBorder(),
suffixText: 'm',
return Consumer<AppState>(
builder: (context, appState, child) {
// Update the text field when the unit or distance changes
final displayValue = DistanceService.convertFromMeters(
appState.navigationAvoidanceDistance.toDouble(),
appState.distanceUnit
);
if (_distanceController.text != displayValue.round().toString()) {
_distanceController.text = displayValue.round().toString();
}
final locService = LocalizationService.instance;
return AnimatedBuilder(
animation: LocalizationService.instance,
builder: (context, child) {
return Scaffold(
appBar: AppBar(
title: Text(locService.t('navigation.navigationSettings')),
),
body: Padding(
padding: EdgeInsets.fromLTRB(
16,
16,
16,
16 + MediaQuery.of(context).padding.bottom,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ListTile(
leading: const Icon(Icons.social_distance),
title: Text(locService.t('navigation.avoidanceDistance')),
subtitle: Text(locService.t('navigation.avoidanceDistanceSubtitle')),
trailing: SizedBox(
width: 80,
child: TextField(
controller: _distanceController,
keyboardType: const TextInputType.numberWithOptions(signed: false, decimal: false),
textInputAction: TextInputAction.done,
decoration: InputDecoration(
isDense: true,
contentPadding: const EdgeInsets.symmetric(vertical: 6, horizontal: 8),
border: const OutlineInputBorder(),
suffixText: DistanceService.getSmallDistanceUnit(appState.distanceUnit),
),
onSubmitted: (value) => _updateDistance(appState, value),
onEditingComplete: () => _updateDistance(appState, _distanceController.text),
)
)
),
onFieldSubmitted: (value) {
final distance = int.tryParse(value) ?? 250;
appState.setNavigationAvoidanceDistance(distance.clamp(0, 2000));
}
)
)
const Divider(),
_buildDisabledSetting(
context,
icon: Icons.history,
title: locService.t('navigation.searchHistory'),
subtitle: locService.t('navigation.searchHistorySubtitle'),
value: '10 searches',
),
],
),
),
const Divider(),
_buildDisabledSetting(
context,
icon: Icons.history,
title: locService.t('navigation.searchHistory'),
subtitle: locService.t('navigation.searchHistorySubtitle'),
value: '10 searches',
),
const Divider(),
_buildDisabledSetting(
context,
icon: Icons.straighten,
title: locService.t('navigation.units'),
subtitle: locService.t('navigation.unitsSubtitle'),
value: locService.t('navigation.metric'),
),
],
),
),
),
);
},
);
},
);
}
@@ -96,7 +132,7 @@ class NavigationSettingsScreen extends StatelessWidget {
Text(
value,
style: Theme.of(context).textTheme.bodySmall?.copyWith(
color: Theme.of(context).textTheme.bodySmall?.color?.withOpacity(0.6),
color: Theme.of(context).textTheme.bodySmall?.color?.withValues(alpha: 0.6),
),
),
const SizedBox(width: 8),

View File

@@ -55,6 +55,12 @@ class _OperatorProfileEditorState extends State<OperatorProfileEditor> {
return Scaffold(
appBar: AppBar(
title: Text(widget.profile.name.isEmpty ? locService.t('operatorProfileEditor.newOperatorProfile') : locService.t('operatorProfileEditor.editOperatorProfile')),
actions: [
TextButton(
onPressed: _save,
child: Text(locService.t('profileEditor.saveProfile')),
),
],
),
body: ListView(
padding: EdgeInsets.fromLTRB(
@@ -87,10 +93,6 @@ class _OperatorProfileEditorState extends State<OperatorProfileEditor> {
const SizedBox(height: 8),
..._buildTagRows(),
const SizedBox(height: 24),
ElevatedButton(
onPressed: _save,
child: Text(locService.t('profileEditor.saveProfile')),
),
],
),
);
@@ -103,7 +105,6 @@ class _OperatorProfileEditorState extends State<OperatorProfileEditor> {
return List.generate(_tags.length, (i) {
final keyController = TextEditingController(text: _tags[i].key);
final valueController = TextEditingController(text: _tags[i].value);
return Padding(
padding: const EdgeInsets.only(bottom: 8.0),

View File

@@ -275,7 +275,7 @@ class _OSMAccountScreenState extends State<OSMAccountScreen> {
Container(
padding: const EdgeInsets.all(12.0),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surfaceVariant.withOpacity(0.5),
color: Theme.of(context).colorScheme.surfaceContainerHighest.withValues(alpha: 0.5),
borderRadius: BorderRadius.circular(8.0),
),
child: Row(
@@ -308,7 +308,7 @@ class _OSMAccountScreenState extends State<OSMAccountScreen> {
label: Text(locService.t('auth.deleteAccount')),
style: OutlinedButton.styleFrom(
foregroundColor: Theme.of(context).colorScheme.error,
side: BorderSide(color: Theme.of(context).colorScheme.error.withOpacity(0.5)),
side: BorderSide(color: Theme.of(context).colorScheme.error.withValues(alpha: 0.5)),
),
),
),
@@ -354,10 +354,10 @@ class _OSMAccountScreenState extends State<OSMAccountScreen> {
Container(
padding: const EdgeInsets.all(12.0),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.errorContainer.withOpacity(0.1),
color: Theme.of(context).colorScheme.errorContainer.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(8.0),
border: Border.all(
color: Theme.of(context).colorScheme.error.withOpacity(0.3),
color: Theme.of(context).colorScheme.error.withValues(alpha: 0.3),
),
),
child: Text(

View File

@@ -69,6 +69,12 @@ class _ProfileEditorState extends State<ProfileEditor> {
title: Text(!widget.profile.editable
? locService.t('profileEditor.viewProfile')
: (widget.profile.name.isEmpty ? locService.t('profileEditor.newProfile') : locService.t('profileEditor.editProfile'))),
actions: widget.profile.editable ? [
TextButton(
onPressed: _save,
child: Text(locService.t('profileEditor.saveProfile')),
),
] : null,
),
body: ListView(
padding: EdgeInsets.fromLTRB(
@@ -135,11 +141,6 @@ class _ProfileEditorState extends State<ProfileEditor> {
const SizedBox(height: 8),
..._buildTagRows(),
const SizedBox(height: 24),
if (widget.profile.editable)
ElevatedButton(
onPressed: _save,
child: Text(locService.t('profileEditor.saveProfile')),
),
],
),
);
@@ -152,7 +153,6 @@ class _ProfileEditorState extends State<ProfileEditor> {
return List.generate(_tags.length, (i) {
final keyController = TextEditingController(text: _tags[i].key);
final valueController = TextEditingController(text: _tags[i].value);
return Padding(
padding: const EdgeInsets.only(bottom: 8.0),

View File

@@ -99,7 +99,7 @@ class _ReleaseNotesScreenState extends State<ReleaseNotesScreen> {
color: Theme.of(context).colorScheme.primaryContainer,
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: Theme.of(context).colorScheme.primary.withOpacity(0.3),
color: Theme.of(context).colorScheme.primary.withValues(alpha: 0.3),
),
),
child: Row(
@@ -142,8 +142,8 @@ class _ReleaseNotesScreenState extends State<ReleaseNotesScreen> {
decoration: BoxDecoration(
border: Border.all(
color: isCurrentVersion
? Theme.of(context).colorScheme.primary.withOpacity(0.3)
: Theme.of(context).dividerColor.withOpacity(0.3),
? Theme.of(context).colorScheme.primary.withValues(alpha: 0.3)
: Theme.of(context).dividerColor.withValues(alpha: 0.3),
),
borderRadius: BorderRadius.circular(8),
),

View File

@@ -1,6 +1,9 @@
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:provider/provider.dart';
import '../../../services/localization_service.dart';
import '../../../app_state.dart';
import '../../../state/settings_state.dart';
class LanguageSection extends StatefulWidget {
const LanguageSection({super.key});
@@ -20,27 +23,29 @@ class _LanguageSectionState extends State<LanguageSection> {
_loadLanguageNames();
}
_loadSelectedLanguage() async {
Future<void> _loadSelectedLanguage() async {
final prefs = await SharedPreferences.getInstance();
if (!mounted) return;
setState(() {
_selectedLanguage = prefs.getString('language_code');
});
}
_loadLanguageNames() async {
Future<void> _loadLanguageNames() async {
final locService = LocalizationService.instance;
final Map<String, String> names = {};
for (String langCode in locService.availableLanguages) {
names[langCode] = await locService.getLanguageDisplayName(langCode);
}
if (!mounted) return;
setState(() {
_languageNames = names;
});
}
_setLanguage(String? languageCode) async {
Future<void> _setLanguage(String? languageCode) async {
await LocalizationService.instance.setLanguage(languageCode);
setState(() {
_selectedLanguage = languageCode;
@@ -49,43 +54,95 @@ class _LanguageSectionState extends State<LanguageSection> {
@override
Widget build(BuildContext context) {
return AnimatedBuilder(
animation: LocalizationService.instance,
builder: (context, child) {
final locService = LocalizationService.instance;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// System Default option
RadioListTile<String?>(
title: Text(locService.t('settings.systemDefault')),
value: null,
groupValue: _selectedLanguage,
onChanged: _setLanguage,
),
// English always appears second (if available)
if (locService.availableLanguages.contains('en'))
RadioListTile<String>(
title: Text(_languageNames['en'] ?? 'English'),
value: 'en',
groupValue: _selectedLanguage,
onChanged: _setLanguage,
return Consumer<AppState>(
builder: (context, appState, child) {
return AnimatedBuilder(
animation: LocalizationService.instance,
builder: (context, child) {
final locService = LocalizationService.instance;
return SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Language section
RadioGroup<String?>(
groupValue: _selectedLanguage,
onChanged: _setLanguage,
child: Column(
children: [
// System Default option
RadioListTile<String?>(
title: Text(locService.t('settings.systemDefault')),
value: null,
),
// English always appears second (if available)
if (locService.availableLanguages.contains('en'))
RadioListTile<String?>(
title: Text(_languageNames['en'] ?? 'English'),
value: 'en',
),
// Other language options (excluding English since it's already shown)
...locService.availableLanguages
.where((langCode) => langCode != 'en')
.map((langCode) =>
RadioListTile<String?>(
title: Text(_languageNames[langCode] ?? langCode.toUpperCase()),
value: langCode,
),
),
],
),
),
// Divider between language and units
const SizedBox(height: 24),
const Divider(),
const SizedBox(height: 16),
// Distance Units section
Text(
locService.t('settings.distanceUnit'),
style: Theme.of(context).textTheme.titleMedium,
),
const SizedBox(height: 8),
Text(
locService.t('settings.distanceUnitSubtitle'),
style: Theme.of(context).textTheme.bodySmall?.copyWith(
color: Theme.of(context).textTheme.bodySmall?.color?.withValues(alpha: 0.7),
),
),
const SizedBox(height: 8),
RadioGroup<DistanceUnit>(
groupValue: appState.distanceUnit,
onChanged: (unit) {
if (unit != null) {
appState.setDistanceUnit(unit);
}
},
child: Column(
children: [
// Metric option
RadioListTile<DistanceUnit>(
title: Text(locService.t('units.metricDescription')),
value: DistanceUnit.metric,
),
// Imperial option
RadioListTile<DistanceUnit>(
title: Text(locService.t('units.imperialDescription')),
value: DistanceUnit.imperial,
),
],
),
),
],
),
// Other language options (excluding English since it's already shown)
...locService.availableLanguages
.where((langCode) => langCode != 'en')
.map((langCode) =>
RadioListTile<String>(
title: Text(_languageNames[langCode] ?? langCode.toUpperCase()),
value: langCode,
groupValue: _selectedLanguage,
onChanged: _setLanguage,
),
),
],
);
},
);
},
);
}
}
}

View File

@@ -4,6 +4,7 @@ import 'package:provider/provider.dart';
import '../../../app_state.dart';
import '../../../models/node_profile.dart';
import '../../../services/localization_service.dart';
import '../../../widgets/profile_add_choice_dialog.dart';
import '../../profile_editor.dart';
class NodeProfilesSection extends StatelessWidget {
@@ -27,93 +28,107 @@ class NodeProfilesSection extends StatelessWidget {
style: Theme.of(context).textTheme.titleMedium,
),
TextButton.icon(
onPressed: () => Navigator.push(
context,
MaterialPageRoute(
builder: (_) => ProfileEditor(
profile: NodeProfile(
id: const Uuid().v4(),
name: '',
tags: const {},
),
),
),
),
onPressed: () => _showAddProfileDialog(context),
icon: const Icon(Icons.add),
label: Text(locService.t('profiles.newProfile')),
),
],
),
...appState.profiles.map(
(p) => ListTile(
leading: Checkbox(
value: appState.isEnabled(p),
onChanged: (v) => appState.toggleProfile(p, v ?? false),
),
title: Text(p.name),
subtitle: Text(p.builtin ? locService.t('profiles.builtIn') : locService.t('profiles.custom')),
trailing: !p.editable
? PopupMenuButton(
itemBuilder: (context) => [
PopupMenuItem(
value: 'view',
child: Row(
children: [
const Icon(Icons.visibility),
const SizedBox(width: 8),
Text(locService.t('profiles.view')),
],
),
ReorderableListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: appState.profiles.length,
onReorder: (oldIndex, newIndex) {
appState.reorderProfiles(oldIndex, newIndex);
},
itemBuilder: (context, index) {
final p = appState.profiles[index];
return ListTile(
key: ValueKey(p.id),
leading: Row(
mainAxisSize: MainAxisSize.min,
children: [
// Drag handle
ReorderableDragStartListener(
index: index,
child: const Icon(
Icons.drag_handle,
color: Colors.grey,
),
],
onSelected: (value) {
if (value == 'view') {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => ProfileEditor(profile: p),
),
const SizedBox(width: 8),
// Checkbox
Checkbox(
value: appState.isEnabled(p),
onChanged: (v) => appState.toggleProfile(p, v ?? false),
),
],
),
title: Text(p.name),
subtitle: Text(p.builtin ? locService.t('profiles.builtIn') : locService.t('profiles.custom')),
trailing: !p.editable
? PopupMenuButton(
itemBuilder: (context) => [
PopupMenuItem(
value: 'view',
child: Row(
children: [
const Icon(Icons.visibility),
const SizedBox(width: 8),
Text(locService.t('profiles.view')),
],
),
);
}
},
)
: PopupMenuButton(
itemBuilder: (context) => [
PopupMenuItem(
value: 'edit',
child: Row(
children: [
const Icon(Icons.edit),
const SizedBox(width: 8),
Text(locService.t('actions.edit')),
],
),
),
PopupMenuItem(
value: 'delete',
child: Row(
children: [
const Icon(Icons.delete, color: Colors.red),
const SizedBox(width: 8),
Text(locService.t('profiles.deleteProfile'), style: const TextStyle(color: Colors.red)),
],
),
),
],
onSelected: (value) {
if (value == 'edit') {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => ProfileEditor(profile: p),
],
onSelected: (value) {
if (value == 'view') {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => ProfileEditor(profile: p),
),
);
}
},
)
: PopupMenuButton(
itemBuilder: (context) => [
PopupMenuItem(
value: 'edit',
child: Row(
children: [
const Icon(Icons.edit),
const SizedBox(width: 8),
Text(locService.t('actions.edit')),
],
),
);
} else if (value == 'delete') {
_showDeleteProfileDialog(context, p);
}
},
),
),
),
PopupMenuItem(
value: 'delete',
child: Row(
children: [
const Icon(Icons.delete, color: Colors.red),
const SizedBox(width: 8),
Text(locService.t('profiles.deleteProfile'), style: const TextStyle(color: Colors.red)),
],
),
),
],
onSelected: (value) {
if (value == 'edit') {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => ProfileEditor(profile: p),
),
);
} else if (value == 'delete') {
_showDeleteProfileDialog(context, p);
}
},
),
);
},
),
],
);
@@ -121,6 +136,34 @@ class NodeProfilesSection extends StatelessWidget {
);
}
void _showAddProfileDialog(BuildContext context) async {
final result = await showDialog<String?>(
context: context,
builder: (context) => const ProfileAddChoiceDialog(),
);
// If user chose to create custom profile, open the profile editor
if (result == 'create' && context.mounted) {
_createNewProfile(context);
}
// If user chose import from website, ProfileAddChoiceDialog handles opening the URL
}
void _createNewProfile(BuildContext context) {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => ProfileEditor(
profile: NodeProfile(
id: const Uuid().v4(),
name: '',
tags: const {},
),
),
),
);
}
void _showDeleteProfileDialog(BuildContext context, NodeProfile profile) {
final locService = LocalizationService.instance;
final appState = context.read<AppState>();

View File

@@ -87,9 +87,9 @@ class _OfflineAreasSectionState extends State<OfflineAreasSection> {
: "${(area.sizeBytes / 1024).toStringAsFixed(1)} ${locService.t('offlineAreas.kilobytes')}"
: '--';
String subtitle = '${locService.t('offlineAreas.provider')}: ${area.tileProviderDisplay}\n' +
'${locService.t('offlineAreas.maxZoom')}: Z${area.maxZoom}' + '\n' +
'${locService.t('offlineAreas.latitude')}: ${area.bounds.southWest.latitude.toStringAsFixed(3)}, ${area.bounds.southWest.longitude.toStringAsFixed(3)}\n' +
String subtitle = '${locService.t('offlineAreas.provider')}: ${area.tileProviderDisplay}\n'
'${locService.t('offlineAreas.maxZoom')}: Z${area.maxZoom}\n'
'${locService.t('offlineAreas.latitude')}: ${area.bounds.southWest.latitude.toStringAsFixed(3)}, ${area.bounds.southWest.longitude.toStringAsFixed(3)}\n'
'${locService.t('offlineAreas.latitude')}: ${area.bounds.northEast.latitude.toStringAsFixed(3)}, ${area.bounds.northEast.longitude.toStringAsFixed(3)}';
if (area.status == OfflineAreaStatus.downloading) {
@@ -207,7 +207,7 @@ class _OfflineAreasSectionState extends State<OfflineAreasSection> {
: null,
),
);
}).toList(),
}),
],
);
},

View File

@@ -77,27 +77,7 @@ class OfflineModeSection extends StatelessWidget {
onChanged: (value) => _handleOfflineModeChange(context, appState, value),
),
),
const SizedBox(height: 8),
ListTile(
leading: Icon(
Icons.pause_circle_outline,
color: appState.offlineMode
? Theme.of(context).disabledColor
: Theme.of(context).iconTheme.color,
),
title: Text(
locService.t('settings.pauseQueueProcessingSubtitle'),
style: appState.offlineMode
? TextStyle(color: Theme.of(context).disabledColor)
: null,
),
trailing: Switch(
value: appState.pauseQueueProcessing,
onChanged: appState.offlineMode
? null // Disable when offline mode is on
: (value) => appState.setPauseQueueProcessing(value),
),
),
],
);
},

View File

@@ -5,6 +5,8 @@ import 'package:provider/provider.dart';
import '../../../app_state.dart';
import '../../../services/localization_service.dart';
import '../../../services/proximity_alert_service.dart';
import '../../../services/distance_service.dart';
import '../../../state/settings_state.dart';
import '../../../dev_config.dart';
/// Settings section for proximity alerts configuration
@@ -25,8 +27,13 @@ class _ProximityAlertsSectionState extends State<ProximityAlertsSection> {
void initState() {
super.initState();
final appState = context.read<AppState>();
// Convert meters to display units for the text field
final displayValue = DistanceService.convertFromMeters(
appState.proximityAlertDistance.toDouble(),
appState.distanceUnit
);
_distanceController = TextEditingController(
text: appState.proximityAlertDistance.toString(),
text: displayValue.round().toString(),
);
_checkNotificationPermissions();
}
@@ -69,12 +76,18 @@ class _ProximityAlertsSectionState extends State<ProximityAlertsSection> {
void _updateDistance(AppState appState) {
final text = _distanceController.text.trim();
final distance = int.tryParse(text);
if (distance != null) {
appState.setProximityAlertDistance(distance);
final displayValue = double.tryParse(text);
if (displayValue != null) {
// Convert from display units back to meters for storage
final metersValue = DistanceService.convertToMeters(displayValue, appState.distanceUnit, isSmallDistance: true);
appState.setProximityAlertDistance(metersValue.round());
} else {
// Reset to current value if invalid
_distanceController.text = appState.proximityAlertDistance.toString();
final displayValue = DistanceService.convertFromMeters(
appState.proximityAlertDistance.toDouble(),
appState.distanceUnit
);
_distanceController.text = displayValue.round().toString();
}
}
@@ -84,6 +97,15 @@ class _ProximityAlertsSectionState extends State<ProximityAlertsSection> {
builder: (context, appState, child) {
final locService = LocalizationService.instance;
// Update the text field when the unit or distance changes
final displayValue = DistanceService.convertFromMeters(
appState.proximityAlertDistance.toDouble(),
appState.distanceUnit
);
if (_distanceController.text != displayValue.round().toString()) {
_distanceController.text = displayValue.round().toString();
}
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -118,9 +140,9 @@ class _ProximityAlertsSectionState extends State<ProximityAlertsSection> {
Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.orange.withOpacity(0.1),
color: Colors.orange.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(8),
border: Border.all(color: Colors.orange.withOpacity(0.3)),
border: Border.all(color: Colors.orange.withValues(alpha: 0.3)),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -171,49 +193,50 @@ class _ProximityAlertsSectionState extends State<ProximityAlertsSection> {
),
],
// Distance setting (only show when enabled)
if (appState.proximityAlertsEnabled) ...[
const SizedBox(height: 12),
Row(
children: [
Text(locService.t('proximityAlerts.alertDistance')),
SizedBox(
width: 80,
child: TextField(
controller: _distanceController,
keyboardType: const TextInputType.numberWithOptions(signed: true, decimal: true),
textInputAction: TextInputAction.done,
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
],
decoration: const InputDecoration(
isDense: true,
contentPadding: EdgeInsets.symmetric(
horizontal: 8,
vertical: 8,
// Distance setting (only show when enabled)
if (appState.proximityAlertsEnabled) ...[
const SizedBox(height: 12),
Row(
children: [
Text(locService.t('proximityAlerts.alertDistance')),
SizedBox(
width: 80,
child: TextField(
controller: _distanceController,
keyboardType: const TextInputType.numberWithOptions(signed: true, decimal: true),
textInputAction: TextInputAction.done,
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
],
decoration: const InputDecoration(
isDense: true,
contentPadding: EdgeInsets.symmetric(
horizontal: 8,
vertical: 8,
),
border: OutlineInputBorder(),
),
border: OutlineInputBorder(),
onSubmitted: (_) => _updateDistance(appState),
onEditingComplete: () => _updateDistance(appState),
),
onSubmitted: (_) => _updateDistance(appState),
onEditingComplete: () => _updateDistance(appState),
),
),
const SizedBox(width: 8),
Text(locService.t('proximityAlerts.meters')),
],
),
const SizedBox(height: 8),
Text(
locService.t('proximityAlerts.rangeInfo', params: [
kProximityAlertMinDistance.toString(),
kProximityAlertMaxDistance.toString(),
kProximityAlertDefaultDistance.toString(),
]),
style: Theme.of(context).textTheme.bodySmall?.copyWith(
color: Theme.of(context).textTheme.bodySmall?.color?.withOpacity(0.6),
const SizedBox(width: 8),
Text(locService.t('units.${appState.distanceUnit == DistanceUnit.metric ? 'metersLong' : 'feetLong'}')),
],
),
),
],
const SizedBox(height: 8),
Text(
locService.t('proximityAlerts.rangeInfo', params: [
DistanceService.convertFromMeters(kProximityAlertMinDistance.toDouble(), appState.distanceUnit).round().toString(),
DistanceService.convertFromMeters(kProximityAlertMaxDistance.toDouble(), appState.distanceUnit).round().toString(),
locService.t('units.${appState.distanceUnit == DistanceUnit.metric ? 'metersLong' : 'feetLong'}'),
DistanceService.convertFromMeters(kProximityAlertDefaultDistance.toDouble(), appState.distanceUnit).round().toString(),
]),
style: Theme.of(context).textTheme.bodySmall?.copyWith(
color: Theme.of(context).textTheme.bodySmall?.color?.withValues(alpha: 0.6),
),
),
],
],
);
},

View File

@@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../../app_state.dart';
import '../../../services/localization_service.dart';
import '../../../state/settings_state.dart';
class QueueSection extends StatelessWidget {
const QueueSection({super.key});
@@ -112,20 +111,20 @@ class QueueSection extends StatelessWidget {
? Colors.red
: _getUploadModeColor(upload.uploadMode),
),
title: Text(locService.t('queue.cameraWithIndex', params: [(index + 1).toString()]) +
title: Text(locService.t('queue.itemWithIndex', params: [(index + 1).toString()]) +
(upload.error ? locService.t('queue.error') : "") +
(upload.completing ? locService.t('queue.completing') : "")),
subtitle: Text(
locService.t('queue.destination', params: [_getUploadModeDisplayName(upload.uploadMode)]) + '\n' +
locService.t('queue.latitude', params: [upload.coord.latitude.toStringAsFixed(6)]) + '\n' +
locService.t('queue.longitude', params: [upload.coord.longitude.toStringAsFixed(6)]) + '\n' +
locService.t('queue.direction', params: [
upload.direction is String
'${locService.t('queue.destination', params: [_getUploadModeDisplayName(upload.uploadMode)])}\n'
'${locService.t('queue.latitude', params: [upload.coord.latitude.toStringAsFixed(6)])}\n'
'${locService.t('queue.longitude', params: [upload.coord.longitude.toStringAsFixed(6)])}\n'
'${locService.t('queue.direction', params: [
upload.direction is String
? upload.direction.toString()
: upload.direction.round().toString()
]) + '\n' +
locService.t('queue.attempts', params: [upload.attempts.toString()]) +
(upload.error ? "\n${locService.t('queue.uploadFailedRetry')}" : "")
])}\n'
'${locService.t('queue.attempts', params: [upload.attempts.toString()])}'
'${upload.error ? "\n${locService.t('queue.uploadFailedRetry')}" : ""}'
),
trailing: Row(
mainAxisSize: MainAxisSize.min,

View File

@@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../../app_state.dart';
import '../../../services/localization_service.dart';
import '../../../services/distance_service.dart';
import '../../../state/settings_state.dart';
class SuspectedLocationsSection extends StatefulWidget {
const SuspectedLocationsSection({super.key});
@@ -188,22 +190,28 @@ class _SuspectedLocationsSectionState extends State<SuspectedLocationsSection> {
ListTile(
leading: const Icon(Icons.social_distance),
title: Text(locService.t('suspectedLocations.minimumDistance')),
subtitle: Text(locService.t('suspectedLocations.minimumDistanceSubtitle', params: [appState.suspectedLocationMinDistance.toString()])),
subtitle: Text(locService.t('suspectedLocations.minimumDistanceSubtitle', params: [
DistanceService.formatDistance(appState.suspectedLocationMinDistance.toDouble(), appState.distanceUnit)
])),
trailing: SizedBox(
width: 80,
child: TextFormField(
initialValue: appState.suspectedLocationMinDistance.toString(),
initialValue: DistanceService.convertFromMeters(
appState.suspectedLocationMinDistance.toDouble(),
appState.distanceUnit
).round().toString(),
keyboardType: const TextInputType.numberWithOptions(signed: true, decimal: true),
textInputAction: TextInputAction.done,
decoration: const InputDecoration(
decoration: InputDecoration(
isDense: true,
contentPadding: EdgeInsets.symmetric(vertical: 6, horizontal: 8),
border: OutlineInputBorder(),
suffixText: 'm',
contentPadding: const EdgeInsets.symmetric(vertical: 6, horizontal: 8),
border: const OutlineInputBorder(),
suffixText: DistanceService.getSmallDistanceUnit(appState.distanceUnit),
),
onFieldSubmitted: (value) {
final distance = int.tryParse(value) ?? 100;
appState.setSuspectedLocationMinDistance(distance.clamp(0, 1000));
final displayValue = double.tryParse(value) ?? (appState.distanceUnit == DistanceUnit.metric ? 100.0 : 328.0);
final metersValue = DistanceService.convertToMeters(displayValue, appState.distanceUnit, isSmallDistance: true);
appState.setSuspectedLocationMinDistance(metersValue.round().clamp(0, 1000));
},
),
),

View File

@@ -44,7 +44,7 @@ class TileProviderSection extends StatelessWidget {
),
)
else
...providers.map((provider) => _buildProviderTile(context, provider, appState)).toList(),
...providers.map((provider) => _buildProviderTile(context, provider, appState)),
],
);
},
@@ -89,7 +89,7 @@ class TileProviderSection extends StatelessWidget {
leading: CircleAvatar(
backgroundColor: isSelected
? Theme.of(context).colorScheme.primary
: Theme.of(context).colorScheme.surfaceVariant,
: Theme.of(context).colorScheme.surfaceContainerHighest,
child: Icon(
Icons.map,
color: isSelected

View File

@@ -23,6 +23,8 @@ class UploadModeSection extends StatelessWidget {
subtitle: Text(locService.t('uploadMode.subtitle')),
trailing: DropdownButton<UploadMode>(
value: appState.uploadMode,
// This entire section is gated behind kEnableDevelopmentModes
// in osm_account_screen.dart, so all modes are always available here.
items: [
DropdownMenuItem(
value: UploadMode.production,
@@ -81,7 +83,7 @@ class UploadModeSection extends StatelessWidget {
fontSize: 12,
color: appState.pendingCount > 0
? Theme.of(context).disabledColor
: Theme.of(context).colorScheme.onSurface.withOpacity(0.7)
: Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.7)
)
);
case UploadMode.sandbox:
@@ -95,7 +97,6 @@ class UploadModeSection extends StatelessWidget {
),
);
case UploadMode.simulate:
default:
return Text(
locService.t('uploadMode.simulateDescription'),
style: TextStyle(

View File

@@ -102,7 +102,7 @@ class SettingsScreen extends StatelessWidget {
child: Text(
'Version: ${VersionService().version}',
style: Theme.of(context).textTheme.bodySmall?.copyWith(
color: Theme.of(context).textTheme.bodySmall?.color?.withOpacity(0.6),
color: Theme.of(context).textTheme.bodySmall?.color?.withValues(alpha: 0.6),
),
textAlign: TextAlign.center,
),

View File

@@ -1,11 +1,10 @@
import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:http/http.dart' as http;
import 'package:collection/collection.dart';
import '../app_state.dart';
import '../models/tile_provider.dart';
import '../services/http_client.dart';
import '../services/localization_service.dart';
import '../dev_config.dart';
@@ -408,6 +407,7 @@ class _TileTypeDialogState extends State<_TileTypeDialog> {
_isLoadingPreview = true;
});
final client = UserAgentClient();
try {
// Create a temporary TileType to use the getTileUrl method
final tempTileType = TileType(
@@ -416,21 +416,21 @@ class _TileTypeDialogState extends State<_TileTypeDialog> {
urlTemplate: _urlController.text.trim(),
attribution: 'Preview',
);
final url = tempTileType.getTileUrl(
kPreviewTileZoom,
kPreviewTileX,
kPreviewTileY,
apiKey: null, // Don't use API key for preview
);
final response = await http.get(Uri.parse(url));
final response = await client.get(Uri.parse(url));
if (response.statusCode == 200) {
setState(() {
_previewTile = response.bodyBytes;
});
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(locService.t('tileTypeEditor.previewTileLoaded'))),
@@ -446,6 +446,7 @@ class _TileTypeDialogState extends State<_TileTypeDialog> {
);
}
} finally {
client.close();
setState(() {
_isLoadingPreview = false;
});

View File

@@ -3,7 +3,6 @@ import 'package:provider/provider.dart';
import '../app_state.dart';
import '../models/pending_upload.dart';
import '../services/localization_service.dart';
import '../state/settings_state.dart';
class UploadQueueScreen extends StatelessWidget {
const UploadQueueScreen({super.key});
@@ -114,8 +113,8 @@ class UploadQueueScreen extends StatelessWidget {
margin: const EdgeInsets.only(bottom: 16),
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.orange.withOpacity(0.1),
border: Border.all(color: Colors.orange.withOpacity(0.3)),
color: Colors.orange.withValues(alpha: 0.1),
border: Border.all(color: Colors.orange.withValues(alpha: 0.3)),
borderRadius: BorderRadius.circular(8),
),
child: Row(
@@ -148,6 +147,31 @@ class UploadQueueScreen extends StatelessWidget {
],
),
),
// Pause Upload Queue Toggle
ListTile(
leading: Icon(
Icons.pause_circle_outline,
color: appState.offlineMode
? Theme.of(context).disabledColor
: Theme.of(context).iconTheme.color,
),
title: Text(locService.t('settings.pauseQueueProcessing')),
subtitle: Text(
locService.t('settings.pauseQueueProcessingSubtitle'),
style: appState.offlineMode
? TextStyle(color: Theme.of(context).disabledColor)
: null,
),
trailing: Switch(
value: appState.pauseQueueProcessing,
onChanged: appState.offlineMode
? null // Disable when offline mode is on
: (value) => appState.setPauseQueueProcessing(value),
),
),
const SizedBox(height: 16),
// Clear Upload Queue button - always visible
SizedBox(
width: double.infinity,
@@ -180,7 +204,7 @@ class UploadQueueScreen extends StatelessWidget {
icon: const Icon(Icons.clear_all),
label: Text(locService.t('queue.clearUploadQueue')),
style: ElevatedButton.styleFrom(
backgroundColor: appState.pendingCount > 0 ? null : Theme.of(context).disabledColor.withOpacity(0.1),
backgroundColor: appState.pendingCount > 0 ? null : Theme.of(context).disabledColor.withValues(alpha: 0.1),
),
),
),
@@ -199,13 +223,13 @@ class UploadQueueScreen extends StatelessWidget {
Icon(
Icons.check_circle_outline,
size: 64,
color: Theme.of(context).textTheme.bodySmall?.color?.withOpacity(0.4),
color: Theme.of(context).textTheme.bodySmall?.color?.withValues(alpha: 0.4),
),
const SizedBox(height: 16),
Text(
locService.t('queue.nothingInQueue'),
style: Theme.of(context).textTheme.titleMedium?.copyWith(
color: Theme.of(context).textTheme.bodySmall?.color?.withOpacity(0.6),
color: Theme.of(context).textTheme.bodySmall?.color?.withValues(alpha: 0.6),
),
textAlign: TextAlign.center,
),
@@ -247,16 +271,16 @@ class UploadQueueScreen extends StatelessWidget {
_getUploadStateText(upload, locService)
),
subtitle: Text(
locService.t('queue.destination', params: [_getUploadModeDisplayName(upload.uploadMode)]) + '\n' +
locService.t('queue.latitude', params: [upload.coord.latitude.toStringAsFixed(6)]) + '\n' +
locService.t('queue.longitude', params: [upload.coord.longitude.toStringAsFixed(6)]) + '\n' +
locService.t('queue.direction', params: [
upload.direction is String
'${locService.t('queue.destination', params: [_getUploadModeDisplayName(upload.uploadMode)])}\n'
'${locService.t('queue.latitude', params: [upload.coord.latitude.toStringAsFixed(6)])}\n'
'${locService.t('queue.longitude', params: [upload.coord.longitude.toStringAsFixed(6)])}\n'
'${locService.t('queue.direction', params: [
upload.direction is String
? upload.direction.toString()
: upload.direction.round().toString()
]) + '\n' +
locService.t('queue.attempts', params: [upload.attempts.toString()]) +
(upload.uploadState == UploadState.error ? "\n${locService.t('queue.uploadFailedRetry')}" : "")
])}\n'
'${locService.t('queue.attempts', params: [upload.attempts.toString()])}'
'${upload.uploadState == UploadState.error ? "\n${locService.t('queue.uploadFailedRetry')}" : ""}'
),
trailing: Row(
mainAxisSize: MainAxisSize.min,

View File

@@ -1,15 +1,15 @@
import 'dart:convert';
import 'dart:developer';
import 'dart:math' as math;
import 'package:flutter/foundation.dart';
import 'package:oauth2_client/oauth2_client.dart';
import 'package:oauth2_client/oauth2_helper.dart';
import 'package:http/http.dart' as http;
import 'package:shared_preferences/shared_preferences.dart';
/// Handles PKCE OAuth login with OpenStreetMap.
import '../keys.dart';
import '../app_state.dart' show UploadMode;
import 'http_client.dart';
class AuthService {
// Both client IDs from keys.dart
@@ -30,13 +30,13 @@ class AuthService {
case UploadMode.sandbox:
return 'osm_token_sandbox';
case UploadMode.simulate:
default:
return 'osm_token_simulate';
}
}
void setUploadMode(UploadMode mode) {
_mode = mode;
if (mode == UploadMode.simulate || !kHasOsmSecrets) return;
final isSandbox = (mode == UploadMode.sandbox);
final authBase = isSandbox
? 'https://master.apis.dev.openstreetmap.org'
@@ -97,10 +97,10 @@ class AuthService {
final tokenJson = jsonEncode(tokenMap);
final prefs = await SharedPreferences.getInstance();
await prefs.setString(_tokenKey, tokenJson); // Save token for current mode
_displayName = await _fetchUsername(token!.accessToken!);
_displayName = await _fetchUsername(token.accessToken!);
return _displayName;
} catch (e) {
print('AuthService: OAuth login failed: $e');
debugPrint('AuthService: OAuth login failed: $e');
log('OAuth login failed: $e');
rethrow;
}
@@ -128,7 +128,7 @@ class AuthService {
_displayName = await _fetchUsername(accessToken);
return _displayName;
} catch (e) {
print('AuthService: Error restoring login with stored token: $e');
debugPrint('AuthService: Error restoring login with stored token: $e');
log('Error restoring login with stored token: $e');
// Token might be expired or invalid, clear it
await logout();
@@ -151,7 +151,9 @@ class AuthService {
// Force a fresh login by clearing stored tokens
Future<String?> forceLogin() async {
await _helper.removeAllTokens();
if (_mode != UploadMode.simulate) {
await _helper.removeAllTokens();
}
_displayName = null;
return await login();
}
@@ -179,9 +181,11 @@ class AuthService {
: 'https://api.openstreetmap.org';
}
final _client = UserAgentClient();
Future<String?> _fetchUsername(String accessToken) async {
try {
final resp = await http.get(
final resp = await _client.get(
Uri.parse('$_apiHost/api/0.6/user/details.json'),
headers: {'Authorization': 'Bearer $accessToken'},
);
@@ -194,7 +198,7 @@ class AuthService {
final displayName = userData['user']?['display_name'];
return displayName;
} catch (e) {
print('AuthService: Error fetching username: $e');
debugPrint('AuthService: Error fetching username: $e');
log('Error fetching username: $e');
return null;
}

View File

@@ -1,5 +1,4 @@
import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:shared_preferences/shared_preferences.dart';
@@ -226,6 +225,10 @@ class ChangelogService {
versionsNeedingMigration.add('1.6.3');
}
if (needsMigration(lastSeenVersion, currentVersion, '2.7.3')) {
versionsNeedingMigration.add('2.7.3');
}
// Future versions can be added here
// if (needsMigration(lastSeenVersion, currentVersion, '2.0.0')) {
// versionsNeedingMigration.add('2.0.0');
@@ -304,8 +307,8 @@ class ChangelogService {
final v2Parts = v2.split('.').map(int.parse).toList();
// Ensure we have at least 3 parts (major.minor.patch)
while (v1Parts.length < 3) v1Parts.add(0);
while (v2Parts.length < 3) v2Parts.add(0);
while (v1Parts.length < 3) { v1Parts.add(0); }
while (v2Parts.length < 3) { v2Parts.add(0); }
// Compare major version first
if (v1Parts[0] < v2Parts[0]) return -1;

View File

@@ -0,0 +1,156 @@
import 'dart:async';
import 'package:app_links/app_links.dart';
import 'package:flutter/material.dart';
import '../models/node_profile.dart';
import 'profile_import_service.dart';
import '../screens/profile_editor.dart';
class DeepLinkService {
static final DeepLinkService _instance = DeepLinkService._internal();
factory DeepLinkService() => _instance;
DeepLinkService._internal();
late AppLinks _appLinks;
StreamSubscription<Uri>? _linkSubscription;
/// Initialize deep link handling (sets up stream listener only)
Future<void> init() async {
_appLinks = AppLinks();
// Set up stream listener for links when app is already running
_linkSubscription = _appLinks.uriLinkStream.listen(
_processLink,
onError: (err) {
debugPrint('[DeepLinkService] Link stream error: $err');
},
);
}
/// Process a deep link
void _processLink(Uri uri) {
debugPrint('[DeepLinkService] Processing deep link: $uri');
// Only handle deflockapp scheme
if (uri.scheme != 'deflockapp') {
debugPrint('[DeepLinkService] Ignoring non-deflockapp scheme: ${uri.scheme}');
return;
}
// Route based on path
switch (uri.host) {
case 'profiles':
_handleProfilesLink(uri);
break;
case 'auth':
// OAuth links are handled by flutter_web_auth_2
debugPrint('[DeepLinkService] OAuth link handled by flutter_web_auth_2');
break;
default:
debugPrint('[DeepLinkService] Unknown deep link host: ${uri.host}');
}
}
/// Check for initial link after app is fully ready
Future<void> checkInitialLink() async {
debugPrint('[DeepLinkService] Checking for initial link...');
try {
final initialLink = await _appLinks.getInitialLink();
if (initialLink != null) {
debugPrint('[DeepLinkService] Found initial link: $initialLink');
_processLink(initialLink);
} else {
debugPrint('[DeepLinkService] No initial link found');
}
} catch (e) {
debugPrint('[DeepLinkService] Failed to get initial link: $e');
}
}
/// Handle profile-related deep links
void _handleProfilesLink(Uri uri) {
final segments = uri.pathSegments;
if (segments.isEmpty) {
debugPrint('[DeepLinkService] No path segments in profiles link');
return;
}
switch (segments[0]) {
case 'add':
_handleAddProfileLink(uri);
break;
default:
debugPrint('[DeepLinkService] Unknown profiles path: ${segments[0]}');
}
}
/// Handle profile add deep link: `deflockapp://profiles/add?p=<base64>`
void _handleAddProfileLink(Uri uri) {
final base64Data = uri.queryParameters['p'];
if (base64Data == null || base64Data.isEmpty) {
_showError('Invalid profile link: missing profile data');
return;
}
// Parse profile from base64
final profile = ProfileImportService.parseProfileFromBase64(base64Data);
if (profile == null) {
_showError('Invalid profile data');
return;
}
// Navigate to profile editor with the imported profile
_navigateToProfileEditor(profile);
}
/// Navigate to profile editor with pre-filled profile data
void _navigateToProfileEditor(NodeProfile profile) {
final context = _navigatorKey?.currentContext;
if (context == null) {
debugPrint('[DeepLinkService] No navigator context available');
return;
}
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => ProfileEditor(profile: profile),
),
);
}
/// Show error message to user
void _showError(String message) {
final context = _navigatorKey?.currentContext;
if (context == null) {
debugPrint('[DeepLinkService] Error (no context): $message');
return;
}
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(message),
backgroundColor: Colors.red,
),
);
}
/// Global navigator key for navigation
GlobalKey<NavigatorState>? _navigatorKey;
/// Set the global navigator key
void setNavigatorKey(GlobalKey<NavigatorState> navigatorKey) {
_navigatorKey = navigatorKey;
}
/// Clean up resources
void dispose() {
_linkSubscription?.cancel();
}
}

View File

@@ -1,158 +1,471 @@
import 'dart:async';
import 'dart:io';
import 'dart:ui';
import 'package:flutter_map/flutter_map.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
import 'dart:async';
import 'dart:typed_data';
import 'dart:ui';
import 'package:http/http.dart';
import 'package:http/retry.dart';
import '../app_state.dart';
import '../models/tile_provider.dart' as models;
import 'map_data_provider.dart';
import 'http_client.dart';
import 'map_data_submodules/tiles_from_local.dart';
import 'offline_area_service.dart';
/// Custom tile provider that integrates with DeFlock's offline/online architecture.
///
/// This replaces the complex HTTP interception approach with a clean TileProvider
/// implementation that directly interfaces with our MapDataProvider system.
class DeflockTileProvider extends TileProvider {
final MapDataProvider _mapDataProvider = MapDataProvider();
/// Thrown when a tile load is cancelled (tile scrolled off screen).
/// TileLayerManager skips retry for these — the tile is already gone.
class TileLoadCancelledException implements Exception {
const TileLoadCancelledException();
}
/// Thrown when a tile is not available offline (no offline area or cache hit).
/// TileLayerManager skips retry for these — retrying won't help without network.
class TileNotAvailableOfflineException implements Exception {
const TileNotAvailableOfflineException();
}
/// Custom tile provider that extends NetworkTileProvider to leverage its
/// built-in disk cache, RetryClient, ETag revalidation, and abort support,
/// while routing URLs through our TileType logic and supporting offline tiles.
///
/// Each instance is configured for a specific tile provider/type combination
/// with frozen config — no AppState lookups at request time (except for the
/// global offlineMode toggle).
///
/// Two runtime paths:
/// 1. **Common path** (no offline areas for current provider): delegates to
/// super.getImageWithCancelLoadingSupport() — full NetworkTileImageProvider
/// pipeline (disk cache, ETag revalidation, RetryClient, abort support).
/// 2. **Offline-first path** (has offline areas or offline mode): returns
/// DeflockOfflineTileImageProvider — checks disk cache and local tiles
/// first, falls back to HTTP via shared RetryClient on miss.
class DeflockTileProvider extends NetworkTileProvider {
/// The shared HTTP client we own. We keep a reference because
/// NetworkTileProvider._httpClient is private and _isInternallyCreatedClient
/// will be false (we passed it in), so super.dispose() won't close it.
final Client _sharedHttpClient;
/// Frozen config for this provider instance.
final String providerId;
final models.TileType tileType;
final String? apiKey;
/// Opaque fingerprint of the config this provider was created with.
/// Used by [TileLayerManager] to detect config drift after edits.
final String configFingerprint;
/// Caching provider for the offline-first path. The same instance is passed
/// to super for the common path — we keep a reference here so we can also
/// use it in [DeflockOfflineTileImageProvider].
final MapCachingProvider? _cachingProvider;
/// Called when a tile loads successfully via the network in the offline-first
/// path. Used by [TileLayerManager] to reset exponential backoff.
VoidCallback? onNetworkSuccess;
// ignore: use_super_parameters
DeflockTileProvider._({
required Client httpClient,
required this.providerId,
required this.tileType,
this.apiKey,
MapCachingProvider? cachingProvider,
this.onNetworkSuccess,
this.configFingerprint = '',
}) : _sharedHttpClient = httpClient,
_cachingProvider = cachingProvider,
super(
httpClient: httpClient,
cachingProvider: cachingProvider,
// Let errors propagate so flutter_map marks tiles as failed
// (loadError = true) rather than caching transparent images as
// "successfully loaded". The TileLayerManager wires a reset stream
// that retries failed tiles after a debounced delay.
silenceExceptions: false,
);
factory DeflockTileProvider({
required String providerId,
required models.TileType tileType,
String? apiKey,
MapCachingProvider? cachingProvider,
VoidCallback? onNetworkSuccess,
String configFingerprint = '',
}) {
final client = UserAgentClient(RetryClient(Client()));
return DeflockTileProvider._(
httpClient: client,
providerId: providerId,
tileType: tileType,
apiKey: apiKey,
cachingProvider: cachingProvider,
onNetworkSuccess: onNetworkSuccess,
configFingerprint: configFingerprint,
);
}
@override
ImageProvider getImage(TileCoordinates coordinates, TileLayer options) {
// Get current provider info to include in cache key
final appState = AppState.instance;
final providerId = appState.selectedTileProvider?.id ?? 'unknown';
final tileTypeId = appState.selectedTileType?.id ?? 'unknown';
return DeflockTileImageProvider(
String getTileUrl(TileCoordinates coordinates, TileLayer options) {
return tileType.getTileUrl(
coordinates.z,
coordinates.x,
coordinates.y,
apiKey: apiKey,
);
}
@override
ImageProvider getImageWithCancelLoadingSupport(
TileCoordinates coordinates,
TileLayer options,
Future<void> cancelLoading,
) {
if (!_shouldCheckOfflineCache(coordinates.z)) {
// Common path: no offline areas — delegate to NetworkTileProvider's
// full pipeline (disk cache, ETag, RetryClient, abort support).
return super.getImageWithCancelLoadingSupport(
coordinates,
options,
cancelLoading,
);
}
// Offline-first path: check local tiles first, fall back to network.
return DeflockOfflineTileImageProvider(
coordinates: coordinates,
options: options,
mapDataProvider: _mapDataProvider,
httpClient: _sharedHttpClient,
headers: headers,
cancelLoading: cancelLoading,
isOfflineOnly: AppState.instance.offlineMode,
providerId: providerId,
tileTypeId: tileTypeId,
tileTypeId: tileType.id,
tileUrl: getTileUrl(coordinates, options),
cachingProvider: _cachingProvider,
onNetworkSuccess: onNetworkSuccess,
);
}
/// Determine if we should check offline cache for this tile request.
/// Only returns true if:
/// 1. We're in offline mode (forced), OR
/// 2. We have offline areas for the current provider/type
///
/// This avoids the offline-first path (and its filesystem searches) when
/// browsing online with providers that have no offline areas.
bool _shouldCheckOfflineCache(int zoom) {
// Always use offline path in offline mode
if (AppState.instance.offlineMode) {
return true;
}
// For online mode, only use offline path if we have relevant offline data
// at this zoom level — tiles outside any area's zoom range go through the
// common NetworkTileProvider path for better performance.
final offlineService = OfflineAreaService();
return offlineService.hasOfflineAreasForProviderAtZoom(
providerId,
tileType.id,
zoom,
);
}
@override
Future<void> dispose() async {
// Only call super — do NOT close _sharedHttpClient here.
// flutter_map calls dispose() whenever the TileLayer widget is recycled
// (e.g. provider switch causes a new FlutterMap key), but
// TileLayerManager caches and reuses provider instances across switches.
// Closing the HTTP client here would leave the cached instance broken —
// all future tile requests would fail with "Client closed".
//
// Since we passed our own httpClient to NetworkTileProvider,
// _isInternallyCreatedClient is false, so super.dispose() won't close it
// either. The client is closed in [shutdown], called by
// TileLayerManager.dispose() when the map is truly torn down.
await super.dispose();
}
/// Permanently close the HTTP client. Called by [TileLayerManager.dispose]
/// when the map widget is being torn down — NOT by flutter_map's widget
/// recycling.
void shutdown() {
_sharedHttpClient.close();
}
}
/// Image provider that fetches tiles through our MapDataProvider.
///
/// This handles the actual tile fetching using our existing offline/online
/// routing logic without any HTTP interception complexity.
class DeflockTileImageProvider extends ImageProvider<DeflockTileImageProvider> {
/// Image provider for the offline-first path.
///
/// Checks disk cache and offline areas before falling back to the network.
/// Caches successful network fetches to disk so panning back doesn't re-fetch.
/// On cancellation, lets in-flight downloads complete and caches the result
/// (fire-and-forget) instead of discarding downloaded bytes.
///
/// **Online mode flow:**
/// 1. Disk cache (fast hash-based file read) → hit + fresh → return
/// 2. Offline areas (file scan) → hit → return
/// 3. Network fetch with conditional headers from stale cache entry
/// 4. On cancel → fire-and-forget cache write for the in-flight download
/// 5. On 304 → return stale cached bytes, update cache metadata
/// 6. On 200 → cache to disk, decode and return
/// 7. On error → throw (flutter_map marks tile as failed)
///
/// **Offline mode flow:**
/// 1. Offline areas (primary source — guaranteed available)
/// 2. Disk cache (tiles cached from previous online sessions)
/// 3. Throw if both miss (flutter_map marks tile as failed)
class DeflockOfflineTileImageProvider
extends ImageProvider<DeflockOfflineTileImageProvider> {
final TileCoordinates coordinates;
final TileLayer options;
final MapDataProvider mapDataProvider;
final Client httpClient;
final Map<String, String> headers;
final Future<void> cancelLoading;
final bool isOfflineOnly;
final String providerId;
final String tileTypeId;
const DeflockTileImageProvider({
final String tileUrl;
final MapCachingProvider? cachingProvider;
final VoidCallback? onNetworkSuccess;
const DeflockOfflineTileImageProvider({
required this.coordinates,
required this.options,
required this.mapDataProvider,
required this.httpClient,
required this.headers,
required this.cancelLoading,
required this.isOfflineOnly,
required this.providerId,
required this.tileTypeId,
required this.tileUrl,
this.cachingProvider,
this.onNetworkSuccess,
});
@override
Future<DeflockTileImageProvider> obtainKey(ImageConfiguration configuration) {
return SynchronousFuture<DeflockTileImageProvider>(this);
Future<DeflockOfflineTileImageProvider> obtainKey(
ImageConfiguration configuration) {
return SynchronousFuture<DeflockOfflineTileImageProvider>(this);
}
@override
ImageStreamCompleter loadImage(DeflockTileImageProvider key, ImageDecoderCallback decode) {
ImageStreamCompleter loadImage(
DeflockOfflineTileImageProvider key, ImageDecoderCallback decode) {
final chunkEvents = StreamController<ImageChunkEvent>();
return MultiFrameImageStreamCompleter(
codec: _loadAsync(key, decode, chunkEvents),
// Chain whenComplete into the codec future so there's a single future
// for MultiFrameImageStreamCompleter to handle. Without this, the
// whenComplete creates an orphaned future whose errors go unhandled.
codec: _loadAsync(key, decode, chunkEvents).whenComplete(() {
chunkEvents.close();
}),
chunkEvents: chunkEvents.stream,
scale: 1.0,
);
}
/// Try to read a tile from the disk cache. Returns null on miss or error.
Future<CachedMapTile?> _getCachedTile() async {
if (cachingProvider == null || !cachingProvider!.isSupported) return null;
try {
return await cachingProvider!.getTile(tileUrl);
} on CachedMapTileReadFailure {
return null;
} catch (_) {
return null;
}
}
/// Write a tile to the disk cache (best-effort, never throws).
void _putCachedTile({
required Map<String, String> responseHeaders,
Uint8List? bytes,
}) {
if (cachingProvider == null || !cachingProvider!.isSupported) return;
try {
final metadata = CachedMapTileMetadata.fromHttpHeaders(responseHeaders);
cachingProvider!
.putTile(url: tileUrl, metadata: metadata, bytes: bytes)
.catchError((_) {});
} catch (_) {
// Best-effort: never fail the tile load due to cache write errors.
}
}
Future<Codec> _loadAsync(
DeflockTileImageProvider key,
DeflockOfflineTileImageProvider key,
ImageDecoderCallback decode,
StreamController<ImageChunkEvent> chunkEvents,
) async {
Future<Codec> decodeBytes(Uint8List bytes) =>
ImmutableBuffer.fromUint8List(bytes).then(decode);
// Track cancellation synchronously via Completer so the catch block
// can reliably check it without microtask ordering races.
final cancelled = Completer<void>();
cancelLoading.then((_) {
if (!cancelled.isCompleted) cancelled.complete();
}).ignore();
try {
// Get current tile provider and type from app state
final appState = AppState.instance;
final selectedProvider = appState.selectedTileProvider;
final selectedTileType = appState.selectedTileType;
if (selectedProvider == null || selectedTileType == null) {
throw Exception('No tile provider configured');
if (isOfflineOnly) {
return await _loadOffline(decodeBytes, cancelled);
}
// Smart cache routing: only check offline cache when needed
final MapSource source = _shouldCheckOfflineCache(appState)
? MapSource.auto // Check offline first, then network
: MapSource.remote; // Skip offline cache, go directly to network
final tileBytes = await mapDataProvider.getTile(
z: coordinates.z,
x: coordinates.x,
y: coordinates.y,
source: source,
);
// Decode the image bytes
final buffer = await ImmutableBuffer.fromUint8List(Uint8List.fromList(tileBytes));
return await decode(buffer);
return await _loadOnline(decodeBytes, cancelled);
} catch (e) {
// Don't log routine offline misses to avoid console spam
if (!e.toString().contains('offline mode is enabled')) {
debugPrint('[DeflockTileProvider] Failed to load tile ${coordinates.z}/${coordinates.x}/${coordinates.y}: $e');
// Cancelled tiles throw — flutter_map handles the error silently.
// Preserve TileNotAvailableOfflineException even if the tile was also
// cancelled — it has distinct semantics (genuine cache miss) that
// matter for diagnostics and future UI indicators.
if (cancelled.isCompleted && e is! TileNotAvailableOfflineException) {
throw const TileLoadCancelledException();
}
// Re-throw the exception and let FlutterMap handle missing tiles gracefully
// This is better than trying to provide fallback images
throw e;
// Let real errors propagate so flutter_map marks loadError = true
rethrow;
}
}
/// Online mode: disk cache → offline areas → network (with caching).
Future<Codec> _loadOnline(
Future<Codec> Function(Uint8List) decodeBytes,
Completer<void> cancelled,
) async {
// 1. Check disk cache — fast hash-based file read.
final cachedTile = await _getCachedTile();
if (cachedTile != null && !cachedTile.metadata.isStale) {
return await decodeBytes(cachedTile.bytes);
}
// 2. Check offline areas — file scan per area.
try {
final localBytes = await fetchLocalTile(
z: coordinates.z,
x: coordinates.x,
y: coordinates.y,
providerId: providerId,
tileTypeId: tileTypeId,
);
return await decodeBytes(Uint8List.fromList(localBytes));
} catch (_) {
// Local miss — fall through to network
}
// 3. If cancelled before network, bail.
if (cancelled.isCompleted) throw const TileLoadCancelledException();
// 4. Network fetch with conditional headers from stale cache entry.
final request = Request('GET', Uri.parse(tileUrl));
request.headers.addAll(headers);
if (cachedTile != null) {
if (cachedTile.metadata.lastModified case final lastModified?) {
request.headers[HttpHeaders.ifModifiedSinceHeader] =
HttpDate.format(lastModified);
}
if (cachedTile.metadata.etag case final etag?) {
request.headers[HttpHeaders.ifNoneMatchHeader] = etag;
}
}
// 5. Race the download against cancelLoading.
final networkFuture = httpClient.send(request).then((response) async {
final bytes = await response.stream.toBytes();
return (
statusCode: response.statusCode,
bytes: bytes,
headers: response.headers,
);
});
final result = await Future.any([
networkFuture,
cancelLoading.then((_) => (
statusCode: 0,
bytes: Uint8List(0),
headers: <String, String>{},
)),
]);
// 6. On cancel — fire-and-forget cache write for the in-flight download
// instead of discarding the downloaded bytes.
if (cancelled.isCompleted || result.statusCode == 0) {
networkFuture.then((r) {
if (r.statusCode == 200 && r.bytes.isNotEmpty) {
_putCachedTile(responseHeaders: r.headers, bytes: r.bytes);
}
}).ignore();
throw const TileLoadCancelledException();
}
// 7. On 304 Not Modified → return stale cached bytes, update metadata.
if (result.statusCode == HttpStatus.notModified && cachedTile != null) {
_putCachedTile(responseHeaders: result.headers);
onNetworkSuccess?.call();
return await decodeBytes(cachedTile.bytes);
}
// 8. On 200 OK → cache to disk, decode and return.
if (result.statusCode == 200 && result.bytes.isNotEmpty) {
_putCachedTile(responseHeaders: result.headers, bytes: result.bytes);
onNetworkSuccess?.call();
return await decodeBytes(result.bytes);
}
// 9. Network error — throw so flutter_map marks the tile as failed.
// Don't include tileUrl in the exception — it may contain API keys.
throw HttpException(
'Tile ${coordinates.z}/${coordinates.x}/${coordinates.y} '
'returned status ${result.statusCode}',
);
}
/// Offline mode: offline areas → disk cache → throw.
Future<Codec> _loadOffline(
Future<Codec> Function(Uint8List) decodeBytes,
Completer<void> cancelled,
) async {
// 1. Check offline areas (primary source — guaranteed available).
try {
final localBytes = await fetchLocalTile(
z: coordinates.z,
x: coordinates.x,
y: coordinates.y,
providerId: providerId,
tileTypeId: tileTypeId,
);
if (cancelled.isCompleted) throw const TileLoadCancelledException();
return await decodeBytes(Uint8List.fromList(localBytes));
} on TileLoadCancelledException {
rethrow;
} catch (_) {
// Local miss — fall through to disk cache
}
// 2. Check disk cache (tiles cached from previous online sessions).
if (cancelled.isCompleted) throw const TileLoadCancelledException();
final cachedTile = await _getCachedTile();
if (cachedTile != null) {
return await decodeBytes(cachedTile.bytes);
}
// 3. Both miss — throw so flutter_map marks the tile as failed.
throw const TileNotAvailableOfflineException();
}
@override
bool operator ==(Object other) {
if (other.runtimeType != runtimeType) return false;
return other is DeflockTileImageProvider &&
other.coordinates == coordinates &&
other.providerId == providerId &&
other.tileTypeId == tileTypeId;
return other is DeflockOfflineTileImageProvider &&
other.coordinates == coordinates &&
other.providerId == providerId &&
other.tileTypeId == tileTypeId &&
other.isOfflineOnly == isOfflineOnly;
}
@override
int get hashCode => Object.hash(coordinates, providerId, tileTypeId);
/// Determine if we should check offline cache for this tile request.
/// Only check offline cache if:
/// 1. We're in offline mode (forced), OR
/// 2. We have offline areas for the current provider/type
///
/// This avoids expensive filesystem searches when browsing online
/// with providers that have no offline areas.
bool _shouldCheckOfflineCache(AppState appState) {
// Always check offline cache in offline mode
if (appState.offlineMode) {
return true;
}
// For online mode, only check if we might actually have relevant offline data
final currentProvider = appState.selectedTileProvider;
final currentTileType = appState.selectedTileType;
if (currentProvider == null || currentTileType == null) {
return false;
}
// Quick check: do we have any offline areas for this provider/type?
// This avoids the expensive per-tile filesystem search in fetchLocalTile
final offlineService = OfflineAreaService();
final hasRelevantAreas = offlineService.hasOfflineAreasForProvider(
currentProvider.id,
currentTileType.id,
);
return hasRelevantAreas;
}
}
int get hashCode =>
Object.hash(coordinates, providerId, tileTypeId, isOfflineOnly);
}

View File

@@ -0,0 +1,87 @@
import '../state/settings_state.dart';
/// Service for distance unit conversions and formatting
///
/// Follows brutalist principles: simple, explicit conversions without fancy abstractions.
/// All APIs work in metric units (meters/km), this service only handles display formatting.
class DistanceService {
// Conversion constants
static const double _metersToFeet = 3.28084;
static const double _metersToMiles = 0.000621371;
/// Format distance for display based on unit preference
///
/// For metric: uses meters for < 1000m, kilometers for >= 1000m
/// For imperial: uses feet for < 5280ft (1 mile), miles for >= 5280ft
static String formatDistance(double distanceInMeters, DistanceUnit unit) {
switch (unit) {
case DistanceUnit.metric:
if (distanceInMeters < 1000) {
return '${distanceInMeters.round()} m';
} else {
return '${(distanceInMeters / 1000).toStringAsFixed(1)} km';
}
case DistanceUnit.imperial:
final distanceInFeet = distanceInMeters * _metersToFeet;
if (distanceInFeet < 5280) {
return '${distanceInFeet.round()} ft';
} else {
final distanceInMiles = distanceInMeters * _metersToMiles;
return '${distanceInMiles.toStringAsFixed(1)} mi';
}
}
}
/// Format large distances (like route distances) for display
///
/// Always uses the larger unit (km/miles) for routes
static String formatRouteDistance(double distanceInMeters, DistanceUnit unit) {
switch (unit) {
case DistanceUnit.metric:
return '${(distanceInMeters / 1000).toStringAsFixed(1)} km';
case DistanceUnit.imperial:
final distanceInMiles = distanceInMeters * _metersToMiles;
return '${distanceInMiles.toStringAsFixed(1)} mi';
}
}
/// Get the unit suffix for small distances (used in form fields, etc.)
static String getSmallDistanceUnit(DistanceUnit unit) {
switch (unit) {
case DistanceUnit.metric:
return 'm';
case DistanceUnit.imperial:
return 'ft';
}
}
/// Convert displayed distance value back to meters for API usage
///
/// This is for form fields where users enter values in their preferred units
static double convertToMeters(double value, DistanceUnit unit, {bool isSmallDistance = true}) {
switch (unit) {
case DistanceUnit.metric:
return isSmallDistance ? value : value * 1000; // m or km to m
case DistanceUnit.imperial:
if (isSmallDistance) {
return value / _metersToFeet; // ft to m
} else {
return value / _metersToMiles; // miles to m
}
}
}
/// Convert meters to the preferred small distance unit for form display
static double convertFromMeters(double meters, DistanceUnit unit) {
switch (unit) {
case DistanceUnit.metric:
return meters;
case DistanceUnit.imperial:
return meters * _metersToFeet;
}
}
}

View File

@@ -0,0 +1,34 @@
import 'package:http/http.dart' as http;
import '../dev_config.dart';
import 'version_service.dart';
/// An [http.BaseClient] that injects a User-Agent header into every request.
///
/// Reads the app name and version dynamically from [VersionService] so the UA
/// string stays in sync with pubspec.yaml without hard-coding values.
///
/// Uses [putIfAbsent] so a manually-set User-Agent is never overwritten.
class UserAgentClient extends http.BaseClient {
final http.Client _inner;
UserAgentClient([http.Client? inner]) : _inner = inner ?? http.Client();
/// The User-Agent string sent with every request.
///
/// Format follows OSM tile usage policy recommendations:
/// `AppName/version (+homepage; contact: email)`
static String get userAgent {
final vs = VersionService();
return '${vs.appName}/${vs.version} (+$kHomepageUrl; contact: $kContactEmail)';
}
@override
Future<http.StreamedResponse> send(http.BaseRequest request) {
request.headers.putIfAbsent('User-Agent', () => userAgent);
return _inner.send(request);
}
@override
void close() => _inner.close();
}

View File

@@ -25,42 +25,32 @@ class LocalizationService extends ChangeNotifier {
Future<void> _discoverAvailableLanguages() async {
_availableLanguages = [];
try {
// Get the asset manifest to find all localization files
final manifestContent = await rootBundle.loadString('AssetManifest.json');
final Map<String, dynamic> manifestMap = json.decode(manifestContent);
// Find all .json files in lib/localizations/
final localizationFiles = manifestMap.keys
.where((String key) => key.startsWith('lib/localizations/') && key.endsWith('.json'))
final assetManifest = await AssetManifest.loadFromAssetBundle(rootBundle);
final localizationAssets = assetManifest.listAssets()
.where((path) => path.startsWith('lib/localizations/') && path.endsWith('.json'))
.toList();
for (final filePath in localizationFiles) {
// Extract language code from filename (e.g., 'lib/localizations/pt.json' -> 'pt')
final fileName = filePath.split('/').last;
final languageCode = fileName.substring(0, fileName.length - 5); // Remove '.json'
for (final assetPath in localizationAssets) {
try {
// Try to load and parse the file to ensure it's valid
final jsonString = await rootBundle.loadString(filePath);
final jsonString = await rootBundle.loadString(assetPath);
final parsedJson = json.decode(jsonString);
// Basic validation - ensure it has the expected structure
if (parsedJson is Map && parsedJson.containsKey('language')) {
final languageCode = assetPath.split('/').last.replaceAll('.json', '');
_availableLanguages.add(languageCode);
debugPrint('Found localization: $languageCode');
}
} catch (e) {
debugPrint('Failed to load localization file $filePath: $e');
debugPrint('Failed to load localization file $assetPath: $e');
}
}
} catch (e) {
debugPrint('Failed to read AssetManifest.json: $e');
// If manifest reading fails, we'll have an empty list
// The system will handle this gracefully by falling back to 'en' in _loadSavedLanguage
debugPrint('Failed to load asset manifest: $e');
_availableLanguages = ['en'];
}
debugPrint('Available languages: $_availableLanguages');
}
@@ -119,28 +109,31 @@ class LocalizationService extends ChangeNotifier {
notifyListeners();
}
String t(String key, {List<String>? params}) {
String t(String key, {List<String>? params}) =>
lookup(_strings, key, params: params);
/// Pure lookup function used by [t] and available for testing.
static String lookup(Map<String, dynamic> strings, String key,
{List<String>? params}) {
List<String> keys = key.split('.');
dynamic current = _strings;
dynamic current = strings;
for (String k in keys) {
if (current is Map && current.containsKey(k)) {
current = current[k];
} else {
// Return the key as fallback for missing translations
return key;
}
}
String result = current is String ? current : key;
// Replace parameters if provided - replace first occurrence only for each parameter
if (params != null) {
for (int i = 0; i < params.length; i++) {
result = result.replaceFirst('{}', params[i]);
}
}
return result;
}

View File

@@ -1,17 +1,13 @@
import 'package:latlong2/latlong.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:flutter/foundation.dart';
import '../models/node_profile.dart';
import '../models/osm_node.dart';
import '../app_state.dart';
import 'map_data_submodules/nodes_from_overpass.dart';
import 'map_data_submodules/nodes_from_osm_api.dart';
import 'map_data_submodules/tiles_from_remote.dart';
import 'map_data_submodules/nodes_from_local.dart';
import 'http_client.dart';
import 'map_data_submodules/tiles_from_local.dart';
import 'network_status.dart';
import 'prefetch_area_service.dart';
import 'node_data_manager.dart';
import 'node_spatial_cache.dart';
enum MapSource { local, remote, auto } // For future use
@@ -27,103 +23,32 @@ class MapDataProvider {
factory MapDataProvider() => _instance;
MapDataProvider._();
// REMOVED: AppState get _appState => AppState();
final NodeDataManager _nodeDataManager = NodeDataManager();
final UserAgentClient _httpClient = UserAgentClient();
bool get isOfflineMode => AppState.instance.offlineMode;
void setOfflineMode(bool enabled) {
AppState.instance.setOfflineMode(enabled);
}
/// Fetch surveillance nodes from OSM/Overpass or local storage.
/// Remote is default. If source is MapSource.auto, remote is tried first unless offline.
/// Fetch surveillance nodes using the new simplified system.
/// Returns cached data immediately if available, otherwise fetches from appropriate source.
Future<List<OsmNode>> getNodes({
required LatLngBounds bounds,
required List<NodeProfile> profiles,
UploadMode uploadMode = UploadMode.production,
MapSource source = MapSource.auto,
bool isUserInitiated = false,
}) async {
final offline = AppState.instance.offlineMode;
// Explicit remote request: error if offline, else always remote
if (source == MapSource.remote) {
if (offline) {
throw OfflineModeException("Cannot fetch remote nodes in offline mode.");
}
return _fetchRemoteNodes(
bounds: bounds,
profiles: profiles,
uploadMode: uploadMode,
maxResults: 0, // No limit - fetch all available data
);
}
// Explicit local request: always use local
if (source == MapSource.local) {
return fetchLocalNodes(
bounds: bounds,
profiles: profiles,
);
}
// AUTO: In offline mode, behavior depends on upload mode
if (offline) {
if (uploadMode == UploadMode.sandbox) {
// Offline + Sandbox = no nodes (local cache is production data)
debugPrint('[MapDataProvider] Offline + Sandbox mode: returning no nodes (local cache is production data)');
return <OsmNode>[];
} else {
// Offline + Production = use local cache
return fetchLocalNodes(
bounds: bounds,
profiles: profiles,
maxNodes: 0, // No limit - get all available data
);
}
} else if (uploadMode == UploadMode.sandbox) {
// Sandbox mode: Only fetch from sandbox API, ignore local production nodes
debugPrint('[MapDataProvider] Sandbox mode: fetching only from sandbox API, ignoring local cache');
return _fetchRemoteNodes(
bounds: bounds,
profiles: profiles,
uploadMode: uploadMode,
maxResults: 0, // No limit - fetch all available data
);
} else {
// Production mode: use pre-fetch service for efficient area loading
final preFetchService = PrefetchAreaService();
// Always get local nodes first (fast, from cache)
final localNodes = await fetchLocalNodes(
bounds: bounds,
profiles: profiles,
maxNodes: AppState.instance.maxNodes,
);
// Check if we need to trigger a new pre-fetch (spatial or temporal)
final needsFetch = !preFetchService.isWithinPreFetchedArea(bounds, profiles, uploadMode) ||
preFetchService.isDataStale();
if (needsFetch) {
// Outside area OR data stale - start pre-fetch with loading state
debugPrint('[MapDataProvider] Starting pre-fetch with loading state');
NetworkStatus.instance.setWaiting();
preFetchService.requestPreFetchIfNeeded(
viewBounds: bounds,
profiles: profiles,
uploadMode: uploadMode,
);
} else {
debugPrint('[MapDataProvider] Using existing fresh pre-fetched area cache');
}
// Return all local nodes without any rendering limit
// Rendering limits are applied at the UI layer
return localNodes;
}
return _nodeDataManager.getNodesFor(
bounds: bounds,
profiles: profiles,
uploadMode: uploadMode,
isUserInitiated: isUserInitiated,
);
}
/// Bulk/paged node fetch for offline downloads (handling paging, dedup, and Overpass retries)
/// Only use for offline area download, not for map browsing! Ignores maxNodes config.
/// Bulk node fetch for offline downloads using new system
Future<List<OsmNode>> getAllNodesForDownload({
required LatLngBounds bounds,
required List<NodeProfile> profiles,
@@ -131,16 +56,12 @@ class MapDataProvider {
int maxResults = 0, // 0 = no limit for offline downloads
int maxTries = 3,
}) async {
final offline = AppState.instance.offlineMode;
if (offline) {
if (AppState.instance.offlineMode) {
throw OfflineModeException("Cannot fetch remote nodes for offline area download in offline mode.");
}
return _fetchRemoteNodes(
bounds: bounds,
profiles: profiles,
uploadMode: uploadMode,
maxResults: maxResults, // Pass 0 for unlimited
);
// For downloads, always fetch fresh data (don't use cache)
return _nodeDataManager.fetchWithSplitting(bounds, profiles);
}
/// Fetch tile image bytes. Default is to try local first, then remote if not offline. Honors explicit source.
@@ -177,82 +98,68 @@ class MapDataProvider {
}
}
/// Fetch remote tile using current provider from AppState
/// Fetch remote tile using current provider from AppState.
/// Only used by offline area downloader — the main tile pipeline now goes
/// through NetworkTileProvider (see DeflockTileProvider).
Future<List<int>> _fetchRemoteTileFromCurrentProvider(int z, int x, int y) async {
final appState = AppState.instance;
final selectedTileType = appState.selectedTileType;
final selectedProvider = appState.selectedTileProvider;
// We guarantee that a provider and tile type are always selected
if (selectedTileType == null || selectedProvider == null) {
throw Exception('No tile provider selected - this should never happen');
}
final tileUrl = selectedTileType.getTileUrl(z, x, y, apiKey: selectedProvider.apiKey);
return fetchRemoteTile(z: z, x: x, y: y, url: tileUrl);
final resp = await _httpClient.get(Uri.parse(tileUrl));
if (resp.statusCode == 200 && resp.bodyBytes.isNotEmpty) {
return resp.bodyBytes;
}
throw Exception('Failed to fetch tile $z/$x/$y: status ${resp.statusCode}');
}
/// Clear any queued tile requests (call when map view changes significantly)
void clearTileQueue() {
clearRemoteTileQueue();
}
/// Clear only tile requests that are no longer visible in the current bounds
void clearTileQueueSelective(LatLngBounds currentBounds) {
clearRemoteTileQueueSelective(currentBounds);
/// Add or update nodes in cache (for upload queue integration)
void addOrUpdateNodes(List<OsmNode> nodes) {
_nodeDataManager.addOrUpdateNodes(nodes);
}
/// Fetch remote nodes with Overpass first, OSM API fallback
Future<List<OsmNode>> _fetchRemoteNodes({
/// NodeCache compatibility - alias for addOrUpdateNodes
void addOrUpdate(List<OsmNode> nodes) {
addOrUpdateNodes(nodes);
}
/// Remove node from cache (for deletions)
void removeNodeById(int nodeId) {
_nodeDataManager.removeNodeById(nodeId);
}
/// Clear cache (when profiles change)
void clearCache() {
_nodeDataManager.clearCache();
}
/// Force refresh current area (manual retry)
Future<void> refreshArea({
required LatLngBounds bounds,
required List<NodeProfile> profiles,
UploadMode uploadMode = UploadMode.production,
required int maxResults,
}) async {
// For sandbox mode, skip Overpass and go directly to OSM API
// (Overpass doesn't have sandbox data)
if (uploadMode == UploadMode.sandbox) {
debugPrint('[MapDataProvider] Sandbox mode detected, using OSM API directly');
return fetchOsmApiNodes(
bounds: bounds,
profiles: profiles,
uploadMode: uploadMode,
maxResults: maxResults,
);
}
// For production mode, try Overpass first, then fallback to OSM API
try {
final nodes = await fetchOverpassNodes(
bounds: bounds,
profiles: profiles,
uploadMode: uploadMode,
maxResults: maxResults,
);
// If Overpass returns nodes, we're good
if (nodes.isNotEmpty) {
return nodes;
}
// If Overpass returns empty (could be no data or could be an issue),
// try OSM API as well to be thorough
debugPrint('[MapDataProvider] Overpass returned no nodes, trying OSM API fallback');
return fetchOsmApiNodes(
bounds: bounds,
profiles: profiles,
uploadMode: uploadMode,
maxResults: maxResults,
);
} catch (e) {
debugPrint('[MapDataProvider] Overpass failed ($e), trying OSM API fallback');
return fetchOsmApiNodes(
bounds: bounds,
profiles: profiles,
uploadMode: uploadMode,
maxResults: maxResults,
);
}
return _nodeDataManager.refreshArea(
bounds: bounds,
profiles: profiles,
uploadMode: uploadMode,
);
}
/// NodeCache compatibility methods for upload queue
/// These all delegate to the singleton cache to ensure consistency
OsmNode? getNodeById(int nodeId) => NodeSpatialCache().getNodeById(nodeId);
void removePendingEditMarker(int nodeId) => NodeSpatialCache().removePendingEditMarker(nodeId);
void removePendingDeletionMarker(int nodeId) => NodeSpatialCache().removePendingDeletionMarker(nodeId);
void removeTempNodeById(int tempNodeId) => NodeSpatialCache().removeTempNodeById(tempNodeId);
List<OsmNode> findNodesWithinDistance(LatLng coord, double distanceMeters, {int? excludeNodeId}) =>
NodeSpatialCache().findNodesWithinDistance(coord, distanceMeters, excludeNodeId: excludeNodeId);
/// Check if we have good cache coverage for the given area (prevents submission in uncovered areas)
bool hasGoodCoverageFor(LatLngBounds bounds) => NodeSpatialCache().hasDataFor(bounds);
}

View File

@@ -1,6 +1,5 @@
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:flutter/foundation.dart';
import 'package:http/http.dart' as http;
import 'package:latlong2/latlong.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:xml/xml.dart';
@@ -8,7 +7,8 @@ import 'package:xml/xml.dart';
import '../../models/node_profile.dart';
import '../../models/osm_node.dart';
import '../../app_state.dart';
import '../network_status.dart';
import '../http_client.dart';
import '../service_policy.dart';
/// Fetches surveillance nodes from the direct OSM API using bbox query.
/// This is a fallback for when Overpass is not available (e.g., sandbox mode).
@@ -20,9 +20,6 @@ Future<List<OsmNode>> fetchOsmApiNodes({
}) async {
if (profiles.isEmpty) return [];
// Check if this is a user-initiated fetch (indicated by loading state)
final wasUserInitiated = NetworkStatus.instance.currentStatus == NetworkStatusType.waiting;
try {
final nodes = await _fetchFromOsmApi(
bounds: bounds,
@@ -31,27 +28,15 @@ Future<List<OsmNode>> fetchOsmApiNodes({
maxResults: maxResults,
);
// Only report success at the top level if this was user-initiated
if (wasUserInitiated) {
NetworkStatus.instance.setSuccess();
}
return nodes;
} catch (e) {
// Only report errors at the top level if this was user-initiated
if (wasUserInitiated) {
if (e.toString().contains('timeout') || e.toString().contains('timed out')) {
NetworkStatus.instance.setTimeoutError();
} else {
NetworkStatus.instance.setNetworkError();
}
}
debugPrint('[fetchOsmApiNodes] OSM API operation failed: $e');
return [];
}
}
final _client = UserAgentClient();
/// Internal method that performs the actual OSM API fetch.
Future<List<OsmNode>> _fetchFromOsmApi({
required LatLngBounds bounds,
@@ -75,30 +60,38 @@ Future<List<OsmNode>> _fetchFromOsmApi({
try {
debugPrint('[fetchOsmApiNodes] Querying OSM API for nodes in bbox...');
debugPrint('[fetchOsmApiNodes] URL: $url');
final response = await http.get(Uri.parse(url));
// Enforce max 2 concurrent download threads per OSM API usage policy
await ServiceRateLimiter.acquire(ServiceType.osmEditingApi);
final http.Response response;
try {
response = await _client.get(Uri.parse(url));
} finally {
ServiceRateLimiter.release(ServiceType.osmEditingApi);
}
if (response.statusCode != 200) {
debugPrint('[fetchOsmApiNodes] OSM API error: ${response.statusCode} - ${response.body}');
throw Exception('OSM API error: ${response.statusCode} - ${response.body}');
}
// Parse XML response
final document = XmlDocument.parse(response.body);
final nodes = _parseOsmApiResponseWithConstraints(document, profiles, maxResults);
if (nodes.isNotEmpty) {
debugPrint('[fetchOsmApiNodes] Retrieved ${nodes.length} matching surveillance nodes');
}
// Don't report success here - let the top level handle it
return nodes;
} catch (e) {
debugPrint('[fetchOsmApiNodes] Exception: $e');
// Don't report status here - let the top level handle it
throw e; // Re-throw to let caller handle
rethrow; // Re-throw to let caller handle
}
}

View File

@@ -1,409 +0,0 @@
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:flutter/foundation.dart';
import 'package:latlong2/latlong.dart';
import 'package:flutter_map/flutter_map.dart';
import '../../models/node_profile.dart';
import '../../models/osm_node.dart';
import '../../models/pending_upload.dart';
import '../../app_state.dart';
import '../../dev_config.dart';
import '../network_status.dart';
import '../overpass_node_limit_exception.dart';
/// Fetches surveillance nodes from the Overpass OSM API for the given bounds and profiles.
/// If the query fails due to too many nodes, automatically splits the area and retries.
Future<List<OsmNode>> fetchOverpassNodes({
required LatLngBounds bounds,
required List<NodeProfile> profiles,
UploadMode uploadMode = UploadMode.production,
required int maxResults,
}) async {
// Check if this is a user-initiated fetch (indicated by loading state)
final wasUserInitiated = NetworkStatus.instance.currentStatus == NetworkStatusType.waiting;
try {
final nodes = await _fetchOverpassNodesWithSplitting(
bounds: bounds,
profiles: profiles,
uploadMode: uploadMode,
maxResults: maxResults,
splitDepth: 0,
reportStatus: wasUserInitiated, // Only top level reports status
);
// Only report success at the top level if this was user-initiated
if (wasUserInitiated) {
NetworkStatus.instance.setSuccess();
}
return nodes;
} catch (e) {
// Only report errors at the top level if this was user-initiated
if (wasUserInitiated) {
if (e.toString().contains('timeout') || e.toString().contains('timed out')) {
NetworkStatus.instance.setTimeoutError();
} else {
NetworkStatus.instance.setNetworkError();
}
}
debugPrint('[fetchOverpassNodes] Top-level operation failed: $e');
return [];
}
}
/// Internal method that handles splitting when node limit is exceeded.
Future<List<OsmNode>> _fetchOverpassNodesWithSplitting({
required LatLngBounds bounds,
required List<NodeProfile> profiles,
UploadMode uploadMode = UploadMode.production,
required int maxResults,
required int splitDepth,
required bool reportStatus, // Only true for top level
}) async {
if (profiles.isEmpty) return [];
const int maxSplitDepth = kMaxPreFetchSplitDepth; // Maximum times we'll split (4^3 = 64 max sub-areas)
try {
return await _fetchSingleOverpassQuery(
bounds: bounds,
profiles: profiles,
maxResults: maxResults,
reportStatus: reportStatus,
);
} on OverpassRateLimitException catch (e) {
// Rate limits should NOT be split - just fail with extended backoff
debugPrint('[fetchOverpassNodes] Rate limited - using extended backoff, not splitting');
// Wait longer for rate limits before giving up entirely
await Future.delayed(const Duration(seconds: 30));
return []; // Return empty rather than rethrowing - let caller handle error reporting
} on OverpassNodeLimitException {
// If we've hit max split depth, give up to avoid infinite recursion
if (splitDepth >= maxSplitDepth) {
debugPrint('[fetchOverpassNodes] Max split depth reached, giving up on area: $bounds');
return []; // Return empty - let caller handle error reporting
}
// Split the bounds into 4 quadrants and try each separately
debugPrint('[fetchOverpassNodes] Splitting area into quadrants (depth: $splitDepth)');
final quadrants = _splitBounds(bounds);
final List<OsmNode> allNodes = [];
for (final quadrant in quadrants) {
final nodes = await _fetchOverpassNodesWithSplitting(
bounds: quadrant,
profiles: profiles,
uploadMode: uploadMode,
maxResults: 0, // No limit on individual quadrants to avoid double-limiting
splitDepth: splitDepth + 1,
reportStatus: false, // Sub-requests don't report status
);
allNodes.addAll(nodes);
}
debugPrint('[fetchOverpassNodes] Collected ${allNodes.length} nodes from ${quadrants.length} quadrants');
return allNodes;
}
}
/// Perform a single Overpass query without splitting logic.
Future<List<OsmNode>> _fetchSingleOverpassQuery({
required LatLngBounds bounds,
required List<NodeProfile> profiles,
required int maxResults,
required bool reportStatus,
}) async {
const String overpassEndpoint = 'https://overpass-api.de/api/interpreter';
// Build the Overpass query
final query = _buildOverpassQuery(bounds, profiles, maxResults);
try {
debugPrint('[fetchOverpassNodes] Querying Overpass for surveillance nodes...');
debugPrint('[fetchOverpassNodes] Query:\n$query');
final response = await http.post(
Uri.parse(overpassEndpoint),
body: {'data': query.trim()}
);
if (response.statusCode != 200) {
final errorBody = response.body;
debugPrint('[fetchOverpassNodes] Overpass API error: $errorBody');
// Check if it's specifically the 50k node limit error (HTTP 400)
// Exact message: "You requested too many nodes (limit is 50000)"
if (errorBody.contains('too many nodes') &&
errorBody.contains('50000')) {
debugPrint('[fetchOverpassNodes] Detected 50k node limit error, will attempt splitting');
throw OverpassNodeLimitException('Query exceeded node limit', serverResponse: errorBody);
}
// Check for timeout errors that indicate query complexity (should split)
// Common timeout messages from Overpass
if (errorBody.contains('timeout') ||
errorBody.contains('runtime limit exceeded') ||
errorBody.contains('Query timed out')) {
debugPrint('[fetchOverpassNodes] Detected timeout error, will attempt splitting to reduce complexity');
throw OverpassNodeLimitException('Query timed out', serverResponse: errorBody);
}
// Check for rate limiting (should NOT split - needs longer backoff)
if (errorBody.contains('rate limited') ||
errorBody.contains('too many requests') ||
response.statusCode == 429) {
debugPrint('[fetchOverpassNodes] Rate limited by Overpass API - needs extended backoff');
throw OverpassRateLimitException('Rate limited by server', serverResponse: errorBody);
}
// Don't report status here - let the top level handle it
throw Exception('Overpass API error: $errorBody');
}
final data = await compute(jsonDecode, response.body) as Map<String, dynamic>;
final elements = data['elements'] as List<dynamic>;
if (elements.length > 20) {
debugPrint('[fetchOverpassNodes] Retrieved ${elements.length} elements (nodes + ways/relations)');
}
// Don't report success here - let the top level handle it
// Parse response to determine which nodes are constrained
final nodes = _parseOverpassResponseWithConstraints(elements);
// Clean up any pending uploads that now appear in Overpass results
_cleanupCompletedUploads(nodes);
return nodes;
} catch (e) {
// Re-throw OverpassNodeLimitException so splitting logic can catch it
if (e is OverpassNodeLimitException) rethrow;
debugPrint('[fetchOverpassNodes] Exception: $e');
// Don't report status here - let the top level handle it
throw e; // Re-throw to let caller handle
}
}
/// Builds an Overpass API query for surveillance nodes matching the given profiles within bounds.
/// Also fetches ways and relations that reference these nodes to determine constraint status.
String _buildOverpassQuery(LatLngBounds bounds, List<NodeProfile> profiles, int maxResults) {
// Deduplicate profiles to reduce query complexity - broader profiles subsume more specific ones
final deduplicatedProfiles = _deduplicateProfilesForQuery(profiles);
// Safety check: if deduplication removed all profiles (edge case), fall back to original list
final profilesToQuery = deduplicatedProfiles.isNotEmpty ? deduplicatedProfiles : profiles;
if (deduplicatedProfiles.length < profiles.length) {
debugPrint('[Overpass] Deduplicated ${profiles.length} profiles to ${deduplicatedProfiles.length} for query efficiency');
}
// Build node clauses for deduplicated profiles only
final nodeClauses = profilesToQuery.map((profile) {
// Convert profile tags to Overpass filter format, excluding empty values
final tagFilters = profile.tags.entries
.where((entry) => entry.value.trim().isNotEmpty) // Skip empty values
.map((entry) => '["${entry.key}"="${entry.value}"]')
.join();
// Build the node query with tag filters and bounding box
return 'node$tagFilters(${bounds.southWest.latitude},${bounds.southWest.longitude},${bounds.northEast.latitude},${bounds.northEast.longitude});';
}).join('\n ');
return '''
[out:json][timeout:25];
(
$nodeClauses
);
out body ${maxResults > 0 ? maxResults : ''};
(
way(bn);
rel(bn);
);
out meta;
''';
}
/// Deduplicate profiles for Overpass queries by removing profiles that are subsumed by others.
/// A profile A subsumes profile B if all of A's non-empty tags exist in B with identical values.
/// This optimization reduces query complexity while returning the same nodes (since broader
/// profiles capture all nodes that more specific profiles would).
List<NodeProfile> _deduplicateProfilesForQuery(List<NodeProfile> profiles) {
if (profiles.length <= 1) return profiles;
final result = <NodeProfile>[];
for (final candidate in profiles) {
// Skip profiles that only have empty tags - they would match everything and break queries
final candidateNonEmptyTags = candidate.tags.entries
.where((entry) => entry.value.trim().isNotEmpty)
.toList();
if (candidateNonEmptyTags.isEmpty) continue;
// Check if any existing profile in our result subsumes this candidate
bool isSubsumed = false;
for (final existing in result) {
if (_profileSubsumes(existing, candidate)) {
isSubsumed = true;
break;
}
}
if (!isSubsumed) {
// This candidate is not subsumed, so add it
// But first, remove any existing profiles that this candidate subsumes
result.removeWhere((existing) => _profileSubsumes(candidate, existing));
result.add(candidate);
}
}
return result;
}
/// Check if broaderProfile subsumes specificProfile.
/// Returns true if all non-empty tags in broaderProfile exist in specificProfile with identical values.
bool _profileSubsumes(NodeProfile broaderProfile, NodeProfile specificProfile) {
// Get non-empty tags from both profiles
final broaderTags = Map.fromEntries(
broaderProfile.tags.entries.where((entry) => entry.value.trim().isNotEmpty)
);
final specificTags = Map.fromEntries(
specificProfile.tags.entries.where((entry) => entry.value.trim().isNotEmpty)
);
// If broader has no non-empty tags, it doesn't subsume anything (would match everything)
if (broaderTags.isEmpty) return false;
// If broader has more non-empty tags than specific, it can't subsume
if (broaderTags.length > specificTags.length) return false;
// Check if all broader tags exist in specific with same values
for (final entry in broaderTags.entries) {
if (specificTags[entry.key] != entry.value) return false;
}
return true;
}
/// Split a LatLngBounds into 4 quadrants (NW, NE, SW, SE).
List<LatLngBounds> _splitBounds(LatLngBounds bounds) {
final centerLat = (bounds.north + bounds.south) / 2;
final centerLng = (bounds.east + bounds.west) / 2;
return [
// Southwest quadrant (bottom-left)
LatLngBounds(
LatLng(bounds.south, bounds.west),
LatLng(centerLat, centerLng),
),
// Southeast quadrant (bottom-right)
LatLngBounds(
LatLng(bounds.south, centerLng),
LatLng(centerLat, bounds.east),
),
// Northwest quadrant (top-left)
LatLngBounds(
LatLng(centerLat, bounds.west),
LatLng(bounds.north, centerLng),
),
// Northeast quadrant (top-right)
LatLngBounds(
LatLng(centerLat, centerLng),
LatLng(bounds.north, bounds.east),
),
];
}
/// Parse Overpass response elements to create OsmNode objects with constraint information.
List<OsmNode> _parseOverpassResponseWithConstraints(List<dynamic> elements) {
final nodeElements = <Map<String, dynamic>>[];
final constrainedNodeIds = <int>{};
// First pass: collect surveillance nodes and identify constrained nodes
for (final element in elements.whereType<Map<String, dynamic>>()) {
final type = element['type'] as String?;
if (type == 'node') {
// This is a surveillance node - collect it
nodeElements.add(element);
} else if (type == 'way' || type == 'relation') {
// This is a way/relation that references some of our nodes
final refs = element['nodes'] as List<dynamic>? ??
element['members']?.where((m) => m['type'] == 'node').map((m) => m['ref']) ?? [];
// Mark all referenced nodes as constrained
for (final ref in refs) {
if (ref is int) {
constrainedNodeIds.add(ref);
} else if (ref is String) {
final nodeId = int.tryParse(ref);
if (nodeId != null) constrainedNodeIds.add(nodeId);
}
}
}
}
// Second pass: create OsmNode objects with constraint info
final nodes = nodeElements.map((element) {
final nodeId = element['id'] as int;
final isConstrained = constrainedNodeIds.contains(nodeId);
return OsmNode(
id: nodeId,
coord: LatLng(element['lat'], element['lon']),
tags: Map<String, String>.from(element['tags'] ?? {}),
isConstrained: isConstrained,
);
}).toList();
final constrainedCount = nodes.where((n) => n.isConstrained).length;
if (constrainedCount > 0) {
debugPrint('[fetchOverpassNodes] Found $constrainedCount constrained nodes out of ${nodes.length} total');
}
return nodes;
}
/// Clean up pending uploads that now appear in Overpass results
void _cleanupCompletedUploads(List<OsmNode> overpassNodes) {
try {
final appState = AppState.instance;
final pendingUploads = appState.pendingUploads;
if (pendingUploads.isEmpty) return;
final overpassNodeIds = overpassNodes.map((n) => n.id).toSet();
// Find pending uploads whose submitted node IDs now appear in Overpass results
final uploadsToRemove = <PendingUpload>[];
for (final upload in pendingUploads) {
if (upload.submittedNodeId != null &&
overpassNodeIds.contains(upload.submittedNodeId!)) {
uploadsToRemove.add(upload);
debugPrint('[OverpassCleanup] Found submitted node ${upload.submittedNodeId} in Overpass results, removing from pending queue');
}
}
// Remove the completed uploads from the queue
for (final upload in uploadsToRemove) {
appState.removeFromQueue(upload);
}
if (uploadsToRemove.isNotEmpty) {
debugPrint('[OverpassCleanup] Cleaned up ${uploadsToRemove.length} completed uploads');
}
} catch (e) {
debugPrint('[OverpassCleanup] Error during cleanup: $e');
// Don't let cleanup errors break the main functionality
}
}

View File

@@ -1,16 +1,29 @@
import 'dart:io';
import 'package:latlong2/latlong.dart';
import 'dart:math';
import 'package:flutter_map/flutter_map.dart' show LatLngBounds;
import 'package:flutter/foundation.dart' show visibleForTesting;
import '../offline_area_service.dart';
import '../offline_areas/offline_area_models.dart';
import '../offline_areas/offline_tile_utils.dart';
import '../../app_state.dart';
/// Fetch a tile from the newest offline area that matches the current provider, or throw if not found.
Future<List<int>> fetchLocalTile({required int z, required int x, required int y}) async {
/// Fetch a tile from the newest offline area that matches the given provider, or throw if not found.
///
/// When [providerId] and [tileTypeId] are supplied the lookup is pinned to
/// those values (avoids a race when the user switches provider mid-flight).
/// Otherwise falls back to the current AppState selection.
Future<List<int>> fetchLocalTile({
required int z,
required int x,
required int y,
String? providerId,
String? tileTypeId,
}) async {
final appState = AppState.instance;
final currentProvider = appState.selectedTileProvider;
final currentTileType = appState.selectedTileType;
final currentProviderId = providerId ?? appState.selectedTileProvider?.id;
final currentTileTypeId = tileTypeId ?? appState.selectedTileType?.id;
final offlineService = OfflineAreaService();
await offlineService.ensureInitialized();
final areas = offlineService.offlineAreas;
@@ -19,29 +32,58 @@ Future<List<int>> fetchLocalTile({required int z, required int x, required int y
for (final area in areas) {
if (area.status != OfflineAreaStatus.complete) continue;
if (z < area.minZoom || z > area.maxZoom) continue;
// Only consider areas that match the current provider/type
if (area.tileProviderId != currentProvider?.id || area.tileTypeId != currentTileType?.id) continue;
// Get tile coverage for area at this zoom only
final coveredTiles = computeTileList(area.bounds, z, z);
final hasTile = coveredTiles.any((tile) => tile[0] == z && tile[1] == x && tile[2] == y);
if (hasTile) {
final tilePath = _tilePath(area.directory, z, x, y);
final file = File(tilePath);
if (await file.exists()) {
final stat = await file.stat();
candidates.add(_AreaTileMatch(area: area, file: file, modified: stat.modified));
}
// Only consider areas that match the current provider/type
if (area.tileProviderId != currentProviderId || area.tileTypeId != currentTileTypeId) continue;
// O(1) bounds check instead of enumerating all tiles at this zoom level
if (!tileInBounds(area.bounds, z, x, y)) continue;
final tilePath = _tilePath(area.directory, z, x, y);
final file = File(tilePath);
try {
final stat = await file.stat();
if (stat.type == FileSystemEntityType.notFound) continue;
candidates.add(_AreaTileMatch(area: area, file: file, modified: stat.modified));
} on FileSystemException {
continue;
}
}
if (candidates.isEmpty) {
throw Exception('Tile $z/$x/$y from current provider ${currentProvider?.id}/${currentTileType?.id} not found in any offline area');
throw Exception('Tile $z/$x/$y from provider $currentProviderId/$currentTileTypeId not found in any offline area');
}
candidates.sort((a, b) => b.modified.compareTo(a.modified)); // newest first
return await candidates.first.file.readAsBytes();
}
/// O(1) check whether tile (z, x, y) falls within the given lat/lng bounds.
///
/// Uses the same Mercator projection math as [latLonToTile] in
/// offline_tile_utils.dart, but only computes the bounding tile range
/// instead of enumerating every tile at that zoom level.
///
/// Note: Y axis is inverted in tile coordinates — north = lower Y.
@visibleForTesting
bool tileInBounds(LatLngBounds bounds, int z, int x, int y) {
final n = pow(2.0, z);
final west = bounds.west;
final east = bounds.east;
final north = bounds.north;
final south = bounds.south;
final minX = ((west + 180.0) / 360.0 * n).floor();
final maxX = ((east + 180.0) / 360.0 * n).floor();
// North → lower Y (Mercator projection inverts latitude)
final minY = ((1.0 - log(tan(north * pi / 180.0) +
1.0 / cos(north * pi / 180.0)) /
pi) / 2.0 * n).floor();
final maxY = ((1.0 - log(tan(south * pi / 180.0) +
1.0 / cos(south * pi / 180.0)) /
pi) / 2.0 * n).floor();
return x >= minX && x <= maxX && y >= minY && y <= maxY;
}
String _tilePath(String areaDir, int z, int x, int y) =>
'$areaDir/tiles/$z/$x/$y.png';

View File

@@ -1,263 +0,0 @@
import 'dart:math';
import 'dart:io';
import 'dart:async';
import 'package:http/http.dart' as http;
import 'package:flutter/foundation.dart';
import 'package:latlong2/latlong.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:deflockapp/dev_config.dart';
/// Global semaphore to limit simultaneous tile fetches
final _tileFetchSemaphore = _SimpleSemaphore(kTileFetchConcurrentThreads);
/// Clear queued tile requests when map view changes significantly
void clearRemoteTileQueue() {
final clearedCount = _tileFetchSemaphore.clearQueue();
// Only log if we actually cleared something significant
if (clearedCount > 5) {
debugPrint('[RemoteTiles] Cleared $clearedCount queued tile requests');
}
}
/// Clear only tile requests that are no longer visible in the given bounds
void clearRemoteTileQueueSelective(LatLngBounds currentBounds) {
final clearedCount = _tileFetchSemaphore.clearStaleRequests((z, x, y) {
// Return true if tile should be cleared (i.e., is NOT visible)
return !_isTileVisible(z, x, y, currentBounds);
});
if (clearedCount > 0) {
debugPrint('[RemoteTiles] Selectively cleared $clearedCount non-visible tile requests');
}
}
/// Calculate retry delay using configurable backoff strategy.
/// Uses: initialDelay * (multiplier ^ (attempt - 1)) + randomJitter, capped at maxDelay
int _calculateRetryDelay(int attempt, Random random) {
// Calculate exponential backoff
final baseDelay = (kTileFetchInitialDelayMs *
pow(kTileFetchBackoffMultiplier, attempt - 1)).round();
// Add random jitter to avoid thundering herd
final jitter = random.nextInt(kTileFetchRandomJitterMs + 1);
// Apply max delay cap
return (baseDelay + jitter).clamp(0, kTileFetchMaxDelayMs);
}
/// Convert tile coordinates to lat/lng bounds for spatial filtering
class _TileBounds {
final double north, south, east, west;
_TileBounds({required this.north, required this.south, required this.east, required this.west});
}
/// Calculate the lat/lng bounds for a given tile
_TileBounds _tileToBounds(int z, int x, int y) {
final n = pow(2, z);
final lon1 = (x / n) * 360.0 - 180.0;
final lon2 = ((x + 1) / n) * 360.0 - 180.0;
final lat1 = _yToLatitude(y, z);
final lat2 = _yToLatitude(y + 1, z);
return _TileBounds(
north: max(lat1, lat2),
south: min(lat1, lat2),
east: max(lon1, lon2),
west: min(lon1, lon2),
);
}
/// Convert tile Y coordinate to latitude
double _yToLatitude(int y, int z) {
final n = pow(2, z);
final latRad = atan(_sinh(pi * (1 - 2 * y / n)));
return latRad * 180.0 / pi;
}
/// Hyperbolic sine function: sinh(x) = (e^x - e^(-x)) / 2
double _sinh(double x) {
return (exp(x) - exp(-x)) / 2;
}
/// Check if a tile intersects with the current view bounds
bool _isTileVisible(int z, int x, int y, LatLngBounds viewBounds) {
final tileBounds = _tileToBounds(z, x, y);
// Check if tile bounds intersect with view bounds
return !(tileBounds.east < viewBounds.west ||
tileBounds.west > viewBounds.east ||
tileBounds.north < viewBounds.south ||
tileBounds.south > viewBounds.north);
}
/// Fetches a tile from any remote provider with unlimited retries.
/// Returns tile image bytes. Retries forever until success.
/// Brutalist approach: Keep trying until it works - no arbitrary retry limits.
Future<List<int>> fetchRemoteTile({
required int z,
required int x,
required int y,
required String url,
}) async {
int attempt = 0;
final random = Random();
final hostInfo = Uri.parse(url).host; // For logging
while (true) {
await _tileFetchSemaphore.acquire(z: z, x: x, y: y);
try {
// Only log on first attempt
if (attempt == 0) {
debugPrint('[fetchRemoteTile] Fetching $z/$x/$y from $hostInfo');
}
attempt++;
final resp = await http.get(Uri.parse(url));
if (resp.statusCode == 200 && resp.bodyBytes.isNotEmpty) {
// Success!
if (attempt > 1) {
debugPrint('[fetchRemoteTile] SUCCESS $z/$x/$y from $hostInfo after $attempt attempts');
}
return resp.bodyBytes;
} else {
debugPrint('[fetchRemoteTile] FAIL $z/$x/$y from $hostInfo: code=${resp.statusCode}, bytes=${resp.bodyBytes.length}');
throw HttpException('Failed to fetch tile $z/$x/$y from $hostInfo: status ${resp.statusCode}');
}
} catch (e) {
// Calculate delay and retry (no attempt limit - keep trying forever)
final delay = _calculateRetryDelay(attempt, random);
if (attempt == 1) {
debugPrint("[fetchRemoteTile] Attempt $attempt for $z/$x/$y from $hostInfo failed: $e. Retrying in ${delay}ms.");
} else if (attempt % 10 == 0) {
// Log every 10th attempt to show we're still working
debugPrint("[fetchRemoteTile] Still trying $z/$x/$y from $hostInfo (attempt $attempt). Retrying in ${delay}ms.");
}
await Future.delayed(Duration(milliseconds: delay));
} finally {
_tileFetchSemaphore.release(z: z, x: x, y: y);
}
}
}
/// Legacy function for backward compatibility
@Deprecated('Use fetchRemoteTile instead')
Future<List<int>> fetchOSMTile({
required int z,
required int x,
required int y,
}) async {
return fetchRemoteTile(
z: z,
x: x,
y: y,
url: 'https://tile.openstreetmap.org/$z/$x/$y.png',
);
}
/// Enhanced tile request entry that tracks coordinates for spatial filtering
class _TileRequest {
final int z, x, y;
final VoidCallback callback;
_TileRequest({required this.z, required this.x, required this.y, required this.callback});
}
/// Spatially-aware counting semaphore for tile requests with deduplication
class _SimpleSemaphore {
final int _max;
int _current = 0;
final List<_TileRequest> _queue = [];
final Set<String> _inFlightTiles = {}; // Track in-flight requests for deduplication
_SimpleSemaphore(this._max);
Future<void> acquire({int? z, int? x, int? y}) async {
// Create tile key for deduplication
final tileKey = '${z ?? -1}/${x ?? -1}/${y ?? -1}';
// If this tile is already in flight, skip the request
if (_inFlightTiles.contains(tileKey)) {
debugPrint('[SimpleSemaphore] Skipping duplicate request for $tileKey');
return;
}
// Add to in-flight tracking
_inFlightTiles.add(tileKey);
if (_current < _max) {
_current++;
return;
} else {
// Check queue size limit to prevent memory bloat
if (_queue.length >= kTileFetchMaxQueueSize) {
// Remove oldest request to make room
final oldRequest = _queue.removeAt(0);
final oldKey = '${oldRequest.z}/${oldRequest.x}/${oldRequest.y}';
_inFlightTiles.remove(oldKey);
debugPrint('[SimpleSemaphore] Queue full, dropped oldest request: $oldKey');
}
final c = Completer<void>();
final request = _TileRequest(
z: z ?? -1,
x: x ?? -1,
y: y ?? -1,
callback: () => c.complete(),
);
_queue.add(request);
await c.future;
}
}
void release({int? z, int? x, int? y}) {
// Remove from in-flight tracking
final tileKey = '${z ?? -1}/${x ?? -1}/${y ?? -1}';
_inFlightTiles.remove(tileKey);
if (_queue.isNotEmpty) {
final request = _queue.removeAt(0);
request.callback();
} else {
_current--;
}
}
/// Clear all queued requests (call when view changes significantly)
int clearQueue() {
final clearedCount = _queue.length;
_queue.clear();
_inFlightTiles.clear(); // Also clear deduplication tracking
return clearedCount;
}
/// Clear only tiles that don't pass the visibility filter
int clearStaleRequests(bool Function(int z, int x, int y) isStale) {
final initialCount = _queue.length;
final initialInFlightCount = _inFlightTiles.length;
// Remove stale requests from queue
_queue.removeWhere((request) => isStale(request.z, request.x, request.y));
// Remove stale tiles from in-flight tracking
_inFlightTiles.removeWhere((tileKey) {
final parts = tileKey.split('/');
if (parts.length == 3) {
final z = int.tryParse(parts[0]) ?? -1;
final x = int.tryParse(parts[1]) ?? -1;
final y = int.tryParse(parts[2]) ?? -1;
return isStale(z, x, y);
}
return false;
});
final queueClearedCount = initialCount - _queue.length;
final inFlightClearedCount = initialInFlightCount - _inFlightTiles.length;
if (queueClearedCount > 0 || inFlightClearedCount > 0) {
debugPrint('[SimpleSemaphore] Cleared $queueClearedCount stale queue + $inFlightClearedCount stale in-flight, kept ${_queue.length}');
}
return queueClearedCount + inFlightClearedCount;
}
}

View File

@@ -1,225 +1,117 @@
import 'package:flutter/material.dart';
import 'dart:async';
import '../app_state.dart';
enum NetworkIssueType { overpassApi }
enum NetworkStatusType { waiting, issues, timedOut, noData, ready, success }
/// Simple enum-based network status for surveillance data requests.
/// Only tracks the latest user-initiated request - background requests are ignored.
enum NetworkRequestStatus {
idle, // No active requests
loading, // Request in progress
splitting, // Request being split due to limits/timeouts
success, // Data loaded successfully
timeout, // Request timed out
rateLimited, // API rate limited
noData, // No offline data available
error, // Other network errors
}
class NetworkStatus extends ChangeNotifier {
static final NetworkStatus instance = NetworkStatus._();
NetworkStatus._();
bool _overpassHasIssues = false;
bool _isWaitingForData = false;
bool _isTimedOut = false;
bool _hasNoData = false;
bool _hasSuccess = false;
int _recentOfflineMisses = 0;
Timer? _overpassRecoveryTimer;
Timer? _waitingTimer;
Timer? _noDataResetTimer;
Timer? _successResetTimer;
// Getters
bool get hasAnyIssues => _overpassHasIssues;
bool get overpassHasIssues => _overpassHasIssues;
bool get isWaitingForData => _isWaitingForData;
bool get isTimedOut => _isTimedOut;
bool get hasNoData => _hasNoData;
bool get hasSuccess => _hasSuccess;
NetworkRequestStatus _status = NetworkRequestStatus.idle;
Timer? _autoResetTimer;
NetworkStatusType get currentStatus {
// Simple single-path status logic
if (hasAnyIssues) return NetworkStatusType.issues;
if (_isWaitingForData) return NetworkStatusType.waiting;
if (_isTimedOut) return NetworkStatusType.timedOut;
if (_hasNoData) return NetworkStatusType.noData;
if (_hasSuccess) return NetworkStatusType.success;
return NetworkStatusType.ready;
}
NetworkIssueType? get currentIssueType {
if (_overpassHasIssues) return NetworkIssueType.overpassApi;
return null;
}
/// Report Overpass API issues
void reportOverpassIssue() {
if (!_overpassHasIssues) {
_overpassHasIssues = true;
notifyListeners();
debugPrint('[NetworkStatus] Overpass API issues detected');
/// Current network status
NetworkRequestStatus get status => _status;
/// Set status and handle auto-reset timers
void _setStatus(NetworkRequestStatus newStatus) {
if (_status == newStatus) return;
_status = newStatus;
_autoResetTimer?.cancel();
// Auto-reset certain statuses after a delay
switch (newStatus) {
case NetworkRequestStatus.success:
_autoResetTimer = Timer(const Duration(seconds: 2), () {
_setStatus(NetworkRequestStatus.idle);
});
break;
case NetworkRequestStatus.timeout:
case NetworkRequestStatus.error:
_autoResetTimer = Timer(const Duration(seconds: 5), () {
_setStatus(NetworkRequestStatus.idle);
});
break;
case NetworkRequestStatus.noData:
_autoResetTimer = Timer(const Duration(seconds: 3), () {
_setStatus(NetworkRequestStatus.idle);
});
break;
case NetworkRequestStatus.rateLimited:
_autoResetTimer = Timer(const Duration(minutes: 2), () {
_setStatus(NetworkRequestStatus.idle);
});
break;
default:
// No auto-reset for idle, loading, splitting
break;
}
// Reset recovery timer
_overpassRecoveryTimer?.cancel();
_overpassRecoveryTimer = Timer(const Duration(minutes: 2), () {
_overpassHasIssues = false;
notifyListeners();
debugPrint('[NetworkStatus] Overpass API issues cleared');
});
notifyListeners();
}
/// Report successful operations to potentially clear issues faster
void reportOverpassSuccess() {
if (_overpassHasIssues) {
// Quietly clear - don't log routine success
_overpassHasIssues = false;
_overpassRecoveryTimer?.cancel();
notifyListeners();
}
}
/// Set waiting status (show when loading tiles/cameras)
void setWaiting() {
// Clear any previous timeout/no-data state when starting new wait
_isTimedOut = false;
_hasNoData = false;
_recentOfflineMisses = 0;
_noDataResetTimer?.cancel();
if (!_isWaitingForData) {
_isWaitingForData = true;
notifyListeners();
// Don't log routine waiting - only log if we stay waiting too long
}
// Set timeout for genuine network issues (not 404s)
_waitingTimer?.cancel();
_waitingTimer = Timer(const Duration(seconds: 8), () {
_isWaitingForData = false;
_isTimedOut = true;
debugPrint('[NetworkStatus] Request timed out - likely network issues');
notifyListeners();
});
/// Start loading surveillance data
void setLoading() {
debugPrint('[NetworkStatus] Loading surveillance data');
_setStatus(NetworkRequestStatus.loading);
}
/// Show success status briefly when data loads
/// Request is being split due to complexity/limits
void setSplitting() {
debugPrint('[NetworkStatus] Splitting request due to complexity');
_setStatus(NetworkRequestStatus.splitting);
}
/// Data loaded successfully
void setSuccess() {
_isWaitingForData = false;
_isTimedOut = false;
_hasNoData = false;
_hasSuccess = true;
_recentOfflineMisses = 0;
_waitingTimer?.cancel();
_noDataResetTimer?.cancel();
notifyListeners();
// Auto-clear success status after 2 seconds
_successResetTimer?.cancel();
_successResetTimer = Timer(const Duration(seconds: 2), () {
if (_hasSuccess) {
_hasSuccess = false;
notifyListeners();
}
});
}
/// Show no-data status briefly when tiles aren't available
void setNoData() {
_isWaitingForData = false;
_isTimedOut = false;
_hasSuccess = false;
_hasNoData = true;
_waitingTimer?.cancel();
_successResetTimer?.cancel();
notifyListeners();
// Auto-clear no-data status after 2 seconds
_noDataResetTimer?.cancel();
_noDataResetTimer = Timer(const Duration(seconds: 2), () {
if (_hasNoData) {
_hasNoData = false;
notifyListeners();
}
});
}
/// Clear waiting/timeout/no-data status (legacy method for compatibility)
void clearWaiting() {
if (_isWaitingForData || _isTimedOut || _hasNoData || _hasSuccess) {
_isWaitingForData = false;
_isTimedOut = false;
_hasNoData = false;
_hasSuccess = false;
_recentOfflineMisses = 0;
_waitingTimer?.cancel();
_noDataResetTimer?.cancel();
_successResetTimer?.cancel();
notifyListeners();
}
debugPrint('[NetworkStatus] Surveillance data loaded successfully');
_setStatus(NetworkRequestStatus.success);
}
/// Set timeout error state
void setTimeoutError() {
_isWaitingForData = false;
_isTimedOut = true;
_hasNoData = false;
_hasSuccess = false;
_waitingTimer?.cancel();
_noDataResetTimer?.cancel();
_successResetTimer?.cancel();
notifyListeners();
/// Request timed out
void setTimeout() {
debugPrint('[NetworkStatus] Request timed out');
// Auto-clear timeout after 5 seconds
Timer(const Duration(seconds: 5), () {
if (_isTimedOut) {
_isTimedOut = false;
notifyListeners();
}
});
_setStatus(NetworkRequestStatus.timeout);
}
/// Set network error state (rate limits, connection issues, etc.)
void setNetworkError() {
_isWaitingForData = false;
_isTimedOut = false;
_hasNoData = false;
_hasSuccess = false;
_waitingTimer?.cancel();
_noDataResetTimer?.cancel();
_successResetTimer?.cancel();
// Use existing issue reporting system
reportOverpassIssue();
/// Rate limited by API
void setRateLimited() {
debugPrint('[NetworkStatus] Rate limited by API');
_setStatus(NetworkRequestStatus.rateLimited);
}
/// No offline data available
void setNoData() {
debugPrint('[NetworkStatus] No offline data available');
_setStatus(NetworkRequestStatus.noData);
}
/// Network or other error
void setError() {
debugPrint('[NetworkStatus] Network error occurred');
_setStatus(NetworkRequestStatus.error);
}
/// Report that a tile was not available offline
void reportOfflineMiss() {
_recentOfflineMisses++;
debugPrint('[NetworkStatus] Offline miss #$_recentOfflineMisses');
// If we get several misses in a short time, show "no data" status
if (_recentOfflineMisses >= 3 && !_hasNoData) {
_isWaitingForData = false;
_isTimedOut = false;
_hasNoData = true;
_waitingTimer?.cancel();
notifyListeners();
debugPrint('[NetworkStatus] No offline data available for this area');
}
// Reset the miss counter after some time
_noDataResetTimer?.cancel();
_noDataResetTimer = Timer(const Duration(seconds: 5), () {
_recentOfflineMisses = 0;
});
/// Clear status (force to idle)
void clear() {
_setStatus(NetworkRequestStatus.idle);
}
@override
void dispose() {
_overpassRecoveryTimer?.cancel();
_waitingTimer?.cancel();
_noDataResetTimer?.cancel();
_successResetTimer?.cancel();
_autoResetTimer?.cancel();
super.dispose();
}
}

View File

@@ -1,3 +1,4 @@
import 'package:flutter/foundation.dart';
import 'package:latlong2/latlong.dart';
import '../models/osm_node.dart';
import 'package:flutter_map/flutter_map.dart' show LatLngBounds;
@@ -85,7 +86,7 @@ class NodeCache {
/// Remove a node by ID from the cache (used for successful deletions)
void removeNodeById(int nodeId) {
if (_nodes.remove(nodeId) != null) {
print('[NodeCache] Removed node $nodeId from cache (successful deletion)');
debugPrint('[NodeCache] Removed node $nodeId from cache (successful deletion)');
}
}
@@ -111,19 +112,19 @@ class NodeCache {
}
if (nodesToRemove.isNotEmpty) {
print('[NodeCache] Removed ${nodesToRemove.length} temp nodes at coordinate ${coord.latitude}, ${coord.longitude}');
debugPrint('[NodeCache] Removed ${nodesToRemove.length} temp nodes at coordinate ${coord.latitude}, ${coord.longitude}');
}
}
/// Remove a specific temporary node by its ID (for queue item-specific cleanup)
void removeTempNodeById(int tempNodeId) {
if (tempNodeId >= 0) {
print('[NodeCache] Warning: Attempted to remove non-temp node ID $tempNodeId');
debugPrint('[NodeCache] Warning: Attempted to remove non-temp node ID $tempNodeId');
return;
}
if (_nodes.remove(tempNodeId) != null) {
print('[NodeCache] Removed specific temp node $tempNodeId from cache');
debugPrint('[NodeCache] Removed specific temp node $tempNodeId from cache');
}
}

View File

@@ -0,0 +1,403 @@
import 'dart:async';
import 'package:flutter/widgets.dart';
import 'package:latlong2/latlong.dart';
import 'package:flutter_map/flutter_map.dart';
import '../models/node_profile.dart';
import '../models/osm_node.dart';
import '../app_state.dart';
import 'overpass_service.dart';
import 'node_spatial_cache.dart';
import 'network_status.dart';
import 'map_data_submodules/nodes_from_osm_api.dart';
import 'map_data_submodules/nodes_from_local.dart';
import 'offline_area_service.dart';
import 'offline_areas/offline_area_models.dart';
/// Coordinates node data fetching between cache, Overpass, and OSM API.
/// Simple interface: give me nodes for this view with proper caching and error handling.
class NodeDataManager extends ChangeNotifier {
static final NodeDataManager _instance = NodeDataManager._();
factory NodeDataManager() => _instance;
NodeDataManager._();
final OverpassService _overpassService = OverpassService();
final NodeSpatialCache _cache = NodeSpatialCache();
// Track ongoing user-initiated requests for status reporting
final Set<String> _userInitiatedRequests = <String>{};
/// Get nodes for the given bounds and profiles.
/// Returns cached data immediately if available, otherwise fetches from appropriate source.
Future<List<OsmNode>> getNodesFor({
required LatLngBounds bounds,
required List<NodeProfile> profiles,
UploadMode uploadMode = UploadMode.production,
bool isUserInitiated = false,
}) async {
if (profiles.isEmpty) return [];
// Handle offline mode - no loading states needed, data is instant
if (AppState.instance.offlineMode) {
// Clear any existing loading states since offline data is instant
if (isUserInitiated) {
NetworkStatus.instance.clear();
}
if (uploadMode == UploadMode.sandbox) {
// Offline + Sandbox = no nodes (local cache is production data)
debugPrint('[NodeDataManager] Offline + Sandbox mode: returning no nodes');
return [];
} else {
// Offline + Production = use local offline areas (instant)
final offlineNodes = await fetchLocalNodes(bounds: bounds, profiles: profiles);
// Add offline nodes to cache so they integrate with the rest of the system
if (offlineNodes.isNotEmpty) {
_cache.addOrUpdateNodes(offlineNodes);
// Mark this area as having coverage for submit button logic
_cache.markAreaAsFetched(bounds, offlineNodes);
notifyListeners();
}
// Show brief success for user-initiated offline loads with data
if (isUserInitiated && offlineNodes.isNotEmpty) {
WidgetsBinding.instance.addPostFrameCallback((_) {
NetworkStatus.instance.setSuccess();
});
} else if (isUserInitiated && offlineNodes.isEmpty) {
// Show no data briefly for offline areas with no surveillance devices
WidgetsBinding.instance.addPostFrameCallback((_) {
NetworkStatus.instance.setNoData();
});
}
return offlineNodes;
}
}
// Handle sandbox mode (always fetch from OSM API, but integrate with cache system for UI)
if (uploadMode == UploadMode.sandbox) {
debugPrint('[NodeDataManager] Sandbox mode: fetching from OSM API');
// Track user-initiated requests for status reporting
final requestKey = '${bounds.hashCode}_${profiles.map((p) => p.id).join('_')}_$uploadMode';
if (isUserInitiated && _userInitiatedRequests.contains(requestKey)) {
debugPrint('[NodeDataManager] Sandbox request already in progress for this area');
return _cache.getNodesFor(bounds);
}
// Start status tracking for user-initiated requests
if (isUserInitiated) {
_userInitiatedRequests.add(requestKey);
NetworkStatus.instance.setLoading();
debugPrint('[NodeDataManager] Starting user-initiated sandbox request');
} else {
debugPrint('[NodeDataManager] Starting background sandbox request (no status reporting)');
}
try {
final nodes = await fetchOsmApiNodes(
bounds: bounds,
profiles: profiles,
uploadMode: uploadMode,
maxResults: 0,
);
// Add nodes to cache for UI integration (even though we don't rely on cache for subsequent fetches)
if (nodes.isNotEmpty) {
_cache.addOrUpdateNodes(nodes);
_cache.markAreaAsFetched(bounds, nodes);
} else {
// Mark area as fetched even with no nodes so UI knows we've checked this area
_cache.markAreaAsFetched(bounds, []);
}
// Update UI
notifyListeners();
// Set success after the next frame renders, but only for user-initiated requests
if (isUserInitiated) {
WidgetsBinding.instance.addPostFrameCallback((_) {
NetworkStatus.instance.setSuccess();
});
debugPrint('[NodeDataManager] User-initiated sandbox request completed successfully: ${nodes.length} nodes');
}
return nodes;
} catch (e) {
debugPrint('[NodeDataManager] Sandbox fetch failed: $e');
// Only report errors for user-initiated requests
if (isUserInitiated) {
if (e is RateLimitError) {
NetworkStatus.instance.setRateLimited();
} else if (e.toString().contains('timeout')) {
NetworkStatus.instance.setTimeout();
} else {
NetworkStatus.instance.setError();
}
debugPrint('[NodeDataManager] User-initiated sandbox request failed: $e');
}
// Return whatever we have in cache for this area (likely empty for sandbox)
return _cache.getNodesFor(bounds);
} finally {
if (isUserInitiated) {
_userInitiatedRequests.remove(requestKey);
}
}
}
// Production mode: check cache first
if (_cache.hasDataFor(bounds)) {
debugPrint('[NodeDataManager] Using cached data for bounds');
return _cache.getNodesFor(bounds);
}
// Not cached - need to fetch
final requestKey = '${bounds.hashCode}_${profiles.map((p) => p.id).join('_')}_$uploadMode';
// Only allow one user-initiated request per area at a time
if (isUserInitiated && _userInitiatedRequests.contains(requestKey)) {
debugPrint('[NodeDataManager] User request already in progress for this area');
return _cache.getNodesFor(bounds);
}
// Start status tracking for user-initiated requests only
if (isUserInitiated) {
_userInitiatedRequests.add(requestKey);
NetworkStatus.instance.setLoading();
debugPrint('[NodeDataManager] Starting user-initiated request');
} else {
debugPrint('[NodeDataManager] Starting background request (no status reporting)');
}
try {
final nodes = await fetchWithSplitting(bounds, profiles, isUserInitiated: isUserInitiated);
// Update cache and notify listeners
notifyListeners();
// Set success after the next frame renders, but only for user-initiated requests
if (isUserInitiated) {
WidgetsBinding.instance.addPostFrameCallback((_) {
NetworkStatus.instance.setSuccess();
});
debugPrint('[NodeDataManager] User-initiated request completed successfully');
}
return nodes;
} catch (e) {
debugPrint('[NodeDataManager] Fetch failed: $e');
// Only report errors for user-initiated requests
if (isUserInitiated) {
if (e is RateLimitError) {
NetworkStatus.instance.setRateLimited();
} else if (e.toString().contains('timeout')) {
NetworkStatus.instance.setTimeout();
} else {
NetworkStatus.instance.setError();
}
debugPrint('[NodeDataManager] User-initiated request failed: $e');
}
// Return whatever we have in cache for this area
return _cache.getNodesFor(bounds);
} finally {
if (isUserInitiated) {
_userInitiatedRequests.remove(requestKey);
}
}
}
/// Fetch nodes with automatic area splitting if needed
Future<List<OsmNode>> fetchWithSplitting(
LatLngBounds bounds,
List<NodeProfile> profiles, {
int splitDepth = 0,
bool isUserInitiated = false,
}) async {
const maxSplitDepth = 3; // 4^3 = 64 max sub-areas
try {
// Expand bounds slightly to reduce edge effects
final expandedBounds = _expandBounds(bounds, 1.2);
final nodes = await _overpassService.fetchNodes(
bounds: expandedBounds,
profiles: profiles,
);
// Success - cache the data for the expanded area
_cache.markAreaAsFetched(expandedBounds, nodes);
return nodes;
} on NodeLimitError {
// Hit node limit or timeout - split area if not too deep
if (splitDepth >= maxSplitDepth) {
debugPrint('[NodeDataManager] Max split depth reached, giving up');
return [];
}
debugPrint('[NodeDataManager] Splitting area (depth: $splitDepth)');
// Only report splitting status for user-initiated requests
if (isUserInitiated && splitDepth == 0) {
NetworkStatus.instance.setSplitting();
}
return _fetchSplitAreas(bounds, profiles, splitDepth + 1, isUserInitiated: isUserInitiated);
} on RateLimitError {
// Rate limited - wait and return empty
debugPrint('[NodeDataManager] Rate limited, backing off');
await Future.delayed(const Duration(seconds: 30));
return [];
}
}
/// Fetch data by splitting area into quadrants
Future<List<OsmNode>> _fetchSplitAreas(
LatLngBounds bounds,
List<NodeProfile> profiles,
int splitDepth, {
bool isUserInitiated = false,
}) async {
final quadrants = _splitBounds(bounds);
final allNodes = <OsmNode>[];
for (final quadrant in quadrants) {
try {
final nodes = await fetchWithSplitting(
quadrant,
profiles,
splitDepth: splitDepth,
isUserInitiated: isUserInitiated,
);
allNodes.addAll(nodes);
} catch (e) {
debugPrint('[NodeDataManager] Quadrant fetch failed: $e');
// Continue with other quadrants
}
}
debugPrint('[NodeDataManager] Split fetch complete: ${allNodes.length} total nodes');
return allNodes;
}
/// Split bounds into 4 quadrants
List<LatLngBounds> _splitBounds(LatLngBounds bounds) {
final centerLat = (bounds.north + bounds.south) / 2;
final centerLng = (bounds.east + bounds.west) / 2;
return [
// Southwest
LatLngBounds(LatLng(bounds.south, bounds.west), LatLng(centerLat, centerLng)),
// Southeast
LatLngBounds(LatLng(bounds.south, centerLng), LatLng(centerLat, bounds.east)),
// Northwest
LatLngBounds(LatLng(centerLat, bounds.west), LatLng(bounds.north, centerLng)),
// Northeast
LatLngBounds(LatLng(centerLat, centerLng), LatLng(bounds.north, bounds.east)),
];
}
/// Expand bounds by given factor around center point
LatLngBounds _expandBounds(LatLngBounds bounds, double factor) {
final centerLat = (bounds.north + bounds.south) / 2;
final centerLng = (bounds.east + bounds.west) / 2;
final latSpan = (bounds.north - bounds.south) * factor / 2;
final lngSpan = (bounds.east - bounds.west) * factor / 2;
return LatLngBounds(
LatLng(centerLat - latSpan, centerLng - lngSpan),
LatLng(centerLat + latSpan, centerLng + lngSpan),
);
}
/// Add or update nodes in cache (for upload queue integration)
void addOrUpdateNodes(List<OsmNode> nodes) {
_cache.addOrUpdateNodes(nodes);
notifyListeners();
}
/// Remove node from cache (for deletions)
void removeNodeById(int nodeId) {
_cache.removeNodeById(nodeId);
notifyListeners();
}
/// Clear cache (when profiles change significantly)
void clearCache() {
_cache.clear();
notifyListeners();
}
/// Force refresh for current view (manual retry)
Future<void> refreshArea({
required LatLngBounds bounds,
required List<NodeProfile> profiles,
UploadMode uploadMode = UploadMode.production,
}) async {
// Clear any cached data for this area
_cache.clear();
// Re-fetch as user-initiated request
await getNodesFor(
bounds: bounds,
profiles: profiles,
uploadMode: uploadMode,
isUserInitiated: true,
);
}
/// NodeCache compatibility methods
OsmNode? getNodeById(int nodeId) => _cache.getNodeById(nodeId);
void removePendingEditMarker(int nodeId) => _cache.removePendingEditMarker(nodeId);
void removePendingDeletionMarker(int nodeId) => _cache.removePendingDeletionMarker(nodeId);
void removeTempNodeById(int tempNodeId) => _cache.removeTempNodeById(tempNodeId);
List<OsmNode> findNodesWithinDistance(LatLng coord, double distanceMeters, {int? excludeNodeId}) =>
_cache.findNodesWithinDistance(coord, distanceMeters, excludeNodeId: excludeNodeId);
/// Check if we have good cache coverage for the given area
bool hasGoodCoverageFor(LatLngBounds bounds) {
return _cache.hasDataFor(bounds);
}
/// Load all offline nodes into cache (call at app startup)
Future<void> preloadOfflineNodes() async {
try {
final offlineAreaService = OfflineAreaService();
for (final area in offlineAreaService.offlineAreas) {
if (area.status != OfflineAreaStatus.complete) continue;
// Load nodes from this offline area
final nodes = await fetchLocalNodes(
bounds: area.bounds,
profiles: [], // Empty profiles = load all nodes
);
if (nodes.isNotEmpty) {
_cache.addOrUpdateNodes(nodes);
// Mark the offline area as having coverage so submit buttons work
_cache.markAreaAsFetched(area.bounds, nodes);
debugPrint('[NodeDataManager] Preloaded ${nodes.length} offline nodes from area ${area.name}');
}
}
notifyListeners();
} catch (e) {
debugPrint('[NodeDataManager] Error preloading offline nodes: $e');
}
}
/// Get cache statistics
String get cacheStats => _cache.stats.toString();
}

View File

@@ -0,0 +1,190 @@
import 'package:flutter/foundation.dart';
import 'package:latlong2/latlong.dart';
import 'package:flutter_map/flutter_map.dart';
import '../models/osm_node.dart';
const Distance _distance = Distance();
/// Simple spatial cache that tracks which areas have been successfully fetched.
/// No temporal expiration - data stays cached until app restart or explicit clear.
class NodeSpatialCache {
static final NodeSpatialCache _instance = NodeSpatialCache._();
factory NodeSpatialCache() => _instance;
NodeSpatialCache._();
final List<CachedArea> _fetchedAreas = [];
final Map<int, OsmNode> _nodes = {}; // nodeId -> node
/// Check if we have cached data covering the given bounds
bool hasDataFor(LatLngBounds bounds) {
return _fetchedAreas.any((area) => area.bounds.containsBounds(bounds));
}
/// Record that we successfully fetched data for this area
void markAreaAsFetched(LatLngBounds bounds, List<OsmNode> nodes) {
// Add the fetched area
_fetchedAreas.add(CachedArea(bounds, DateTime.now()));
// Update nodes in cache
for (final node in nodes) {
_nodes[node.id] = node;
}
debugPrint('[NodeSpatialCache] Cached ${nodes.length} nodes for area ${bounds.south.toStringAsFixed(3)},${bounds.west.toStringAsFixed(3)} to ${bounds.north.toStringAsFixed(3)},${bounds.east.toStringAsFixed(3)}');
debugPrint('[NodeSpatialCache] Total areas cached: ${_fetchedAreas.length}, total nodes: ${_nodes.length}');
}
/// Get all cached nodes within the given bounds
List<OsmNode> getNodesFor(LatLngBounds bounds) {
return _nodes.values
.where((node) => bounds.contains(node.coord))
.toList();
}
/// Add or update individual nodes (for upload queue integration)
void addOrUpdateNodes(List<OsmNode> nodes) {
for (final node in nodes) {
final existing = _nodes[node.id];
if (existing != null) {
// Preserve any tags starting with underscore when updating existing nodes
final mergedTags = Map<String, String>.from(node.tags);
for (final entry in existing.tags.entries) {
if (entry.key.startsWith('_')) {
mergedTags[entry.key] = entry.value;
}
}
_nodes[node.id] = OsmNode(
id: node.id,
coord: node.coord,
tags: mergedTags,
isConstrained: node.isConstrained,
);
} else {
_nodes[node.id] = node;
}
}
}
/// Remove a node by ID (for deletions)
void removeNodeById(int nodeId) {
if (_nodes.remove(nodeId) != null) {
debugPrint('[NodeSpatialCache] Removed node $nodeId from cache');
}
}
/// Get a specific node by ID (returns null if not found)
OsmNode? getNodeById(int nodeId) {
return _nodes[nodeId];
}
/// Remove the _pending_edit marker from a specific node
void removePendingEditMarker(int nodeId) {
final node = _nodes[nodeId];
if (node != null && node.tags.containsKey('_pending_edit')) {
final cleanTags = Map<String, String>.from(node.tags);
cleanTags.remove('_pending_edit');
_nodes[nodeId] = OsmNode(
id: node.id,
coord: node.coord,
tags: cleanTags,
isConstrained: node.isConstrained,
);
}
}
/// Remove the _pending_deletion marker from a specific node
void removePendingDeletionMarker(int nodeId) {
final node = _nodes[nodeId];
if (node != null && node.tags.containsKey('_pending_deletion')) {
final cleanTags = Map<String, String>.from(node.tags);
cleanTags.remove('_pending_deletion');
_nodes[nodeId] = OsmNode(
id: node.id,
coord: node.coord,
tags: cleanTags,
isConstrained: node.isConstrained,
);
}
}
/// Remove a specific temporary node by its ID
void removeTempNodeById(int tempNodeId) {
if (tempNodeId >= 0) {
debugPrint('[NodeSpatialCache] Warning: Attempted to remove non-temp node ID $tempNodeId');
return;
}
if (_nodes.remove(tempNodeId) != null) {
debugPrint('[NodeSpatialCache] Removed temp node $tempNodeId from cache');
}
}
/// Find nodes within distance of a coordinate (for proximity warnings)
List<OsmNode> findNodesWithinDistance(LatLng coord, double distanceMeters, {int? excludeNodeId}) {
final nearbyNodes = <OsmNode>[];
for (final node in _nodes.values) {
// Skip the excluded node
if (excludeNodeId != null && node.id == excludeNodeId) {
continue;
}
// Skip nodes marked for deletion
if (node.tags.containsKey('_pending_deletion')) {
continue;
}
final distanceInMeters = _distance.as(LengthUnit.Meter, coord, node.coord);
if (distanceInMeters <= distanceMeters) {
nearbyNodes.add(node);
}
}
return nearbyNodes;
}
/// Clear all cached data
void clear() {
_fetchedAreas.clear();
_nodes.clear();
debugPrint('[NodeSpatialCache] Cache cleared');
}
/// Get cache statistics for debugging
CacheStats get stats => CacheStats(
areasCount: _fetchedAreas.length,
nodesCount: _nodes.length,
);
}
/// Represents an area that has been successfully fetched
class CachedArea {
final LatLngBounds bounds;
final DateTime fetchedAt;
CachedArea(this.bounds, this.fetchedAt);
}
/// Cache statistics for debugging
class CacheStats {
final int areasCount;
final int nodesCount;
CacheStats({required this.areasCount, required this.nodesCount});
@override
String toString() => 'CacheStats(areas: $areasCount, nodes: $nodesCount)';
}
/// Extension to check if one bounds completely contains another
extension LatLngBoundsExtension on LatLngBounds {
bool containsBounds(LatLngBounds other) {
return north >= other.north &&
south <= other.south &&
east >= other.east &&
west <= other.west;
}
}

View File

@@ -1,9 +1,9 @@
import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:http/http.dart' as http;
import '../app_state.dart';
import '../dev_config.dart';
import 'http_client.dart';
/// Service for fetching tag value suggestions from OpenStreetMap Name Suggestion Index
class NSIService {
@@ -11,7 +11,7 @@ class NSIService {
factory NSIService() => _instance;
NSIService._();
static const String _userAgent = 'DeFlock/2.1.0 (OSM surveillance mapping app)';
final _client = UserAgentClient();
static const Duration _timeout = Duration(seconds: 10);
// Cache to avoid repeated API calls
@@ -55,10 +55,7 @@ class NSIService {
'rp': '15', // Get top 15 most commonly used values
});
final response = await http.get(
uri,
headers: {'User-Agent': _userAgent},
).timeout(_timeout);
final response = await _client.get(uri).timeout(_timeout);
if (response.statusCode != 200) {
throw Exception('TagInfo API returned status ${response.statusCode}');
@@ -84,8 +81,7 @@ class NSIService {
}
}
// Limit to top 10 suggestions for UI performance
if (suggestions.length >= 10) break;
if (suggestions.length >= kNSIMaxSuggestions) break;
}
return suggestions;

View File

@@ -1,17 +1,14 @@
import 'dart:io';
import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:latlong2/latlong.dart';
import 'package:flutter_map/flutter_map.dart' show LatLngBounds;
import 'package:path_provider/path_provider.dart';
import 'offline_areas/offline_area_models.dart';
import 'offline_areas/offline_tile_utils.dart';
import 'offline_areas/offline_area_downloader.dart';
import '../models/osm_node.dart';
import '../app_state.dart';
import 'map_data_provider.dart';
import 'package:deflockapp/dev_config.dart';
/// Service for managing download, storage, and retrieval of offline map areas and cameras.
class OfflineAreaService {
@@ -36,14 +33,37 @@ class OfflineAreaService {
if (!_initialized) {
return false; // No offline areas loaded yet
}
return _areas.any((area) =>
return _areas.any((area) =>
area.status == OfflineAreaStatus.complete &&
area.tileProviderId == providerId &&
area.tileTypeId == tileTypeId
);
}
/// Like [hasOfflineAreasForProvider] but also checks that at least one area
/// covers the given [zoom] level. Used by [DeflockTileProvider] to skip the
/// offline-first path for tiles that will never be found locally.
bool hasOfflineAreasForProviderAtZoom(String providerId, String tileTypeId, int zoom) {
if (!_initialized) return false;
return _areas.any((area) =>
area.status == OfflineAreaStatus.complete &&
area.tileProviderId == providerId &&
area.tileTypeId == tileTypeId &&
zoom >= area.minZoom &&
zoom <= area.maxZoom
);
}
/// Reset service state and inject areas for unit tests.
@visibleForTesting
void setAreasForTesting(List<OfflineArea> areas) {
_areas
..clear()
..addAll(areas);
_initialized = true;
}
/// Cancel all active downloads (used when enabling offline mode)
Future<void> cancelActiveDownloads() async {
final activeAreas = _areas.where((area) => area.status == OfflineAreaStatus.downloading).toList();
@@ -216,7 +236,7 @@ class OfflineAreaService {
area = OfflineArea(
id: id,
name: name ?? area?.name ?? '',
bounds: bounds,
bounds: normalizeBounds(bounds),
minZoom: minZoom,
maxZoom: maxZoom,
directory: directory,

View File

@@ -1,6 +1,7 @@
import 'package:latlong2/latlong.dart';
import 'package:flutter_map/flutter_map.dart' show LatLngBounds;
import '../../models/osm_node.dart';
import 'offline_tile_utils.dart' show normalizeBounds;
/// Status of an offline area
enum OfflineAreaStatus { downloading, complete, error, cancelled }
@@ -71,10 +72,10 @@ class OfflineArea {
};
static OfflineArea fromJson(Map<String, dynamic> json) {
final bounds = LatLngBounds(
final bounds = normalizeBounds(LatLngBounds(
LatLng(json['bounds']['sw']['lat'], json['bounds']['sw']['lng']),
LatLng(json['bounds']['ne']['lat'], json['bounds']['ne']['lng']),
);
));
return OfflineArea(
id: json['id'],
name: json['name'] ?? '',

View File

@@ -4,14 +4,15 @@ import 'package:flutter_map/flutter_map.dart' show LatLngBounds;
/// Utility for tile calculations and lat/lon conversions for OSM offline logic
Set<List<int>> computeTileList(LatLngBounds bounds, int zMin, int zMax) {
Set<List<int>> tiles = {};
/// Normalize bounds so south ≤ north, west ≤ east, and degenerate (near-zero)
/// spans are expanded by epsilon. Call this before storing bounds so that
/// `tileInBounds` and [computeTileList] see consistent corner ordering.
LatLngBounds normalizeBounds(LatLngBounds bounds) {
const double epsilon = 1e-7;
double latMin = min(bounds.southWest.latitude, bounds.northEast.latitude);
double latMax = max(bounds.southWest.latitude, bounds.northEast.latitude);
double lonMin = min(bounds.southWest.longitude, bounds.northEast.longitude);
double lonMax = max(bounds.southWest.longitude, bounds.northEast.longitude);
// Expand degenerate/flat areas a hair
var latMin = min(bounds.southWest.latitude, bounds.northEast.latitude);
var latMax = max(bounds.southWest.latitude, bounds.northEast.latitude);
var lonMin = min(bounds.southWest.longitude, bounds.northEast.longitude);
var lonMax = max(bounds.southWest.longitude, bounds.northEast.longitude);
if ((latMax - latMin).abs() < epsilon) {
latMin -= epsilon;
latMax += epsilon;
@@ -20,6 +21,16 @@ Set<List<int>> computeTileList(LatLngBounds bounds, int zMin, int zMax) {
lonMin -= epsilon;
lonMax += epsilon;
}
return LatLngBounds(LatLng(latMin, lonMin), LatLng(latMax, lonMax));
}
Set<List<int>> computeTileList(LatLngBounds bounds, int zMin, int zMax) {
Set<List<int>> tiles = {};
final normalized = normalizeBounds(bounds);
final double latMin = normalized.south;
final double latMax = normalized.north;
final double lonMin = normalized.west;
final double lonMax = normalized.east;
for (int z = zMin; z <= zMax; z++) {
final n = pow(2, z).toInt();
final minTileRaw = latLonToTileRaw(latMin, lonMin, z);

View File

@@ -1,10 +1,11 @@
import 'dart:convert';
import 'package:http/http.dart' as http;
import '../state/settings_state.dart';
import 'http_client.dart';
/// Service for checking OSM user messages
class OSMMessagesService {
static const _messageCheckCacheDuration = Duration(minutes: 5);
final _client = UserAgentClient();
DateTime? _lastCheck;
int? _lastUnreadCount;
@@ -38,7 +39,7 @@ class OSMMessagesService {
try {
final apiHost = _getApiHost(uploadMode);
final response = await http.get(
final response = await _client.get(
Uri.parse('$apiHost/api/0.6/user/details.json'),
headers: {'Authorization': 'Bearer $accessToken'},
);

View File

@@ -0,0 +1,201 @@
import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:http/http.dart' as http;
import 'package:latlong2/latlong.dart';
import 'package:flutter_map/flutter_map.dart';
import '../models/node_profile.dart';
import '../models/osm_node.dart';
import '../dev_config.dart';
import 'http_client.dart';
import 'service_policy.dart';
/// Simple Overpass API client with retry and fallback logic.
/// Single responsibility: Make requests, handle network errors, return data.
class OverpassService {
static const String defaultEndpoint = 'https://overpass.deflock.org/api/interpreter';
static const String fallbackEndpoint = 'https://overpass-api.de/api/interpreter';
static const _policy = ResiliencePolicy(
maxRetries: 3,
httpTimeout: Duration(seconds: 45),
);
final http.Client _client;
/// Optional override endpoint. When null, uses [defaultEndpoint].
final String? _endpointOverride;
OverpassService({http.Client? client, String? endpoint})
: _client = client ?? UserAgentClient(),
_endpointOverride = endpoint;
/// Resolve the primary endpoint: constructor override or default.
String get _primaryEndpoint => _endpointOverride ?? defaultEndpoint;
/// Fetch surveillance nodes from Overpass API with retry and fallback.
/// Throws NetworkError for retryable failures, NodeLimitError for area splitting.
Future<List<OsmNode>> fetchNodes({
required LatLngBounds bounds,
required List<NodeProfile> profiles,
ResiliencePolicy? policy,
}) async {
if (profiles.isEmpty) return [];
final query = _buildQuery(bounds, profiles);
final endpoint = _primaryEndpoint;
final canFallback = _endpointOverride == null;
final effectivePolicy = policy ?? _policy;
return executeWithFallback<List<OsmNode>>(
primaryUrl: endpoint,
fallbackUrl: canFallback ? fallbackEndpoint : null,
execute: (url) => _attemptFetch(url, query, effectivePolicy),
classifyError: _classifyError,
policy: effectivePolicy,
);
}
/// Single POST + parse attempt (no retry logic — handled by executeWithFallback).
Future<List<OsmNode>> _attemptFetch(String endpoint, String query, ResiliencePolicy policy) async {
debugPrint('[OverpassService] POST $endpoint');
try {
final response = await _client.post(
Uri.parse(endpoint),
body: {'data': query},
).timeout(policy.httpTimeout);
if (response.statusCode == 200) {
return _parseResponse(response.body);
}
final errorBody = response.body;
// Node limit error - caller should split area
if (response.statusCode == 400 &&
(errorBody.contains('too many nodes') && errorBody.contains('50000'))) {
debugPrint('[OverpassService] Node limit exceeded, area should be split');
throw NodeLimitError('Query exceeded 50k node limit');
}
// Timeout error - also try splitting (complex query)
if (errorBody.contains('timeout') ||
errorBody.contains('runtime limit exceeded') ||
errorBody.contains('Query timed out')) {
debugPrint('[OverpassService] Query timeout, area should be split');
throw NodeLimitError('Query timed out - area too complex');
}
// Rate limit
if (response.statusCode == 429 ||
errorBody.contains('rate limited') ||
errorBody.contains('too many requests')) {
debugPrint('[OverpassService] Rate limited by Overpass');
throw RateLimitError('Rate limited by Overpass API');
}
throw NetworkError('HTTP ${response.statusCode}: $errorBody');
} catch (e) {
if (e is NodeLimitError || e is RateLimitError || e is NetworkError) {
rethrow;
}
throw NetworkError('Network error: $e');
}
}
static ErrorDisposition _classifyError(Object error) {
if (error is NodeLimitError) return ErrorDisposition.abort;
if (error is RateLimitError) return ErrorDisposition.fallback;
return ErrorDisposition.retry;
}
/// Build Overpass QL query for given bounds and profiles
String _buildQuery(LatLngBounds bounds, List<NodeProfile> profiles) {
final nodeClauses = profiles.map((profile) {
// Convert profile tags to Overpass filter format, excluding empty values
final tagFilters = profile.tags.entries
.where((entry) => entry.value.trim().isNotEmpty)
.map((entry) => '["${entry.key}"="${entry.value}"]')
.join();
return 'node$tagFilters(${bounds.southWest.latitude},${bounds.southWest.longitude},${bounds.northEast.latitude},${bounds.northEast.longitude});';
}).join('\n ');
return '''
[out:json][timeout:${kOverpassQueryTimeout.inSeconds}];
(
$nodeClauses
);
out body;
(
way(bn);
rel(bn);
);
out skel;
''';
}
/// Parse Overpass JSON response into OsmNode objects
List<OsmNode> _parseResponse(String responseBody) {
final data = jsonDecode(responseBody) as Map<String, dynamic>;
final elements = data['elements'] as List<dynamic>;
final nodeElements = <Map<String, dynamic>>[];
final constrainedNodeIds = <int>{};
// First pass: collect surveillance nodes and identify constrained nodes
for (final element in elements.whereType<Map<String, dynamic>>()) {
final type = element['type'] as String?;
if (type == 'node') {
nodeElements.add(element);
} else if (type == 'way' || type == 'relation') {
// Mark referenced nodes as constrained
final refs = element['nodes'] as List<dynamic>? ??
element['members']?.where((m) => m['type'] == 'node').map((m) => m['ref']) ?? [];
for (final ref in refs) {
final nodeId = ref is int ? ref : int.tryParse(ref.toString());
if (nodeId != null) constrainedNodeIds.add(nodeId);
}
}
}
// Second pass: create OsmNode objects
final nodes = nodeElements.map((element) {
final nodeId = element['id'] as int;
return OsmNode(
id: nodeId,
coord: LatLng(element['lat'], element['lon']),
tags: Map<String, String>.from(element['tags'] ?? {}),
isConstrained: constrainedNodeIds.contains(nodeId),
);
}).toList();
debugPrint('[OverpassService] Parsed ${nodes.length} nodes, ${constrainedNodeIds.length} constrained');
return nodes;
}
}
/// Error thrown when query exceeds node limits or is too complex - area should be split
class NodeLimitError extends Error {
final String message;
NodeLimitError(this.message);
@override
String toString() => 'NodeLimitError: $message';
}
/// Error thrown when rate limited - should not retry immediately
class RateLimitError extends Error {
final String message;
RateLimitError(this.message);
@override
String toString() => 'RateLimitError: $message';
}
/// Error thrown for network/HTTP issues - retryable
class NetworkError extends Error {
final String message;
NetworkError(this.message);
@override
String toString() => 'NetworkError: $message';
}

View File

@@ -1,192 +0,0 @@
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:latlong2/latlong.dart';
import 'package:flutter_map/flutter_map.dart';
import '../models/node_profile.dart';
import '../models/osm_node.dart';
import '../app_state.dart';
import '../dev_config.dart';
import 'map_data_submodules/nodes_from_overpass.dart';
import 'node_cache.dart';
import 'network_status.dart';
import '../widgets/node_provider_with_cache.dart';
/// Manages pre-fetching larger areas to reduce Overpass API calls.
/// Uses zoom level 10 areas and automatically splits if hitting node limits.
class PrefetchAreaService {
static final PrefetchAreaService _instance = PrefetchAreaService._();
factory PrefetchAreaService() => _instance;
PrefetchAreaService._();
// Current pre-fetched area and associated data
LatLngBounds? _preFetchedArea;
List<NodeProfile>? _preFetchedProfiles;
UploadMode? _preFetchedUploadMode;
DateTime? _lastFetchTime;
bool _preFetchInProgress = false;
// Debounce timer to avoid rapid requests while user is panning
Timer? _debounceTimer;
// Configuration from dev_config
static const double _areaExpansionMultiplier = kPreFetchAreaExpansionMultiplier;
static const int _preFetchZoomLevel = kPreFetchZoomLevel;
/// Check if the given bounds are fully within the current pre-fetched area.
bool isWithinPreFetchedArea(LatLngBounds bounds, List<NodeProfile> profiles, UploadMode uploadMode) {
if (_preFetchedArea == null || _preFetchedProfiles == null || _preFetchedUploadMode == null) {
return false;
}
// Check if profiles and upload mode match
if (_preFetchedUploadMode != uploadMode) {
return false;
}
if (!_profileListsEqual(_preFetchedProfiles!, profiles)) {
return false;
}
// Check if bounds are fully contained within pre-fetched area
return bounds.north <= _preFetchedArea!.north &&
bounds.south >= _preFetchedArea!.south &&
bounds.east <= _preFetchedArea!.east &&
bounds.west >= _preFetchedArea!.west;
}
/// Check if cached data is stale (older than configured refresh interval).
bool isDataStale() {
if (_lastFetchTime == null) return true;
return DateTime.now().difference(_lastFetchTime!).inSeconds > kDataRefreshIntervalSeconds;
}
/// Request pre-fetch for the given view bounds if not already covered or if data is stale.
/// Uses debouncing to avoid rapid requests while user is panning.
void requestPreFetchIfNeeded({
required LatLngBounds viewBounds,
required List<NodeProfile> profiles,
required UploadMode uploadMode,
}) {
// Skip if already in progress
if (_preFetchInProgress) {
debugPrint('[PrefetchAreaService] Pre-fetch already in progress, skipping');
return;
}
// Check both spatial and temporal conditions
final isWithinArea = isWithinPreFetchedArea(viewBounds, profiles, uploadMode);
final isStale = isDataStale();
if (isWithinArea && !isStale) {
debugPrint('[PrefetchAreaService] Current view within fresh pre-fetched area, no fetch needed');
return;
}
if (isStale) {
debugPrint('[PrefetchAreaService] Data is stale (>${kDataRefreshIntervalSeconds}s), refreshing');
} else {
debugPrint('[PrefetchAreaService] Current view outside pre-fetched area, fetching larger area');
}
// Cancel any pending debounced request
_debounceTimer?.cancel();
// Debounce to avoid rapid requests while user is still moving
_debounceTimer = Timer(const Duration(milliseconds: 800), () {
_startPreFetch(
viewBounds: viewBounds,
profiles: profiles,
uploadMode: uploadMode,
);
});
}
/// Start the actual pre-fetch operation.
Future<void> _startPreFetch({
required LatLngBounds viewBounds,
required List<NodeProfile> profiles,
required UploadMode uploadMode,
}) async {
if (_preFetchInProgress) return;
_preFetchInProgress = true;
try {
// Calculate expanded area for pre-fetching
final preFetchArea = _expandBounds(viewBounds, _areaExpansionMultiplier);
debugPrint('[PrefetchAreaService] Starting pre-fetch for area: ${preFetchArea.south},${preFetchArea.west} to ${preFetchArea.north},${preFetchArea.east}');
// Fetch nodes for the expanded area (unlimited - let splitting handle 50k limit)
final nodes = await fetchOverpassNodes(
bounds: preFetchArea,
profiles: profiles,
uploadMode: uploadMode,
maxResults: 0, // Unlimited - our splitting system handles the 50k limit gracefully
);
debugPrint('[PrefetchAreaService] Pre-fetch completed: ${nodes.length} nodes retrieved');
// Update cache with new nodes (fresh data overwrites stale, but preserves underscore tags)
if (nodes.isNotEmpty) {
NodeCache.instance.addOrUpdate(nodes);
}
// Store the pre-fetched area info and timestamp
_preFetchedArea = preFetchArea;
_preFetchedProfiles = List.from(profiles);
_preFetchedUploadMode = uploadMode;
_lastFetchTime = DateTime.now();
// The overpass module already reported success/failure during fetching
// We just need to handle the successful result here
// Notify UI that cache has been updated with fresh data
NodeProviderWithCache.instance.refreshDisplay();
} catch (e) {
debugPrint('[PrefetchAreaService] Pre-fetch failed: $e');
// The overpass module already reported the error status
// Don't update pre-fetched area info on failure
} finally {
_preFetchInProgress = false;
}
}
/// Expand bounds by the given multiplier, maintaining center point.
LatLngBounds _expandBounds(LatLngBounds bounds, double multiplier) {
final centerLat = (bounds.north + bounds.south) / 2;
final centerLng = (bounds.east + bounds.west) / 2;
final latSpan = (bounds.north - bounds.south) * multiplier / 2;
final lngSpan = (bounds.east - bounds.west) * multiplier / 2;
return LatLngBounds(
LatLng(centerLat - latSpan, centerLng - lngSpan), // Southwest
LatLng(centerLat + latSpan, centerLng + lngSpan), // Northeast
);
}
/// Check if two profile lists are equal by comparing IDs.
bool _profileListsEqual(List<NodeProfile> list1, List<NodeProfile> list2) {
if (list1.length != list2.length) return false;
final ids1 = list1.map((p) => p.id).toSet();
final ids2 = list2.map((p) => p.id).toSet();
return ids1.length == ids2.length && ids1.containsAll(ids2);
}
/// Clear the pre-fetched area (e.g., when profiles change significantly).
void clearPreFetchedArea() {
_preFetchedArea = null;
_preFetchedProfiles = null;
_preFetchedUploadMode = null;
_lastFetchTime = null;
debugPrint('[PrefetchAreaService] Pre-fetched area cleared');
}
/// Dispose of resources.
void dispose() {
_debounceTimer?.cancel();
}
}

View File

@@ -0,0 +1,120 @@
import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:uuid/uuid.dart';
import '../models/node_profile.dart';
class ProfileImportService {
// Maximum size for base64 encoded profile data (approx 50KB decoded)
static const int maxBase64Length = 70000;
/// Parse and validate a profile from a base64-encoded JSON string
/// Returns null if parsing/validation fails
static NodeProfile? parseProfileFromBase64(String base64Data) {
try {
// Basic size validation before expensive decode
if (base64Data.length > maxBase64Length) {
debugPrint('[ProfileImportService] Base64 data too large: ${base64Data.length} characters');
return null;
}
// Decode base64
final jsonBytes = base64Decode(base64Data);
final jsonString = utf8.decode(jsonBytes);
// Parse JSON
final jsonData = jsonDecode(jsonString) as Map<String, dynamic>;
// Validate and sanitize the profile data
final sanitizedProfile = _validateAndSanitizeProfile(jsonData);
return sanitizedProfile;
} catch (e) {
debugPrint('[ProfileImportService] Failed to parse profile from base64: $e');
return null;
}
}
/// Validate profile structure and sanitize all string values
static NodeProfile? _validateAndSanitizeProfile(Map<String, dynamic> data) {
try {
// Extract and sanitize required fields
final name = _sanitizeString(data['name']);
if (name == null || name.isEmpty) {
debugPrint('[ProfileImportService] Profile name is required');
return null;
}
// Extract and sanitize tags
final tagsData = data['tags'];
if (tagsData is! Map<String, dynamic>) {
debugPrint('[ProfileImportService] Profile tags must be a map');
return null;
}
final sanitizedTags = <String, String>{};
for (final entry in tagsData.entries) {
final key = _sanitizeString(entry.key);
final value = _sanitizeString(entry.value);
if (key != null && key.isNotEmpty) {
// Allow empty values for refinement purposes
sanitizedTags[key] = value ?? '';
}
}
if (sanitizedTags.isEmpty) {
debugPrint('[ProfileImportService] Profile must have at least one valid tag');
return null;
}
// Extract optional fields with defaults
final requiresDirection = data['requiresDirection'] ?? true;
final submittable = data['submittable'] ?? true;
// Parse FOV if provided
double? fov;
if (data['fov'] != null) {
if (data['fov'] is num) {
final fovValue = (data['fov'] as num).toDouble();
if (fovValue > 0 && fovValue <= 360) {
fov = fovValue;
}
}
}
return NodeProfile(
id: const Uuid().v4(), // Always generate new ID for imported profiles
name: name,
tags: sanitizedTags,
builtin: false, // Imported profiles are always custom
requiresDirection: requiresDirection is bool ? requiresDirection : true,
submittable: submittable is bool ? submittable : true,
editable: true, // Imported profiles are always editable
fov: fov,
);
} catch (e) {
debugPrint('[ProfileImportService] Failed to validate profile: $e');
return null;
}
}
/// Sanitize a string value by trimming and removing potentially harmful characters
static String? _sanitizeString(dynamic value) {
if (value == null) return null;
final str = value.toString().trim();
// Remove control characters and limit length
final sanitized = str.replaceAll(RegExp(r'[\x00-\x1F\x7F]'), '');
// Limit length to prevent abuse
const maxLength = 500;
if (sanitized.length > maxLength) {
return sanitized.substring(0, maxLength);
}
return sanitized;
}
}

View File

@@ -0,0 +1,106 @@
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:path/path.dart' as p;
import 'package:path_provider/path_provider.dart';
import 'provider_tile_cache_store.dart';
import 'service_policy.dart';
/// Factory and registry for per-provider [ProviderTileCacheStore] instances.
///
/// Creates cache stores under `{appCacheDir}/tile_cache/{providerId}/{tileTypeId}/`.
/// Call [init] once at startup (e.g., from TileLayerManager.initialize) to
/// resolve the platform cache directory. After init, [getOrCreate] is
/// synchronous — the cache store lazily creates its directory on first write.
class ProviderTileCacheManager {
static final Map<String, ProviderTileCacheStore> _stores = {};
static String? _baseCacheDir;
/// Resolve the platform cache directory. Call once at startup.
static Future<void> init() async {
if (_baseCacheDir != null) return;
final cacheDir = await getApplicationCacheDirectory();
_baseCacheDir = p.join(cacheDir.path, 'tile_cache');
}
/// Whether the manager has been initialized.
static bool get isInitialized => _baseCacheDir != null;
/// Get or create a cache store for a specific provider/tile type combination.
///
/// Synchronous after [init] has been called. The cache store lazily creates
/// its directory on first write.
static ProviderTileCacheStore getOrCreate({
required String providerId,
required String tileTypeId,
required ServicePolicy policy,
int? maxCacheBytes,
}) {
if (_baseCacheDir == null) {
throw StateError(
'ProviderTileCacheManager.init() must be called before getOrCreate()',
);
}
final key = '$providerId/$tileTypeId';
if (_stores.containsKey(key)) return _stores[key]!;
final cacheDir = p.join(_baseCacheDir!, providerId, tileTypeId);
final store = ProviderTileCacheStore(
cacheDirectory: cacheDir,
maxCacheBytes: maxCacheBytes ?? 500 * 1024 * 1024,
overrideFreshAge: policy.minCacheTtl,
);
_stores[key] = store;
return store;
}
/// Delete a specific provider's cache directory and remove the store.
static Future<void> deleteCache(String providerId, String tileTypeId) async {
final key = '$providerId/$tileTypeId';
final store = _stores.remove(key);
if (store != null) {
await store.clear();
} else if (_baseCacheDir != null) {
final cacheDir = Directory(p.join(_baseCacheDir!, providerId, tileTypeId));
if (await cacheDir.exists()) {
await cacheDir.delete(recursive: true);
}
}
}
/// Get estimated cache sizes for all active stores.
///
/// Returns a map of `providerId/tileTypeId` → size in bytes.
static Future<Map<String, int>> getCacheSizes() async {
final sizes = <String, int>{};
for (final entry in _stores.entries) {
sizes[entry.key] = await entry.value.estimatedSizeBytes;
}
return sizes;
}
/// Remove a store from the registry (e.g., when a provider is disposed).
static void unregister(String providerId, String tileTypeId) {
_stores.remove('$providerId/$tileTypeId');
}
/// Clear all stores and reset the registry (for testing).
@visibleForTesting
static Future<void> resetAll() async {
for (final store in _stores.values) {
await store.clear();
}
_stores.clear();
_baseCacheDir = null;
}
/// Set the base cache directory directly (for testing).
@visibleForTesting
static void setBaseCacheDir(String dir) {
_baseCacheDir = dir;
}
}

View File

@@ -0,0 +1,315 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:path/path.dart' as p;
import 'package:uuid/uuid.dart';
/// Per-provider tile cache implementing flutter_map's [MapCachingProvider].
///
/// Each instance manages an isolated cache directory with:
/// - Deterministic UUID v5 key generation from tile URLs
/// - Optional TTL override from [ServicePolicy.minCacheTtl]
/// - Configurable max cache size with oldest-modified eviction
///
/// Files are stored as `{key}.tile` (image bytes) and `{key}.meta` (JSON
/// metadata containing staleAt, lastModified, etag).
class ProviderTileCacheStore implements MapCachingProvider {
final String cacheDirectory;
final int maxCacheBytes;
final Duration? overrideFreshAge;
static const _uuid = Uuid();
/// Running estimate of cache size in bytes. Initialized lazily on first
/// [putTile] call to avoid blocking construction.
int? _estimatedSize;
/// Throttle: don't re-scan more than once per minute.
DateTime? _lastPruneCheck;
/// One-shot latch for lazy directory creation (safe under concurrent calls).
Completer<void>? _directoryReady;
/// Guard against concurrent eviction runs.
bool _isEvicting = false;
ProviderTileCacheStore({
required this.cacheDirectory,
this.maxCacheBytes = 500 * 1024 * 1024, // 500 MB default
this.overrideFreshAge,
});
@override
bool get isSupported => true;
@override
Future<CachedMapTile?> getTile(String url) async {
final key = keyFor(url);
final tileFile = File(p.join(cacheDirectory, '$key.tile'));
final metaFile = File(p.join(cacheDirectory, '$key.meta'));
try {
final bytes = await tileFile.readAsBytes();
final metaJson = json.decode(await metaFile.readAsString())
as Map<String, dynamic>;
final metadata = CachedMapTileMetadata(
staleAt: DateTime.fromMillisecondsSinceEpoch(
metaJson['staleAt'] as int,
isUtc: true,
),
lastModified: metaJson['lastModified'] != null
? DateTime.fromMillisecondsSinceEpoch(
metaJson['lastModified'] as int,
isUtc: true,
)
: null,
etag: metaJson['etag'] as String?,
);
return (bytes: bytes, metadata: metadata);
} on PathNotFoundException {
return null;
} catch (e) {
throw CachedMapTileReadFailure(
url: url,
description: 'Failed to read cached tile',
originalError: e,
);
}
}
@override
Future<void> putTile({
required String url,
required CachedMapTileMetadata metadata,
Uint8List? bytes,
}) async {
await _ensureDirectory();
final key = keyFor(url);
final tileFile = File(p.join(cacheDirectory, '$key.tile'));
final metaFile = File(p.join(cacheDirectory, '$key.meta'));
// Apply minimum TTL override if configured (e.g., OSM 7-day minimum).
// Use the later of server-provided staleAt and our minimum to avoid
// accidentally shortening a longer server-provided freshness lifetime.
final effectiveMetadata = overrideFreshAge != null
? (() {
final overrideStaleAt = DateTime.timestamp().add(overrideFreshAge!);
final staleAt = metadata.staleAt.isAfter(overrideStaleAt)
? metadata.staleAt
: overrideStaleAt;
return CachedMapTileMetadata(
staleAt: staleAt,
lastModified: metadata.lastModified,
etag: metadata.etag,
);
})()
: metadata;
final metaJson = json.encode({
'staleAt': effectiveMetadata.staleAt.millisecondsSinceEpoch,
'lastModified':
effectiveMetadata.lastModified?.millisecondsSinceEpoch,
'etag': effectiveMetadata.etag,
});
// Write .tile before .meta: if we crash between the two writes, the
// read path's both-must-exist check sees a miss rather than an orphan .meta.
if (bytes != null) {
await tileFile.writeAsBytes(bytes);
}
await metaFile.writeAsString(metaJson);
// Reset size estimate so it resyncs from disk on next check.
// This avoids drift from overwrites where the old size isn't subtracted.
_estimatedSize = null;
// Schedule lazy size check
_scheduleEvictionCheck();
}
/// Ensure the cache directory exists (lazy creation on first write).
///
/// Uses a Completer latch so concurrent callers share a single create().
/// Safe under Dart's single-threaded event loop: the null check and
/// assignment happen in the same synchronous block with no `await`
/// between them, so no other microtask can interleave.
Future<void> _ensureDirectory() {
if (_directoryReady == null) {
final completer = Completer<void>();
_directoryReady = completer;
Directory(cacheDirectory).create(recursive: true).then(
(_) => completer.complete(),
onError: (Object error, StackTrace stackTrace) {
// Reset latch on error so later calls can retry directory creation.
if (identical(_directoryReady, completer)) {
_directoryReady = null;
}
completer.completeError(error, stackTrace);
},
);
}
return _directoryReady!.future;
}
/// Generate a cache key from URL using UUID v5 (same as flutter_map built-in).
@visibleForTesting
static String keyFor(String url) => _uuid.v5(Namespace.url.value, url);
/// Estimate total cache size (lazy, first call scans directory).
Future<int> _getEstimatedSize() async {
if (_estimatedSize != null) return _estimatedSize!;
final dir = Directory(cacheDirectory);
if (!await dir.exists()) {
_estimatedSize = 0;
return 0;
}
var total = 0;
await for (final entity in dir.list()) {
if (entity is File) {
total += await entity.length();
}
}
_estimatedSize = total;
return total;
}
/// Schedule eviction if we haven't checked recently.
void _scheduleEvictionCheck() {
final now = DateTime.now();
if (_lastPruneCheck != null &&
now.difference(_lastPruneCheck!) < const Duration(minutes: 1)) {
return;
}
_lastPruneCheck = now;
// Fire-and-forget: eviction is best-effort background work.
// _estimatedSize may be momentarily stale between eviction start and
// completion, but this is acceptable — the guard only needs to be
// approximately correct to prevent unbounded growth, and the throttle
// ensures we re-check within a minute.
// ignore: discarded_futures
_evictIfNeeded();
}
/// Evict oldest-modified tiles if cache exceeds size limit.
///
/// Sorts by file mtime (oldest first), not by last access — true LRU would
/// require touching files on every [getTile] read, adding I/O on the hot
/// path. In practice write-recency tracks usage well because tiles are
/// immutable and flutter_map holds visible tiles in memory.
///
/// Guarded by [_isEvicting] to prevent concurrent runs from corrupting
/// [_estimatedSize].
Future<void> _evictIfNeeded() async {
if (_isEvicting) return;
_isEvicting = true;
try {
final currentSize = await _getEstimatedSize();
if (currentSize <= maxCacheBytes) return;
final dir = Directory(cacheDirectory);
if (!await dir.exists()) return;
// Collect all files, separating .tile and .meta for eviction + orphan cleanup.
final tileFiles = <File>[];
final metaFiles = <String>{};
await for (final entity in dir.list()) {
if (entity is File) {
if (entity.path.endsWith('.tile')) {
tileFiles.add(entity);
} else if (entity.path.endsWith('.meta')) {
metaFiles.add(p.basenameWithoutExtension(entity.path));
}
}
}
if (tileFiles.isEmpty) return;
// Sort by modification time, oldest first
final stats = await Future.wait(
tileFiles.map((f) async => (file: f, stat: await f.stat())),
);
stats.sort((a, b) => a.stat.modified.compareTo(b.stat.modified));
var freedBytes = 0;
final targetSize = (maxCacheBytes * 0.8).toInt(); // Free down to 80%
final evictedKeys = <String>{};
for (final entry in stats) {
if (currentSize - freedBytes <= targetSize) break;
final key = p.basenameWithoutExtension(entry.file.path);
final metaFile = File(p.join(cacheDirectory, '$key.meta'));
try {
await entry.file.delete();
freedBytes += entry.stat.size;
evictedKeys.add(key);
if (await metaFile.exists()) {
final metaStat = await metaFile.stat();
await metaFile.delete();
freedBytes += metaStat.size;
}
} catch (e) {
debugPrint('[ProviderTileCacheStore] Failed to evict $key: $e');
}
}
// Clean up orphan .meta files (no matching .tile file).
// Exclude keys we just evicted — their .tile is gone so they're orphans.
final remainingTileKeys = tileFiles
.map((f) => p.basenameWithoutExtension(f.path))
.toSet()
..removeAll(evictedKeys);
for (final metaKey in metaFiles) {
if (!remainingTileKeys.contains(metaKey)) {
try {
final orphan = File(p.join(cacheDirectory, '$metaKey.meta'));
final orphanStat = await orphan.stat();
await orphan.delete();
freedBytes += orphanStat.size;
} catch (_) {
// Best-effort cleanup
}
}
}
_estimatedSize = currentSize - freedBytes;
debugPrint(
'[ProviderTileCacheStore] Evicted ${freedBytes ~/ 1024}KB '
'from $cacheDirectory',
);
} catch (e) {
debugPrint('[ProviderTileCacheStore] Eviction error: $e');
} finally {
_isEvicting = false;
}
}
/// Delete all cached tiles in this store's directory.
Future<void> clear() async {
final dir = Directory(cacheDirectory);
if (await dir.exists()) {
await dir.delete(recursive: true);
}
_estimatedSize = null;
_directoryReady = null; // Allow lazy re-creation
_lastPruneCheck = null; // Reset throttle so next write can trigger eviction
}
/// Get the current estimated cache size in bytes.
Future<int> get estimatedSizeBytes => _getEstimatedSize();
/// Force an eviction check, bypassing the throttle.
/// Only exposed for testing — production code uses [_scheduleEvictionCheck].
@visibleForTesting
Future<void> forceEviction() => _evictIfNeeded();
}

View File

@@ -41,9 +41,9 @@ class ProximityAlertService {
const androidSettings = AndroidInitializationSettings('@mipmap/ic_launcher');
const iosSettings = DarwinInitializationSettings(
requestAlertPermission: true,
requestBadgePermission: true,
requestSoundPermission: true,
requestAlertPermission: false,
requestBadgePermission: false,
requestSoundPermission: false,
);
const initSettings = InitializationSettings(
@@ -55,12 +55,10 @@ class ProximityAlertService {
final initialized = await _notifications!.initialize(initSettings);
_isInitialized = initialized ?? false;
// Request notification permissions (especially important for Android 13+)
if (_isInitialized) {
await _requestNotificationPermissions();
}
// Note: We don't request notification permissions here anymore.
// Permissions are requested on-demand when user enables proximity alerts.
debugPrint('[ProximityAlertService] Initialized: $_isInitialized');
debugPrint('[ProximityAlertService] Initialized: $_isInitialized (permissions deferred)');
} catch (e) {
debugPrint('[ProximityAlertService] Failed to initialize: $e');
_isInitialized = false;

View File

@@ -5,19 +5,20 @@ import 'package:latlong2/latlong.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../app_state.dart';
import '../dev_config.dart';
import 'http_client.dart';
import 'service_policy.dart';
class RouteResult {
final List<LatLng> waypoints;
final double distanceMeters;
final double durationSeconds;
const RouteResult({
required this.waypoints,
required this.distanceMeters,
required this.durationSeconds,
});
@override
String toString() {
return 'RouteResult(waypoints: ${waypoints.length}, distance: ${(distanceMeters/1000).toStringAsFixed(1)}km, duration: ${(durationSeconds/60).toStringAsFixed(1)}min)';
@@ -25,10 +26,27 @@ class RouteResult {
}
class RoutingService {
static const String _baseUrl = 'https://alprwatch.org/api/v1/deflock/directions';
static const String _userAgent = 'DeFlock/1.0 (OSM surveillance mapping app)';
// Calculate route between two points using alprwatch
static const String defaultUrl = 'https://api.dontgetflocked.com/api/v1/deflock/directions';
static const String fallbackUrl = 'https://alprwatch.org/api/v1/deflock/directions';
static const _policy = ResiliencePolicy(
maxRetries: 1,
httpTimeout: Duration(seconds: 30),
);
final http.Client _client;
/// Optional override URL. When null, uses [defaultUrl].
final String? _baseUrlOverride;
RoutingService({http.Client? client, String? baseUrl})
: _client = client ?? UserAgentClient(),
_baseUrlOverride = baseUrl;
void close() => _client.close();
/// Resolve the primary URL to use: constructor override or default.
String get _primaryUrl => _baseUrlOverride ?? defaultUrl;
// Calculate route between two points
Future<RouteResult> calculateRoute({
required LatLng start,
required LatLng end,
@@ -36,18 +54,19 @@ class RoutingService {
debugPrint('[RoutingService] Calculating route from $start to $end');
final prefs = await SharedPreferences.getInstance();
final avoidance_distance = await prefs.getInt('navigation_avoidance_distance');
final avoidanceDistance = prefs.getInt('navigation_avoidance_distance') ?? 250;
final enabled_profiles = AppState.instance.enabledProfiles.map((p) {
final enabledProfiles = AppState.instance.enabledProfiles.map((p) {
final full = p.toJson();
final tags = Map<String, String>.from(full['tags'] as Map);
tags.removeWhere((key, value) => value.isEmpty);
return {
'id': full['id'],
'name': full['name'],
'tags': full['tags'],
'tags': tags,
};
}).toList();
final uri = Uri.parse('$_baseUrl');
final params = {
'start': {
'longitude': start.longitude,
@@ -57,42 +76,66 @@ class RoutingService {
'longitude': end.longitude,
'latitude': end.latitude
},
'avoidance_distance': avoidance_distance,
'enabled_profiles': enabled_profiles,
'show_exclusion_zone': false, // for debugging: if true, returns a GeoJSON Feature MultiPolygon showing what areas are avoided in calculating the route
'avoidance_distance': avoidanceDistance,
'enabled_profiles': enabledProfiles,
'show_exclusion_zone': false,
};
debugPrint('[RoutingService] alprwatch request: $uri $params');
final primaryUrl = _primaryUrl;
final canFallback = _baseUrlOverride == null;
return executeWithFallback<RouteResult>(
primaryUrl: primaryUrl,
fallbackUrl: canFallback ? fallbackUrl : null,
execute: (url) => _postRoute(url, params),
classifyError: _classifyError,
policy: _policy,
);
}
Future<RouteResult> _postRoute(String url, Map<String, dynamic> params) async {
final uri = Uri.parse(url);
debugPrint('[RoutingService] POST $uri');
try {
final response = await http.post(
final response = await _client.post(
uri,
headers: {
'User-Agent': _userAgent,
'Content-Type': 'application/json'
},
body: json.encode(params)
).timeout(kNavigationRoutingTimeout);
).timeout(_policy.httpTimeout);
if (response.statusCode != 200) {
throw RoutingException('HTTP ${response.statusCode}: ${response.reasonPhrase}');
if (kDebugMode) {
debugPrint('[RoutingService] Error response body: ${response.body}');
} else {
const maxLen = 500;
final body = response.body;
final truncated = body.length > maxLen
? '${body.substring(0, maxLen)}… [truncated]'
: body;
debugPrint('[RoutingService] Error response body ($maxLen char max): $truncated');
}
throw RoutingException('HTTP ${response.statusCode}: ${response.reasonPhrase}',
statusCode: response.statusCode);
}
final data = json.decode(response.body) as Map<String, dynamic>;
debugPrint('[RoutingService] alprwatch response data: $data');
// Check alprwatch response status
debugPrint('[RoutingService] response data: $data');
// Check response status
final ok = data['ok'] as bool? ?? false;
if ( ! ok ) {
final message = data['error'] as String? ?? 'Unknown routing error';
throw RoutingException('alprwatch error: $message');
throw RoutingException('API error: $message', isApiError: true);
}
final route = data['result']['route'] as Map<String, dynamic>?;
if (route == null) {
throw RoutingException('No route found between these points');
throw RoutingException('No route found between these points', isApiError: true);
}
final waypoints = (route['coordinates'] as List<dynamic>?)
?.map((inner) {
final pair = inner as List<dynamic>;
@@ -100,19 +143,19 @@ class RoutingService {
final lng = (pair[0] as num).toDouble();
final lat = (pair[1] as num).toDouble();
return LatLng(lat, lng);
}).whereType<LatLng>().toList() ?? [];
}).whereType<LatLng>().toList() ?? [];
final distance = (route['distance'] as num?)?.toDouble() ?? 0.0;
final duration = (route['duration'] as num?)?.toDouble() ?? 0.0;
final result = RouteResult(
waypoints: waypoints,
distanceMeters: distance,
durationSeconds: duration,
);
debugPrint('[RoutingService] Route calculated: $result');
return result;
} catch (e) {
debugPrint('[RoutingService] Route calculation failed: $e');
if (e is RoutingException) {
@@ -122,13 +165,26 @@ class RoutingService {
}
}
}
static ErrorDisposition _classifyError(Object error) {
if (error is! RoutingException) return ErrorDisposition.retry;
if (error.isApiError) return ErrorDisposition.abort;
final status = error.statusCode;
if (status != null && status >= 400 && status < 500) {
if (status == 429) return ErrorDisposition.fallback;
return ErrorDisposition.abort;
}
return ErrorDisposition.retry;
}
}
class RoutingException implements Exception {
final String message;
const RoutingException(this.message);
final int? statusCode;
final bool isApiError;
const RoutingException(this.message, {this.statusCode, this.isApiError = false});
@override
String toString() => 'RoutingException: $message';
}

View File

@@ -1,48 +1,67 @@
import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:http/http.dart' as http;
import 'package:flutter_map/flutter_map.dart' show LatLngBounds;
import 'package:latlong2/latlong.dart';
import '../models/search_result.dart';
import 'http_client.dart';
import 'service_policy.dart';
/// Cached search result with expiry.
class _CachedResult {
final List<SearchResult> results;
final DateTime cachedAt;
_CachedResult(this.results) : cachedAt = DateTime.now();
bool get isExpired =>
DateTime.now().difference(cachedAt) > const Duration(minutes: 5);
}
class SearchService {
static const String _baseUrl = 'https://nominatim.openstreetmap.org';
static const String _userAgent = 'DeFlock/1.0 (OSM surveillance mapping app)';
static const int _maxResults = 5;
static const Duration _timeout = Duration(seconds: 10);
final _client = UserAgentClient();
/// Client-side result cache, keyed by normalized query + viewbox.
/// Required by Nominatim usage policy. Static so all SearchService
/// instances share the cache and don't generate redundant requests.
static final Map<String, _CachedResult> _resultCache = {};
/// Search for places using Nominatim geocoding service
Future<List<SearchResult>> search(String query) async {
Future<List<SearchResult>> search(String query, {LatLngBounds? viewbox}) async {
if (query.trim().isEmpty) {
return [];
}
// Check if query looks like coordinates first
final coordResult = _tryParseCoordinates(query.trim());
if (coordResult != null) {
return [coordResult];
}
// Otherwise, use Nominatim API
return await _searchNominatim(query.trim());
return await _searchNominatim(query.trim(), viewbox: viewbox);
}
/// Try to parse various coordinate formats
SearchResult? _tryParseCoordinates(String query) {
// Remove common separators and normalize
final normalized = query.replaceAll(RegExp(r'[,;]'), ' ').trim();
final parts = normalized.split(RegExp(r'\s+'));
if (parts.length != 2) return null;
final lat = double.tryParse(parts[0]);
final lon = double.tryParse(parts[1]);
if (lat == null || lon == null) return null;
// Basic validation for Earth coordinates
if (lat < -90 || lat > 90 || lon < -180 || lon > 180) return null;
return SearchResult(
displayName: 'Coordinates: ${lat.toStringAsFixed(6)}, ${lon.toStringAsFixed(6)}',
coordinates: LatLng(lat, lon),
@@ -50,42 +69,112 @@ class SearchService {
type: 'point',
);
}
/// Search using Nominatim API
Future<List<SearchResult>> _searchNominatim(String query) async {
final uri = Uri.parse('$_baseUrl/search').replace(queryParameters: {
/// Search using Nominatim API with rate limiting and result caching.
///
/// Nominatim usage policy requires:
/// - Max 1 request per second
/// - Client-side result caching
/// - No auto-complete / typeahead
Future<List<SearchResult>> _searchNominatim(String query, {LatLngBounds? viewbox}) async {
// Normalize the viewbox first so both the cache key and the request
// params use the same effective values (rounded + min-span expanded).
String? viewboxParam;
if (viewbox != null) {
double round1(double v) => (v * 10).round() / 10;
var west = round1(viewbox.west);
var east = round1(viewbox.east);
var south = round1(viewbox.south);
var north = round1(viewbox.north);
if (east - west < 0.5) {
final mid = (east + west) / 2;
west = mid - 0.25;
east = mid + 0.25;
}
if (north - south < 0.5) {
final mid = (north + south) / 2;
south = mid - 0.25;
north = mid + 0.25;
}
viewboxParam = '$west,$north,$east,$south';
}
final cacheKey = _buildCacheKey(query, viewboxParam);
// Check cache first (Nominatim policy requires client-side caching)
final cached = _resultCache[cacheKey];
if (cached != null && !cached.isExpired) {
debugPrint('[SearchService] Cache hit for "$query"');
return cached.results;
}
final params = {
'q': query,
'format': 'json',
'limit': _maxResults.toString(),
'addressdetails': '1',
'extratags': '1',
});
};
if (viewboxParam != null) {
params['viewbox'] = viewboxParam;
}
final uri = Uri.parse('$_baseUrl/search').replace(queryParameters: params);
debugPrint('[SearchService] Searching Nominatim: $uri');
// Rate limit: max 1 request/sec per Nominatim policy
await ServiceRateLimiter.acquire(ServiceType.nominatim);
try {
final response = await http.get(
uri,
headers: {
'User-Agent': _userAgent,
},
).timeout(_timeout);
final response = await _client.get(uri).timeout(_timeout);
if (response.statusCode != 200) {
throw Exception('HTTP ${response.statusCode}: ${response.reasonPhrase}');
}
final List<dynamic> jsonResults = json.decode(response.body);
final results = jsonResults
.map((json) => SearchResult.fromNominatim(json as Map<String, dynamic>))
.toList();
// Cache the results
_resultCache[cacheKey] = _CachedResult(results);
_pruneCache();
debugPrint('[SearchService] Found ${results.length} results');
return results;
} catch (e) {
} catch (e, stackTrace) {
debugPrint('[SearchService] Search failed: $e');
throw Exception('Search failed: $e');
Error.throwWithStackTrace(e, stackTrace);
} finally {
ServiceRateLimiter.release(ServiceType.nominatim);
}
}
}
/// Build a cache key from the query and the already-normalized viewbox string.
///
/// The viewbox should be the same `west,north,east,south` string sent to
/// Nominatim (after rounding and min-span expansion) so that requests with
/// different raw bounds but the same effective viewbox share a cache entry.
String _buildCacheKey(String query, String? viewboxParam) {
final normalizedQuery = query.trim().toLowerCase();
if (viewboxParam == null) return normalizedQuery;
return '$normalizedQuery|$viewboxParam';
}
/// Remove expired entries and limit cache size.
void _pruneCache() {
_resultCache.removeWhere((_, cached) => cached.isExpired);
// Limit cache to 50 entries to prevent unbounded growth
if (_resultCache.length > 50) {
final sortedKeys = _resultCache.keys.toList()
..sort((a, b) => _resultCache[a]!.cachedAt.compareTo(_resultCache[b]!.cachedAt));
for (final key in sortedKeys.take(_resultCache.length - 50)) {
_resultCache.remove(key);
}
}
}
}

View File

@@ -0,0 +1,449 @@
import 'dart:async';
import 'package:flutter/foundation.dart';
/// Identifies the type of external service being accessed.
/// Used by [ServicePolicyResolver] to determine the correct compliance policy.
enum ServiceType {
// OSMF official services
osmEditingApi, // api.openstreetmap.org — editing & data queries
osmTileServer, // tile.openstreetmap.org — raster tiles
nominatim, // nominatim.openstreetmap.org — geocoding
overpass, // overpass-api.de — read-only data queries
tagInfo, // taginfo.openstreetmap.org — tag metadata
// Third-party tile services
bingTiles, // *.tiles.virtualearth.net
mapboxTiles, // api.mapbox.com
// Everything else
custom, // user's own infrastructure / unknown
}
/// Defines the compliance rules for a specific service.
///
/// Each policy captures the rate limits, caching requirements, offline
/// permissions, and attribution obligations mandated by the service operator.
/// When the app talks to official OSMF infrastructure the strict policies
/// apply; when the user configures self-hosted endpoints, [ServicePolicy.custom]
/// provides permissive defaults.
class ServicePolicy {
/// Max concurrent HTTP connections to this service.
/// A value of 0 means "managed elsewhere" (e.g., by flutter_map or PR #114).
final int maxConcurrentRequests;
/// Minimum interval between consecutive requests. Null means no rate limit.
final Duration? minRequestInterval;
/// Whether this endpoint permits offline/bulk downloading of tiles.
final bool allowsOfflineDownload;
/// Whether the client must cache responses (e.g., Nominatim policy).
final bool requiresClientCaching;
/// Minimum cache TTL to enforce regardless of server headers.
/// Null means "use server-provided max-age as-is".
final Duration? minCacheTtl;
/// License/attribution URL to display in the attribution dialog.
/// Null means no special attribution link is needed.
final String? attributionUrl;
const ServicePolicy({
this.maxConcurrentRequests = 8,
this.minRequestInterval,
this.allowsOfflineDownload = true,
this.requiresClientCaching = false,
this.minCacheTtl,
this.attributionUrl,
});
/// OSM editing API (api.openstreetmap.org)
/// Policy: max 2 concurrent download threads.
/// https://operations.osmfoundation.org/policies/api/
const ServicePolicy.osmEditingApi()
: maxConcurrentRequests = 2,
minRequestInterval = null,
allowsOfflineDownload = true, // n/a for API
requiresClientCaching = false,
minCacheTtl = null,
attributionUrl = null;
/// OSM tile server (tile.openstreetmap.org)
/// Policy: min 7-day cache, must honor cache headers.
/// Concurrency managed by flutter_map's NetworkTileProvider.
/// https://operations.osmfoundation.org/policies/tiles/
const ServicePolicy.osmTileServer()
: maxConcurrentRequests = 0, // managed by flutter_map
minRequestInterval = null,
allowsOfflineDownload = true,
requiresClientCaching = true,
minCacheTtl = const Duration(days: 7),
attributionUrl = 'https://www.openstreetmap.org/copyright';
/// Nominatim geocoding (nominatim.openstreetmap.org)
/// Policy: max 1 req/sec, single machine only, results must be cached.
/// https://operations.osmfoundation.org/policies/nominatim/
const ServicePolicy.nominatim()
: maxConcurrentRequests = 1,
minRequestInterval = const Duration(seconds: 1),
allowsOfflineDownload = true, // n/a for geocoding
requiresClientCaching = true,
minCacheTtl = null,
attributionUrl = 'https://www.openstreetmap.org/copyright';
/// Overpass API (overpass-api.de)
/// Concurrency and rate limiting managed by PR #114's _AsyncSemaphore.
const ServicePolicy.overpass()
: maxConcurrentRequests = 0, // managed by NodeDataManager
minRequestInterval = null, // managed by NodeDataManager
allowsOfflineDownload = true, // n/a for data queries
requiresClientCaching = false,
minCacheTtl = null,
attributionUrl = null;
/// TagInfo API (taginfo.openstreetmap.org)
const ServicePolicy.tagInfo()
: maxConcurrentRequests = 2,
minRequestInterval = null,
allowsOfflineDownload = true, // n/a
requiresClientCaching = true, // already cached in NSIService
minCacheTtl = null,
attributionUrl = null;
/// Bing Maps tiles (*.tiles.virtualearth.net)
const ServicePolicy.bingTiles()
: maxConcurrentRequests = 0, // managed by flutter_map
minRequestInterval = null,
allowsOfflineDownload = true, // check Bing ToS separately
requiresClientCaching = false,
minCacheTtl = null,
attributionUrl = null;
/// Mapbox tiles (api.mapbox.com)
const ServicePolicy.mapboxTiles()
: maxConcurrentRequests = 0, // managed by flutter_map
minRequestInterval = null,
allowsOfflineDownload = true, // permitted with valid token
requiresClientCaching = false,
minCacheTtl = null,
attributionUrl = null;
/// Custom/self-hosted service — permissive defaults.
const ServicePolicy.custom({
int maxConcurrent = 8,
bool allowsOffline = true,
Duration? minInterval,
String? attribution,
}) : maxConcurrentRequests = maxConcurrent,
minRequestInterval = minInterval,
allowsOfflineDownload = allowsOffline,
requiresClientCaching = false,
minCacheTtl = null,
attributionUrl = attribution;
@override
String toString() => 'ServicePolicy('
'maxConcurrent: $maxConcurrentRequests, '
'minInterval: $minRequestInterval, '
'offlineDownload: $allowsOfflineDownload, '
'clientCaching: $requiresClientCaching, '
'minCacheTtl: $minCacheTtl, '
'attributionUrl: $attributionUrl)';
}
/// Resolves service URLs to their applicable [ServicePolicy].
///
/// Built-in patterns cover all OSMF official services and common third-party
/// tile providers. Falls back to permissive defaults for unrecognized hosts.
class ServicePolicyResolver {
/// Host → ServiceType mapping for known services.
static final Map<String, ServiceType> _hostPatterns = {
'api.openstreetmap.org': ServiceType.osmEditingApi,
'api06.dev.openstreetmap.org': ServiceType.osmEditingApi,
'master.apis.dev.openstreetmap.org': ServiceType.osmEditingApi,
'tile.openstreetmap.org': ServiceType.osmTileServer,
'nominatim.openstreetmap.org': ServiceType.nominatim,
'overpass-api.de': ServiceType.overpass,
'overpass.deflock.org': ServiceType.overpass,
'taginfo.openstreetmap.org': ServiceType.tagInfo,
'tiles.virtualearth.net': ServiceType.bingTiles,
'api.mapbox.com': ServiceType.mapboxTiles,
};
/// ServiceType → policy mapping.
static final Map<ServiceType, ServicePolicy> _policies = {
ServiceType.osmEditingApi: const ServicePolicy.osmEditingApi(),
ServiceType.osmTileServer: const ServicePolicy.osmTileServer(),
ServiceType.nominatim: const ServicePolicy.nominatim(),
ServiceType.overpass: const ServicePolicy.overpass(),
ServiceType.tagInfo: const ServicePolicy.tagInfo(),
ServiceType.bingTiles: const ServicePolicy.bingTiles(),
ServiceType.mapboxTiles: const ServicePolicy.mapboxTiles(),
ServiceType.custom: const ServicePolicy(),
};
/// Resolve a URL to its applicable [ServicePolicy].
///
/// Checks built-in host patterns. Falls back to [ServicePolicy.custom]
/// for unrecognized hosts.
static ServicePolicy resolve(String url) {
final host = _extractHost(url);
if (host == null) return const ServicePolicy();
for (final entry in _hostPatterns.entries) {
if (host == entry.key || host.endsWith('.${entry.key}')) {
return _policies[entry.value] ?? const ServicePolicy();
}
}
return const ServicePolicy();
}
/// Resolve a URL to its [ServiceType].
///
/// Returns [ServiceType.custom] for unrecognized hosts.
static ServiceType resolveType(String url) {
final host = _extractHost(url);
if (host == null) return ServiceType.custom;
for (final entry in _hostPatterns.entries) {
if (host == entry.key || host.endsWith('.${entry.key}')) {
return entry.value;
}
}
return ServiceType.custom;
}
/// Look up the [ServicePolicy] for a known [ServiceType].
static ServicePolicy resolveByType(ServiceType type) =>
_policies[type] ?? const ServicePolicy();
/// Extract the host from a URL or URL template.
static String? _extractHost(String url) {
// Handle URL templates like 'https://tile.openstreetmap.org/{z}/{x}/{y}.png'
// and subdomain templates like 'https://ecn.t{0_3}.tiles.virtualearth.net/...'
try {
// Strip template variables from subdomain part for parsing
final cleaned = url
.replaceAll(RegExp(r'\{0_3\}'), '0')
.replaceAll(RegExp(r'\{1_4\}'), '1')
.replaceAll(RegExp(r'\{quadkey\}'), 'quadkey')
.replaceAll(RegExp(r'\{z\}'), '0')
.replaceAll(RegExp(r'\{x\}'), '0')
.replaceAll(RegExp(r'\{y\}'), '0')
.replaceAll(RegExp(r'\{api_key\}'), 'key');
return Uri.parse(cleaned).host.toLowerCase();
} catch (_) {
return null;
}
}
}
/// How the retry/fallback engine should handle an error.
enum ErrorDisposition {
/// Stop immediately. Don't retry, don't try fallback. (400, business logic)
abort,
/// Don't retry same server, but DO try fallback endpoint. (429 rate limit)
fallback,
/// Retry with backoff against same server, then fallback if exhausted. (5xx, network)
retry,
}
/// Retry and fallback configuration for resilient HTTP services.
class ResiliencePolicy {
final int maxRetries;
final Duration httpTimeout;
final Duration _retryBackoffBase;
final int _retryBackoffMaxMs;
const ResiliencePolicy({
this.maxRetries = 1,
this.httpTimeout = const Duration(seconds: 30),
Duration retryBackoffBase = const Duration(milliseconds: 200),
int retryBackoffMaxMs = 5000,
}) : _retryBackoffBase = retryBackoffBase,
_retryBackoffMaxMs = retryBackoffMaxMs;
Duration retryDelay(int attempt) {
final ms = (_retryBackoffBase.inMilliseconds * (1 << attempt))
.clamp(0, _retryBackoffMaxMs);
return Duration(milliseconds: ms);
}
}
/// Execute a request with retry and fallback logic.
///
/// 1. Tries [execute] against [primaryUrl] up to `policy.maxRetries + 1` times.
/// 2. On each failure, calls [classifyError] to determine disposition:
/// - [ErrorDisposition.abort]: rethrows immediately
/// - [ErrorDisposition.fallback]: skips retries, tries fallback (if available)
/// - [ErrorDisposition.retry]: retries with backoff, then fallback if exhausted
/// 3. If [fallbackUrl] is non-null and primary failed with a non-abort error,
/// repeats the retry loop against the fallback.
Future<T> executeWithFallback<T>({
required String primaryUrl,
required String? fallbackUrl,
required Future<T> Function(String url) execute,
required ErrorDisposition Function(Object error) classifyError,
ResiliencePolicy policy = const ResiliencePolicy(),
}) async {
try {
return await _executeWithRetries(primaryUrl, execute, classifyError, policy);
} catch (e) {
// _executeWithRetries rethrows abort/fallback/exhausted-retry errors.
// Re-classify only to distinguish abort (which must not fall back) from
// fallback/retry-exhausted (which should). This is the one intentional
// re-classification — _executeWithRetries cannot short-circuit past the
// outer try/catch.
if (classifyError(e) == ErrorDisposition.abort) rethrow;
if (fallbackUrl == null) rethrow;
debugPrint('[Resilience] Primary failed ($e), trying fallback');
return _executeWithRetries(fallbackUrl, execute, classifyError, policy);
}
}
Future<T> _executeWithRetries<T>(
String url,
Future<T> Function(String url) execute,
ErrorDisposition Function(Object error) classifyError,
ResiliencePolicy policy,
) async {
for (int attempt = 0; attempt <= policy.maxRetries; attempt++) {
try {
return await execute(url);
} catch (e) {
final disposition = classifyError(e);
if (disposition == ErrorDisposition.abort) rethrow;
if (disposition == ErrorDisposition.fallback) rethrow; // caller handles fallback
// disposition == retry
if (attempt < policy.maxRetries) {
final delay = policy.retryDelay(attempt);
debugPrint('[Resilience] Attempt ${attempt + 1} failed, retrying in ${delay.inMilliseconds}ms');
await Future.delayed(delay);
continue;
}
rethrow; // retries exhausted, let caller try fallback
}
}
throw StateError('Unreachable'); // loop always returns or throws
}
/// Reusable per-service rate limiter and concurrency controller.
///
/// Enforces the rate limits and concurrency constraints defined in each
/// service's [ServicePolicy]. Call [acquire] before making a request and
/// [release] after the request completes.
///
/// Only manages services whose policies have [ServicePolicy.maxConcurrentRequests] > 0
/// and/or [ServicePolicy.minRequestInterval] set. Services managed elsewhere
/// (flutter_map, PR #114) are passed through without blocking.
class ServiceRateLimiter {
/// Injectable clock for testing. Defaults to [DateTime.now].
///
/// Override with a deterministic clock (e.g. from `FakeAsync`) so tests
/// don't rely on wall-clock time and stay fast and stable under CI load.
@visibleForTesting
static DateTime Function() clock = DateTime.now;
/// Per-service timestamps of the last acquired request slot / request start
/// (used for rate limiting in [acquire], not updated on completion).
static final Map<ServiceType, DateTime> _lastRequestTime = {};
/// Per-service concurrency semaphores.
static final Map<ServiceType, _Semaphore> _semaphores = {};
/// Acquire a slot: wait for rate limit compliance, then take a connection slot.
///
/// Blocks if:
/// 1. The minimum interval between requests hasn't elapsed yet, or
/// 2. All concurrent connection slots are in use.
static Future<void> acquire(ServiceType service) async {
final policy = ServicePolicyResolver.resolveByType(service);
// Concurrency: acquire a semaphore slot first so that at most
// [policy.maxConcurrentRequests] callers proceed concurrently.
// The min-interval check below is only race-free when
// maxConcurrentRequests == 1 (currently only Nominatim). For services
// with higher concurrency the interval is approximate, which is
// acceptable — their policies don't specify a min interval.
_Semaphore? semaphore;
if (policy.maxConcurrentRequests > 0) {
semaphore = _semaphores.putIfAbsent(
service,
() => _Semaphore(policy.maxConcurrentRequests),
);
await semaphore.acquire();
}
try {
// Rate limit: wait if we sent a request too recently
if (policy.minRequestInterval != null) {
final lastTime = _lastRequestTime[service];
if (lastTime != null) {
final elapsed = clock().difference(lastTime);
final remaining = policy.minRequestInterval! - elapsed;
if (remaining > Duration.zero) {
debugPrint('[ServiceRateLimiter] Throttling $service for ${remaining.inMilliseconds}ms');
await Future.delayed(remaining);
}
}
}
// Record request time
_lastRequestTime[service] = clock();
} catch (_) {
// Release the semaphore slot if the rate-limit delay fails,
// to avoid permanently leaking a slot.
semaphore?.release();
rethrow;
}
}
/// Release a connection slot after request completes.
static void release(ServiceType service) {
_semaphores[service]?.release();
}
/// Reset all rate limiter state (for testing).
@visibleForTesting
static void reset() {
_lastRequestTime.clear();
_semaphores.clear();
clock = DateTime.now;
}
}
/// Simple async counting semaphore for concurrency limiting.
class _Semaphore {
final int _maxCount;
int _currentCount = 0;
final List<Completer<void>> _waiters = [];
_Semaphore(this._maxCount);
Future<void> acquire() async {
if (_currentCount < _maxCount) {
_currentCount++;
return;
}
final completer = Completer<void>();
_waiters.add(completer);
await completer.future;
}
void release() {
if (_waiters.isNotEmpty) {
final next = _waiters.removeAt(0);
next.complete();
} else if (_currentCount > 0) {
_currentCount--;
} else {
throw StateError(
'Semaphore.release() called more times than acquire(); '
'currentCount is already zero.',
);
}
}
}

View File

@@ -1,6 +1,5 @@
import 'package:flutter/foundation.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong2/latlong.dart';
import '../models/suspected_location.dart';
import 'suspected_location_service.dart';

View File

@@ -143,7 +143,6 @@ class SuspectedLocationDatabase {
// Process entries in batches to avoid memory issues
const batchSize = 1000;
int totalInserted = 0;
int validCount = 0;
int errorCount = 0;
@@ -188,7 +187,6 @@ class SuspectedLocationDatabase {
// Commit this batch
await batch.commit(noResult: true);
totalInserted += currentBatch.length;
// Log progress every few batches
if ((i ~/ batchSize) % 5 == 0) {

View File

@@ -1,5 +1,3 @@
import 'dart:convert';
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:http/http.dart' as http;
@@ -9,6 +7,7 @@ import 'package:csv/csv.dart';
import '../dev_config.dart';
import '../models/suspected_location.dart';
import 'http_client.dart';
import 'suspected_location_cache.dart';
class SuspectedLocationService {
@@ -114,9 +113,8 @@ class SuspectedLocationService {
// Use streaming download for progress tracking
final request = http.Request('GET', Uri.parse(kSuspectedLocationsCsvUrl));
request.headers['User-Agent'] = 'DeFlock/1.0 (OSM surveillance mapping app)';
final client = http.Client();
final client = UserAgentClient();
final streamedResponse = await client.send(request).timeout(_timeout);
if (streamedResponse.statusCode != 200) {
@@ -208,7 +206,7 @@ class SuspectedLocationService {
validRows++;
}
} catch (e, stackTrace) {
} catch (e) {
// Skip rows that can't be parsed
debugPrint('[SuspectedLocationService] Error parsing row $rowIndex: $e');
continue;

View File

@@ -1,14 +1,14 @@
import 'dart:typed_data';
import 'package:flutter/foundation.dart';
import 'package:http/http.dart' as http;
import '../models/tile_provider.dart';
import '../state/settings_state.dart';
import '../dev_config.dart';
import 'http_client.dart';
/// Service for fetching missing tile preview images
class TilePreviewService {
static const Duration _timeout = Duration(seconds: 10);
static final _client = UserAgentClient();
/// Attempt to fetch missing preview tiles for tile types that don't already have preview data
/// Fails silently - no error handling or user notification on failure
@@ -63,7 +63,7 @@ class TilePreviewService {
try {
final url = tileType.getTileUrl(kPreviewTileZoom, kPreviewTileX, kPreviewTileY, apiKey: apiKey);
final response = await http.get(Uri.parse(url)).timeout(_timeout);
final response = await _client.get(Uri.parse(url)).timeout(_timeout);
if (response.statusCode == 200 && response.bodyBytes.isNotEmpty) {
debugPrint('TilePreviewService: Fetched preview for ${tileType.name}');

View File

@@ -5,6 +5,7 @@ import 'package:http/http.dart' as http;
import '../models/pending_upload.dart';
import '../dev_config.dart';
import '../state/settings_state.dart';
import 'http_client.dart';
import 'version_service.dart';
class UploadResult {
@@ -54,29 +55,13 @@ class Uploader {
return UploadResult.failure(errorMessage: errorMsg);
}
// Generate changeset XML
String action;
switch (p.operation) {
case UploadOperation.create:
action = 'Add';
break;
case UploadOperation.modify:
action = 'Update';
break;
case UploadOperation.delete:
action = 'Delete';
break;
case UploadOperation.extract:
action = 'Extract';
break;
}
final profileName = p.profile?.name ?? 'surveillance';
// Use the user's changeset comment, with XML sanitization
final sanitizedComment = _sanitizeXmlText(p.changesetComment);
final csXml = '''
<osm>
<changeset>
<tag k="created_by" v="$kClientName ${VersionService().version}"/>
<tag k="comment" v="$action $profileName surveillance node"/>
<tag k="comment" v="$sanitizedComment"/>
</changeset>
</osm>''';
@@ -146,7 +131,7 @@ class Uploader {
final currentNodeXml = currentNodeResp.body;
final versionMatch = RegExp(r'version="(\d+)"').firstMatch(currentNodeXml);
if (versionMatch == null) {
final errorMsg = 'Could not parse version from node XML: ${currentNodeXml.length > 200 ? currentNodeXml.substring(0, 200) + "..." : currentNodeXml}';
final errorMsg = 'Could not parse version from node XML: ${currentNodeXml.length > 200 ? '${currentNodeXml.substring(0, 200)}...' : currentNodeXml}';
debugPrint('[Uploader] $errorMsg');
return UploadResult.failure(errorMessage: errorMsg, changesetId: changesetId);
}
@@ -183,7 +168,7 @@ class Uploader {
final currentNodeXml = currentNodeResp.body;
final versionMatch = RegExp(r'version="(\d+)"').firstMatch(currentNodeXml);
if (versionMatch == null) {
final errorMsg = 'Could not parse version from node XML for deletion: ${currentNodeXml.length > 200 ? currentNodeXml.substring(0, 200) + "..." : currentNodeXml}';
final errorMsg = 'Could not parse version from node XML for deletion: ${currentNodeXml.length > 200 ? '${currentNodeXml.substring(0, 200)}...' : currentNodeXml}';
debugPrint('[Uploader] $errorMsg');
return UploadResult.failure(errorMessage: errorMsg, changesetId: changesetId);
}
@@ -349,12 +334,6 @@ class Uploader {
headers: _headers,
).timeout(kUploadHttpTimeout);
Future<http.Response> _post(String path, String body) => http.post(
Uri.https(_host, path),
headers: _headers,
body: body,
).timeout(kUploadHttpTimeout);
Future<http.Response> _put(String path, String body) => http.put(
Uri.https(_host, path),
headers: _headers,
@@ -370,7 +349,23 @@ class Uploader {
Map<String, String> get _headers => {
'Authorization': 'Bearer $accessToken',
'Content-Type': 'text/xml',
'User-Agent': UserAgentClient.userAgent,
};
/// Sanitize text for safe inclusion in XML attributes and content
/// Removes or escapes characters that could break XML parsing
String _sanitizeXmlText(String input) {
return input
.replaceAll('&', '&amp;') // Must be first to avoid double-escaping
.replaceAll('<', '&lt;')
.replaceAll('>', '&gt;')
.replaceAll('"', '&quot;')
.replaceAll("'", '&apos;')
.replaceAll('\n', ' ') // Replace newlines with spaces
.replaceAll('\r', ' ') // Replace carriage returns with spaces
.replaceAll('\t', ' ') // Replace tabs with spaces
.trim(); // Remove leading/trailing whitespace
}
}
extension StringExtension on String {

View File

@@ -21,7 +21,7 @@ class AuthState extends ChangeNotifier {
_username = await _auth.restoreLogin();
}
} catch (e) {
print("AuthState: Error during auth initialization: $e");
debugPrint("AuthState: Error during auth initialization: $e");
}
}
@@ -29,7 +29,7 @@ class AuthState extends ChangeNotifier {
try {
_username = await _auth.login();
} catch (e) {
print("AuthState: Login error: $e");
debugPrint("AuthState: Login error: $e");
_username = null;
}
notifyListeners();
@@ -49,7 +49,7 @@ class AuthState extends ChangeNotifier {
_username = null;
}
} catch (e) {
print("AuthState: Auth refresh error: $e");
debugPrint("AuthState: Auth refresh error: $e");
_username = null;
}
notifyListeners();
@@ -59,7 +59,7 @@ class AuthState extends ChangeNotifier {
try {
_username = await _auth.forceLogin();
} catch (e) {
print("AuthState: Forced login error: $e");
debugPrint("AuthState: Forced login error: $e");
_username = null;
}
notifyListeners();
@@ -69,7 +69,7 @@ class AuthState extends ChangeNotifier {
try {
return await _auth.isLoggedIn();
} catch (e) {
print("AuthState: Token validation error: $e");
debugPrint("AuthState: Token validation error: $e");
return false;
}
}
@@ -92,7 +92,7 @@ class AuthState extends ChangeNotifier {
}
} catch (e) {
_username = null;
print("AuthState: Mode change user restoration error: $e");
debugPrint("AuthState: Mode change user restoration error: $e");
}
notifyListeners();
}

View File

@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart' show LatLngBounds;
import 'package:latlong2/latlong.dart';
import '../models/search_result.dart';
@@ -31,7 +32,8 @@ class NavigationState extends ChangeNotifier {
bool _isSearchLoading = false;
List<SearchResult> _searchResults = [];
String _lastQuery = '';
LatLngBounds? _searchViewbox;
// Location state
LatLng? _provisionalPinLocation;
String? _provisionalPinAddress;
@@ -106,19 +108,20 @@ class NavigationState extends ChangeNotifier {
}
/// BRUTALIST: Single entry point to search mode
void enterSearchMode(LatLng mapCenter) {
void enterSearchMode(LatLng mapCenter, {LatLngBounds? viewbox}) {
debugPrint('[NavigationState] enterSearchMode - current mode: $_mode');
if (_mode != AppNavigationMode.normal) {
debugPrint('[NavigationState] Cannot enter search mode - not in normal mode');
return;
}
_mode = AppNavigationMode.search;
_provisionalPinLocation = mapCenter;
_provisionalPinAddress = null;
_searchViewbox = viewbox;
_clearSearchResults();
debugPrint('[NavigationState] Entered search mode');
notifyListeners();
}
@@ -149,7 +152,8 @@ class NavigationState extends ChangeNotifier {
_showingOverview = false;
_nextPointIsStart = false;
_routingError = null;
_searchViewbox = null;
// Clear search
_clearSearchResults();
@@ -246,11 +250,11 @@ class NavigationState extends ChangeNotifier {
_calculateRoute();
}
/// Calculate route using alprwatch
/// Calculate route via RoutingService (primary + fallback endpoints).
void _calculateRoute() {
if (_routeStart == null || _routeEnd == null) return;
debugPrint('[NavigationState] Calculating route with alprwatch...');
debugPrint('[NavigationState] Calculating route...');
_isCalculating = true;
_routingError = null;
notifyListeners();
@@ -267,7 +271,7 @@ class NavigationState extends ChangeNotifier {
_showingOverview = true;
_provisionalPinLocation = null; // Hide provisional pin
debugPrint('[NavigationState] alprwatch route calculated: ${routeResult.toString()}');
debugPrint('[NavigationState] Route calculated: ${routeResult.toString()}');
notifyListeners();
}).catchError((error) {
@@ -336,21 +340,21 @@ class NavigationState extends ChangeNotifier {
_clearSearchResults();
return;
}
if (query.trim() == _lastQuery.trim()) return;
_setSearchLoading(true);
_lastQuery = query.trim();
try {
final results = await _searchService.search(query.trim());
final results = await _searchService.search(query.trim(), viewbox: _searchViewbox);
_searchResults = results;
debugPrint('[NavigationState] Found ${results.length} results');
} catch (e) {
debugPrint('[NavigationState] Search failed: $e');
_searchResults = [];
}
_setSearchLoading(false);
}
@@ -372,4 +376,10 @@ class NavigationState extends ChangeNotifier {
notifyListeners();
}
}
@override
void dispose() {
_routingService.close();
super.dispose();
}
}

View File

@@ -6,9 +6,17 @@ import '../services/profile_service.dart';
class ProfileState extends ChangeNotifier {
static const String _enabledPrefsKey = 'enabled_profiles';
static const String _profileOrderPrefsKey = 'profile_order';
final List<NodeProfile> _profiles = [];
final Set<NodeProfile> _enabled = {};
List<String> _customOrder = []; // List of profile IDs in user's preferred order
// Test-only getters for accessing private state
@visibleForTesting
List<NodeProfile> get internalProfiles => _profiles;
@visibleForTesting
Set<NodeProfile> get internalEnabled => _enabled;
// Callback for when a profile is deleted (used to clear stale sessions)
void Function(NodeProfile)? _onProfileDeleted;
@@ -18,10 +26,10 @@ class ProfileState extends ChangeNotifier {
}
// Getters
List<NodeProfile> get profiles => List.unmodifiable(_profiles);
List<NodeProfile> get profiles => List.unmodifiable(_getOrderedProfiles());
bool isEnabled(NodeProfile p) => _enabled.contains(p);
List<NodeProfile> get enabledProfiles =>
_profiles.where(isEnabled).toList(growable: false);
_getOrderedProfiles().where(isEnabled).toList(growable: false);
// Initialize profiles from built-in and custom sources
Future<void> init({bool addDefaults = false}) async {
@@ -34,7 +42,7 @@ class ProfileState extends ChangeNotifier {
await ProfileService().save(_profiles);
}
// Load enabled profile IDs from prefs
// Load enabled profile IDs and custom order from prefs
final prefs = await SharedPreferences.getInstance();
final enabledIds = prefs.getStringList(_enabledPrefsKey);
if (enabledIds != null && enabledIds.isNotEmpty) {
@@ -44,6 +52,9 @@ class ProfileState extends ChangeNotifier {
// By default, all are enabled
_enabled.addAll(_profiles);
}
// Load custom order
_customOrder = prefs.getStringList(_profileOrderPrefsKey) ?? [];
}
void toggleProfile(NodeProfile p, bool e) {
@@ -70,7 +81,7 @@ class ProfileState extends ChangeNotifier {
_enabled.add(p);
_saveEnabledProfiles();
}
ProfileService().save(_profiles);
_saveProfilesToStorage();
notifyListeners();
}
@@ -84,7 +95,7 @@ class ProfileState extends ChangeNotifier {
_enabled.add(builtIn);
}
_saveEnabledProfiles();
ProfileService().save(_profiles);
_saveProfilesToStorage();
// Notify about profile deletion so other parts can clean up
_onProfileDeleted?.call(p);
@@ -92,12 +103,79 @@ class ProfileState extends ChangeNotifier {
notifyListeners();
}
// Reorder profiles (for drag-and-drop in settings)
void reorderProfiles(int oldIndex, int newIndex) {
final orderedProfiles = _getOrderedProfiles();
// Standard Flutter reordering logic
if (oldIndex < newIndex) {
newIndex -= 1;
}
final item = orderedProfiles.removeAt(oldIndex);
orderedProfiles.insert(newIndex, item);
// Update custom order with new sequence
_customOrder = orderedProfiles.map((p) => p.id).toList();
_saveCustomOrder();
notifyListeners();
}
// Get profiles in custom order, with unordered profiles at the end
List<NodeProfile> _getOrderedProfiles() {
if (_customOrder.isEmpty) {
return List.from(_profiles);
}
final ordered = <NodeProfile>[];
final profilesById = {for (final p in _profiles) p.id: p};
// Add profiles in custom order
for (final id in _customOrder) {
final profile = profilesById[id];
if (profile != null) {
ordered.add(profile);
profilesById.remove(id);
}
}
// Add any remaining profiles that weren't in the custom order
ordered.addAll(profilesById.values);
return ordered;
}
// Save enabled profile IDs to disk
Future<void> _saveEnabledProfiles() async {
final prefs = await SharedPreferences.getInstance();
await prefs.setStringList(
_enabledPrefsKey,
_enabled.map((p) => p.id).toList(),
);
try {
final prefs = await SharedPreferences.getInstance();
await prefs.setStringList(
_enabledPrefsKey,
_enabled.map((p) => p.id).toList(),
);
} catch (e) {
// Fail gracefully in tests or if SharedPreferences isn't available
debugPrint('[ProfileState] Failed to save enabled profiles: $e');
}
}
// Save profiles to storage
Future<void> _saveProfilesToStorage() async {
try {
await ProfileService().save(_profiles);
} catch (e) {
// Fail gracefully in tests or if storage isn't available
debugPrint('[ProfileState] Failed to save profiles: $e');
}
}
// Save custom order to disk
Future<void> _saveCustomOrder() async {
try {
final prefs = await SharedPreferences.getInstance();
await prefs.setStringList(_profileOrderPrefsKey, _customOrder);
} catch (e) {
// Fail gracefully in tests or if SharedPreferences isn't available
debugPrint('[ProfileState] Failed to save custom order: $e');
}
}
}

View File

@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:latlong2/latlong.dart';
import '../models/search_result.dart';
import '../services/search_service.dart';

View File

@@ -4,6 +4,7 @@ import 'package:latlong2/latlong.dart';
import '../models/node_profile.dart';
import '../models/operator_profile.dart';
import '../models/osm_node.dart';
import '../models/pending_upload.dart'; // For UploadOperation enum
// ------------------ AddNodeSession ------------------
class AddNodeSession {
@@ -13,6 +14,8 @@ class AddNodeSession {
List<double> directions; // All directions [90, 180, 270]
int currentDirectionIndex; // Which direction we're editing (e.g. 1 = editing the 180°)
Map<String, String> refinedTags; // User-selected values for empty profile tags
Map<String, String> additionalExistingTags; // For consistency (always empty for new nodes)
String changesetComment; // User-editable changeset comment
AddNodeSession({
this.profile,
@@ -20,18 +23,29 @@ class AddNodeSession {
this.operatorProfile,
this.target,
Map<String, String>? refinedTags,
Map<String, String>? additionalExistingTags,
String? changesetComment,
}) : directions = [initialDirection],
currentDirectionIndex = 0,
refinedTags = refinedTags ?? {};
refinedTags = refinedTags ?? {},
additionalExistingTags = additionalExistingTags ?? {}, // Always empty for new nodes
changesetComment = changesetComment ?? '';
// Slider always shows the current direction being edited
double get directionDegrees => directions[currentDirectionIndex];
set directionDegrees(double value) => directions[currentDirectionIndex] = value;
double get directionDegrees => directions.isNotEmpty && currentDirectionIndex >= 0
? directions[currentDirectionIndex]
: 0.0;
set directionDegrees(double value) {
if (directions.isNotEmpty && currentDirectionIndex >= 0) {
directions[currentDirectionIndex] = value;
}
}
}
// ------------------ EditNodeSession ------------------
class EditNodeSession {
final OsmNode originalNode; // The original node being edited
final bool originalHadDirections; // Whether original node had any directions
NodeProfile? profile;
OperatorProfile? operatorProfile;
LatLng target; // Current position (can be dragged)
@@ -39,26 +53,41 @@ class EditNodeSession {
int currentDirectionIndex; // Which direction we're editing (e.g. 1 = editing the 180°)
bool extractFromWay; // True if user wants to extract this constrained node
Map<String, String> refinedTags; // User-selected values for empty profile tags
Map<String, String> additionalExistingTags; // Tags that exist on node but not in profile
String changesetComment; // User-editable changeset comment
EditNodeSession({
required this.originalNode,
required this.originalHadDirections,
this.profile,
this.operatorProfile,
required double initialDirection,
required this.target,
this.extractFromWay = false,
Map<String, String>? refinedTags,
Map<String, String>? additionalExistingTags,
String? changesetComment,
}) : directions = [initialDirection],
currentDirectionIndex = 0,
refinedTags = refinedTags ?? {};
refinedTags = refinedTags ?? {},
additionalExistingTags = additionalExistingTags ?? {},
changesetComment = changesetComment ?? '';
// Slider always shows the current direction being edited
double get directionDegrees => directions[currentDirectionIndex];
set directionDegrees(double value) => directions[currentDirectionIndex] = value;
double get directionDegrees => directions.isNotEmpty && currentDirectionIndex >= 0
? directions[currentDirectionIndex]
: 0.0;
set directionDegrees(double value) {
if (directions.isNotEmpty && currentDirectionIndex >= 0) {
directions[currentDirectionIndex] = value;
}
}
}
class SessionState extends ChangeNotifier {
AddNodeSession? _session;
EditNodeSession? _editSession;
OperatorProfile? _detectedOperatorProfile; // Persists across profile changes
// Getters
AddNodeSession? get session => _session;
@@ -66,51 +95,116 @@ class SessionState extends ChangeNotifier {
void startAddSession(List<NodeProfile> enabledProfiles) {
// Start with no profile selected - force user to choose
_session = AddNodeSession();
_session = AddNodeSession(
changesetComment: 'Add surveillance node', // Default comment, will be updated when profile is selected
);
_editSession = null; // Clear any edit session
notifyListeners();
}
void startEditSession(OsmNode node, List<NodeProfile> enabledProfiles) {
final submittableProfiles = enabledProfiles.where((p) => p.isSubmittable).toList();
void startEditSession(OsmNode node, List<NodeProfile> enabledProfiles, List<OperatorProfile> operatorProfiles) {
// Always create and pre-select the temporary "existing tags" profile (now empty)
final existingTagsProfile = NodeProfile.createExistingTagsProfile(node);
// Try to find a matching profile based on the node's tags
NodeProfile? matchingProfile;
// Detect and store operator profile (persists across profile changes)
_detectedOperatorProfile = OperatorProfile.createExistingOperatorProfile(node, operatorProfiles);
// Attempt to find a match by comparing tags
for (final profile in submittableProfiles) {
if (_profileMatchesTags(profile, node.tags)) {
matchingProfile = profile;
break;
}
}
// Initialize edit session with all existing directions, or empty list if none
final existingDirections = node.directionDeg.isNotEmpty ? node.directionDeg : <double>[];
final initialDirection = existingDirections.isNotEmpty ? existingDirections.first : 0.0;
final originalHadDirections = existingDirections.isNotEmpty;
// Start with no profile selected if no match found - force user to choose
// Initialize edit session with all existing directions
final existingDirections = node.directionDeg.isNotEmpty ? node.directionDeg : [0.0];
// Since the "existing tags" profile is now empty, all existing node tags
// (minus special ones) should go into additionalExistingTags
final initialAdditionalTags = _calculateAdditionalExistingTags(existingTagsProfile, node);
// Auto-populate refined tags (empty profile means no refined tags initially)
final initialRefinedTags = _calculateRefinedTags(existingTagsProfile, node);
_editSession = EditNodeSession(
originalNode: node,
profile: matchingProfile,
initialDirection: existingDirections.first,
originalHadDirections: originalHadDirections,
profile: existingTagsProfile,
operatorProfile: _detectedOperatorProfile,
initialDirection: initialDirection,
target: node.coord,
additionalExistingTags: initialAdditionalTags,
refinedTags: initialRefinedTags,
changesetComment: 'Update a surveillance node', // Default comment for existing tags profile
);
// Replace the default single direction with all existing directions
// Replace the default single direction with all existing directions (or empty list)
_editSession!.directions = List<double>.from(existingDirections);
_editSession!.currentDirectionIndex = 0; // Start editing the first direction
_editSession!.currentDirectionIndex = existingDirections.isNotEmpty ? 0 : -1; // -1 indicates no directions
_session = null; // Clear any add session
notifyListeners();
}
bool _profileMatchesTags(NodeProfile profile, Map<String, String> tags) {
// Simple matching: check if all profile tags are present in node tags
/// Calculate additional existing tags for a given profile change
Map<String, String> _calculateAdditionalExistingTags(NodeProfile? newProfile, OsmNode originalNode) {
final additionalTags = <String, String>{};
// Skip if no profile
if (newProfile == null) {
return additionalTags;
}
// Get tags from the original node that are not in the selected profile
final profileTagKeys = newProfile.tags.keys.toSet();
final originalTags = originalNode.tags;
for (final entry in originalTags.entries) {
final key = entry.key;
final value = entry.value;
// Skip tags that are handled elsewhere
if (_shouldSkipTag(key)) continue;
// Skip tags that exist in the selected profile
if (profileTagKeys.contains(key)) continue;
// Include this tag as an additional existing tag
additionalTags[key] = value;
}
return additionalTags;
}
/// Auto-populate refined tags with existing values from the original node
Map<String, String> _calculateRefinedTags(NodeProfile? profile, OsmNode originalNode) {
final refinedTags = <String, String>{};
if (profile == null) return refinedTags;
// For each empty-value tag in the profile, check if original node has a value
for (final entry in profile.tags.entries) {
if (tags[entry.key] != entry.value) {
return false;
final tagKey = entry.key;
final profileValue = entry.value;
// Only auto-populate if profile tag value is empty
if (profileValue.trim().isEmpty) {
final existingValue = originalNode.tags[tagKey];
if (existingValue != null && existingValue.trim().isNotEmpty) {
refinedTags[tagKey] = existingValue;
}
}
}
return true;
return refinedTags;
}
/// Check if a tag should be skipped from additional existing tags
bool _shouldSkipTag(String key) {
// Skip direction tags (handled separately)
if (key == 'direction' || key == 'camera:direction') return true;
// Skip operator tags (handled by operator profile)
if (key == 'operator' || key.startsWith('operator:')) return true;
// Skip internal cache tags
if (key.startsWith('_')) return true;
return false;
}
void updateSession({
@@ -119,6 +213,9 @@ class SessionState extends ChangeNotifier {
OperatorProfile? operatorProfile,
LatLng? target,
Map<String, String>? refinedTags,
Map<String, String>? additionalExistingTags,
String? changesetComment,
bool updateOperatorProfile = false,
}) {
if (_session == null) return;
@@ -129,9 +226,15 @@ class SessionState extends ChangeNotifier {
}
if (profile != null && profile != _session!.profile) {
_session!.profile = profile;
// Regenerate changeset comment when profile changes
_session!.changesetComment = _generateDefaultChangesetComment(
profile: profile,
operation: UploadOperation.create,
);
dirty = true;
}
if (operatorProfile != _session!.operatorProfile) {
// Only update operator profile when explicitly requested
if (updateOperatorProfile && operatorProfile != _session!.operatorProfile) {
_session!.operatorProfile = operatorProfile;
dirty = true;
}
@@ -143,6 +246,14 @@ class SessionState extends ChangeNotifier {
_session!.refinedTags = Map<String, String>.from(refinedTags);
dirty = true;
}
if (additionalExistingTags != null) {
_session!.additionalExistingTags = Map<String, String>.from(additionalExistingTags);
dirty = true;
}
if (changesetComment != null) {
_session!.changesetComment = changesetComment;
dirty = true;
}
if (dirty) notifyListeners();
}
@@ -153,6 +264,9 @@ class SessionState extends ChangeNotifier {
LatLng? target,
bool? extractFromWay,
Map<String, String>? refinedTags,
Map<String, String>? additionalExistingTags,
String? changesetComment,
bool updateOperatorProfile = false,
}) {
if (_editSession == null) return;
@@ -165,11 +279,42 @@ class SessionState extends ChangeNotifier {
dirty = true;
}
if (profile != null && profile != _editSession!.profile) {
final oldProfile = _editSession!.profile;
_editSession!.profile = profile;
// Handle direction requirements when profile changes
_handleDirectionRequirementsOnProfileChange(oldProfile, profile);
// When profile changes and operator profile not being explicitly updated,
// restore the detected operator profile (if any)
if (!updateOperatorProfile && _detectedOperatorProfile != null) {
_editSession!.operatorProfile = _detectedOperatorProfile;
}
// Calculate additional existing tags for non-existing-tags profiles
// Only do this if additionalExistingTags wasn't explicitly provided
if (additionalExistingTags == null) {
_editSession!.additionalExistingTags = _calculateAdditionalExistingTags(profile, _editSession!.originalNode);
}
// Auto-populate refined tags with existing values for empty profile tags
// Only do this if refinedTags wasn't explicitly provided
if (refinedTags == null) {
_editSession!.refinedTags = _calculateRefinedTags(profile, _editSession!.originalNode);
}
// Regenerate changeset comment when profile changes
final operation = _editSession!.extractFromWay ? UploadOperation.extract : UploadOperation.modify;
_editSession!.changesetComment = _generateDefaultChangesetComment(
profile: profile,
operation: operation,
);
dirty = true;
}
if (operatorProfile != _editSession!.operatorProfile) {
_editSession!.operatorProfile = operatorProfile;
// Only update operator profile when explicitly requested
if (updateOperatorProfile && operatorProfile != _editSession!.operatorProfile) {
_editSession!.operatorProfile = operatorProfile; // This can be null
dirty = true;
}
if (target != null && target != _editSession!.target) {
@@ -190,6 +335,14 @@ class SessionState extends ChangeNotifier {
_editSession!.refinedTags = Map<String, String>.from(refinedTags);
dirty = true;
}
if (additionalExistingTags != null) {
_editSession!.additionalExistingTags = Map<String, String>.from(additionalExistingTags);
dirty = true;
}
if (changesetComment != null) {
_editSession!.changesetComment = changesetComment;
dirty = true;
}
if (dirty) notifyListeners();
@@ -222,18 +375,28 @@ class SessionState extends ChangeNotifier {
// Remove currently selected direction
void removeDirection() {
if (_session != null && _session!.directions.length > 1) {
_session!.directions.removeAt(_session!.currentDirectionIndex);
if (_session!.currentDirectionIndex >= _session!.directions.length) {
_session!.currentDirectionIndex = _session!.directions.length - 1;
if (_session != null && _session!.directions.isNotEmpty) {
// For add sessions, keep minimum of 1 direction
if (_session!.directions.length > 1) {
_session!.directions.removeAt(_session!.currentDirectionIndex);
if (_session!.currentDirectionIndex >= _session!.directions.length) {
_session!.currentDirectionIndex = _session!.directions.length - 1;
}
notifyListeners();
}
notifyListeners();
} else if (_editSession != null && _editSession!.directions.length > 1) {
_editSession!.directions.removeAt(_editSession!.currentDirectionIndex);
if (_editSession!.currentDirectionIndex >= _editSession!.directions.length) {
_editSession!.currentDirectionIndex = _editSession!.directions.length - 1;
} else if (_editSession != null && _editSession!.directions.isNotEmpty) {
// For edit sessions, use minimum calculation
final minDirections = _getMinimumDirections();
if (_editSession!.directions.length > minDirections) {
_editSession!.directions.removeAt(_editSession!.currentDirectionIndex);
if (_editSession!.directions.isEmpty) {
_editSession!.currentDirectionIndex = -1; // No directions
} else if (_editSession!.currentDirectionIndex >= _editSession!.directions.length) {
_editSession!.currentDirectionIndex = _editSession!.directions.length - 1;
}
notifyListeners();
}
notifyListeners();
}
}
@@ -242,7 +405,7 @@ class SessionState extends ChangeNotifier {
if (_session != null && _session!.directions.length > 1) {
_session!.currentDirectionIndex = (_session!.currentDirectionIndex + 1) % _session!.directions.length;
notifyListeners();
} else if (_editSession != null && _editSession!.directions.length > 1) {
} else if (_editSession != null && _editSession!.directions.length > 1 && _editSession!.currentDirectionIndex >= 0) {
_editSession!.currentDirectionIndex = (_editSession!.currentDirectionIndex + 1) % _editSession!.directions.length;
notifyListeners();
}
@@ -257,6 +420,7 @@ class SessionState extends ChangeNotifier {
void cancelEditSession() {
_editSession = null;
_detectedOperatorProfile = null;
notifyListeners();
}
@@ -274,7 +438,59 @@ class SessionState extends ChangeNotifier {
final session = _editSession!;
_editSession = null;
_detectedOperatorProfile = null;
notifyListeners();
return session;
}
/// Get the minimum number of directions required for current session state
int _getMinimumDirections() {
if (_editSession == null) return 1;
// Minimum = 0 only if original node had no directions
// Allow preserving the original state (directionless nodes can stay directionless)
return _editSession!.originalHadDirections ? 1 : 0;
}
/// Check if remove direction button should be enabled for edit session
bool get canRemoveDirection {
if (_editSession == null || _editSession!.directions.isEmpty) return false;
return _editSession!.directions.length > _getMinimumDirections();
}
/// Handle direction requirements when profile changes in edit session
void _handleDirectionRequirementsOnProfileChange(NodeProfile? oldProfile, NodeProfile newProfile) {
if (_editSession == null) return;
final minimum = _getMinimumDirections();
// Ensure we meet the minimum (add direction if needed)
if (_editSession!.directions.length < minimum) {
_editSession!.directions = [0.0];
_editSession!.currentDirectionIndex = 0;
}
}
/// Generate a default changeset comment for a submission
/// Handles special case of `<Existing tags>` profile by using "a" instead
String _generateDefaultChangesetComment({
required NodeProfile? profile,
required UploadOperation operation,
}) {
// Handle temp profiles with brackets by using "a"
final profileName = profile?.name.startsWith('<') == true && profile?.name.endsWith('>') == true
? 'a'
: profile?.name ?? 'surveillance';
switch (operation) {
case UploadOperation.create:
return 'Add $profileName surveillance node';
case UploadOperation.modify:
return 'Update $profileName surveillance node';
case UploadOperation.delete:
return 'Delete $profileName surveillance node';
case UploadOperation.extract:
return 'Extract $profileName surveillance node';
}
}
}

View File

@@ -5,6 +5,7 @@ import 'package:collection/collection.dart';
import '../models/tile_provider.dart';
import '../dev_config.dart';
import '../keys.dart';
// Enum for upload mode (Production, OSM Sandbox, Simulate)
enum UploadMode { production, sandbox, simulate }
@@ -16,6 +17,12 @@ enum FollowMeMode {
rotating, // Follow position and rotation based on heading
}
// Enum for distance units
enum DistanceUnit {
metric, // kilometers, meters
imperial, // miles, feet
}
class SettingsState extends ChangeNotifier {
static const String _offlineModePrefsKey = 'offline_mode';
static const String _maxNodesPrefsKey = 'max_nodes';
@@ -30,11 +37,13 @@ class SettingsState extends ChangeNotifier {
static const String _suspectedLocationMinDistancePrefsKey = 'suspected_location_min_distance';
static const String _pauseQueueProcessingPrefsKey = 'pause_queue_processing';
static const String _navigationAvoidanceDistancePrefsKey = 'navigation_avoidance_distance';
static const String _distanceUnitPrefsKey = 'distance_unit';
bool _offlineMode = false;
bool _pauseQueueProcessing = false;
int _maxNodes = kDefaultMaxNodes;
UploadMode _uploadMode = kEnableDevelopmentModes ? UploadMode.simulate : UploadMode.production;
// Default must account for missing secrets (preview builds) even before init() runs
UploadMode _uploadMode = (kEnableDevelopmentModes || !kHasOsmSecrets) ? UploadMode.simulate : UploadMode.production;
FollowMeMode _followMeMode = FollowMeMode.follow;
bool _proximityAlertsEnabled = false;
int _proximityAlertDistance = kProximityAlertDefaultDistance;
@@ -43,6 +52,7 @@ class SettingsState extends ChangeNotifier {
List<TileProvider> _tileProviders = [];
String _selectedTileTypeId = '';
int _navigationAvoidanceDistance = 250; // meters
DistanceUnit _distanceUnit = DistanceUnit.metric;
// Getters
bool get offlineMode => _offlineMode;
@@ -57,6 +67,7 @@ class SettingsState extends ChangeNotifier {
List<TileProvider> get tileProviders => List.unmodifiable(_tileProviders);
String get selectedTileTypeId => _selectedTileTypeId;
int get navigationAvoidanceDistance => _navigationAvoidanceDistance;
DistanceUnit get distanceUnit => _distanceUnit;
/// Get the currently selected tile type
TileType? get selectedTileType {
@@ -109,6 +120,14 @@ class SettingsState extends ChangeNotifier {
_navigationAvoidanceDistance = prefs.getInt(_navigationAvoidanceDistancePrefsKey) ?? 250;
}
// Load distance unit
if (prefs.containsKey(_distanceUnitPrefsKey)) {
final unitIndex = prefs.getInt(_distanceUnitPrefsKey) ?? 0;
if (unitIndex >= 0 && unitIndex < DistanceUnit.values.length) {
_distanceUnit = DistanceUnit.values[unitIndex];
}
}
// Load proximity alerts settings
_proximityAlertsEnabled = prefs.getBool(_proximityAlertsEnabledPrefsKey) ?? false;
_proximityAlertDistance = prefs.getInt(_proximityAlertDistancePrefsKey) ?? kProximityAlertDefaultDistance;
@@ -133,8 +152,16 @@ class SettingsState extends ChangeNotifier {
await prefs.setInt(_uploadModePrefsKey, _uploadMode.index);
}
// In production builds, force production mode if development modes are disabled
if (!kEnableDevelopmentModes && _uploadMode != UploadMode.production) {
// Override persisted upload mode when the current build configuration
// doesn't support it. This handles two cases:
// 1. Preview/PR builds without OAuth secrets — force simulate to avoid crashes
// 2. Production builds — force production (prefs may have sandbox/simulate
// from a previous dev build on the same device)
if (!kHasOsmSecrets && _uploadMode != UploadMode.simulate) {
debugPrint('SettingsState: No OSM secrets available, forcing simulate mode');
_uploadMode = UploadMode.simulate;
await prefs.setInt(_uploadModePrefsKey, _uploadMode.index);
} else if (kHasOsmSecrets && !kEnableDevelopmentModes && _uploadMode != UploadMode.production) {
debugPrint('SettingsState: Development modes disabled, forcing production mode');
_uploadMode = UploadMode.production;
await prefs.setInt(_uploadModePrefsKey, _uploadMode.index);
@@ -241,11 +268,10 @@ class SettingsState extends ChangeNotifier {
}
Future<void> setUploadMode(UploadMode mode) async {
// In production builds, only allow production mode
if (!kEnableDevelopmentModes && mode != UploadMode.production) {
debugPrint('SettingsState: Development modes disabled, forcing production mode');
mode = UploadMode.production;
}
// The upload mode dropdown is only visible when kEnableDevelopmentModes is
// true (gated in osm_account_screen.dart), so no secrets/dev-mode guards
// are needed here. The init() method handles forcing the correct mode on
// startup for production builds and builds without OAuth secrets.
_uploadMode = mode;
final prefs = await SharedPreferences.getInstance();
@@ -369,4 +395,14 @@ class SettingsState extends ChangeNotifier {
}
}
/// Set distance unit (metric or imperial)
Future<void> setDistanceUnit(DistanceUnit unit) async {
if (_distanceUnit != unit) {
_distanceUnit = unit;
final prefs = await SharedPreferences.getInstance();
await prefs.setInt(_distanceUnitPrefsKey, unit.index);
notifyListeners();
}
}
}

Some files were not shown because too many files have changed in this diff Show More