Skip to content

Merge main into rail generator v1.#91

Open
Jasupa wants to merge 4 commits into
rail-generatorfrom
main
Open

Merge main into rail generator v1.#91
Jasupa wants to merge 4 commits into
rail-generatorfrom
main

Conversation

@Jasupa

@Jasupa Jasupa commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

PR meant to make the rail gen v1 branch up to date with main.

Zoriot added 4 commits June 20, 2026 23:31
…load and thread-safety fixes

- Add optional offline country/region lookup using alpslib-geo RgcHandler
- Automatically download and cache RGC database on first run from configured URL
- Fall back to online Photon/Komoot API if local database disabled or unavailable
- Mark rgcHandler field as volatile to guarantee cross-thread visibility
- Mark Module.enabled as volatile to ensure reliable isEnabled() checks across threads
- Schedule RgcHandler creation and all method calls on main thread to prevent concurrent access
- Create parent directories before FileOutputStream to handle first-run download
- Use try-with-resources for download streams to prevent resource leaks
- Schedule RGC lookups on main thread when called from worker threads in OpenStreetMapAPI
- Add getCCA2FromCountryName() fallback helper for country code lookup
- Add RGC configuration options: enabled, url, path under reverse-geocode.local-database
- Handle download failures gracefully with logging and fallback to API

Dependencies:
- Add com.alpsbte.alpslib:alpslib-geo:1.0.0

Files:
- build.gradle.kts: add alpslib-geo dependency
- gradle/libs.versions.toml: define alpslib-geo version
- settings.gradle.kts: enable mavenLocal() (TEMPORARY - disable before merge)
- NavigationModule.java: add RGC initialization with auto-download
- Module.java: mark enabled field volatile
- OpenStreetMapAPI.java: schedule RGC lookups on main thread
- NavUtils.java: add getCCA2FromCountryName() helper
- ConfigPaths.java: add RGC_LOCAL_DB_* constants
- WarpsComponent.java, WarpEditMenu.java: use fallback country code lookup
- config.yml: document RGC local-database settings
Address PR review by splitting RGC setup, region lookup, and OpenStreetMap
country resolution into focused methods and switch-based flows.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants