app

Local-first trade for farms and co-ops
git clone https://radroots.dev/git/app.git
Log | Files | Refs | README | LICENSE

commit 140c6e99217b0f681450df0a5f53a1294f895559
parent 0a87640f8f3434621c2cf7faa499715544504c4d
Author: triesap <tyson@radroots.org>
Date:   Sun, 22 Mar 2026 01:40:51 +0000

web: report unavailable location resolver boundary

- implement the shared location resolver methods on wasm so queries return unavailable instead of falling back to unsupported
- keep wasm honest about the current offline geocoder limitation rather than implying location queries are not part of the app contract
- reuse the existing offline geocoder unavailable state to align resolver behavior with platform diagnostics
- add web tests for the unavailable resolver status and verify the wasm target still checks cleanly

Diffstat:
Mcrates/web/src/lib.rs | 40+++++++++++++++++++++++++++++++++++++++-
1 file changed, 39 insertions(+), 1 deletion(-)

diff --git a/crates/web/src/lib.rs b/crates/web/src/lib.rs @@ -13,10 +13,14 @@ use nostr::nips::nip19::ToBech32; use nostr::signer::NostrSigner; #[cfg(target_arch = "wasm32")] use nostr_browser_signer::{BrowserSigner, Error as BrowserSignerError}; +#[cfg(test)] +use radroots_app_core::RadrootsLocationResolverError; #[cfg(target_arch = "wasm32")] use radroots_app_core::{ HomeActionKind, HomeActionResult, HomeActionState, IdentityGateState, RadrootsApp, - RadrootsAppBackend, SetupActionState, + RadrootsAppBackend, RadrootsLocationCountry, RadrootsLocationPoint, + RadrootsLocationResolverError, RadrootsLocationReverseOptions, RadrootsResolvedLocation, + SetupActionState, }; #[cfg(any(target_arch = "wasm32", test))] use radroots_app_core::{ @@ -33,6 +37,11 @@ fn offline_geocoder_unavailable_state() -> RadrootsOfflineGeocoderState { ) } +#[cfg(any(target_arch = "wasm32", test))] +fn location_resolver_unavailable_error() -> RadrootsLocationResolverError { + RadrootsLocationResolverError::Unavailable +} + #[cfg(target_arch = "wasm32")] #[derive(Clone)] struct ConnectedSigner { @@ -112,6 +121,27 @@ impl RadrootsAppBackend for WebBackend { Some(offline_geocoder_unavailable_state()) } + fn reverse_location( + &self, + _point: RadrootsLocationPoint, + _options: Option<RadrootsLocationReverseOptions>, + ) -> Result<Vec<RadrootsResolvedLocation>, RadrootsLocationResolverError> { + Err(location_resolver_unavailable_error()) + } + + fn list_location_countries( + &self, + ) -> Result<Vec<RadrootsLocationCountry>, RadrootsLocationResolverError> { + Err(location_resolver_unavailable_error()) + } + + fn location_country_center( + &self, + _country_id: &str, + ) -> Result<RadrootsLocationPoint, RadrootsLocationResolverError> { + Err(location_resolver_unavailable_error()) + } + fn setup_action_state(&self) -> SetupActionState { let state = self.state.borrow(); match &state.connection { @@ -305,6 +335,14 @@ mod tests { ) ); } + + #[test] + fn location_resolver_reports_unavailable_instead_of_unsupported() { + assert_eq!( + location_resolver_unavailable_error(), + RadrootsLocationResolverError::Unavailable + ); + } } #[cfg(not(target_arch = "wasm32"))]