field_ios

In-the-field app for Radroots on iOS
git clone https://radroots.dev/git/field_ios.git
Log | Files | Refs | README | LICENSE

commit 0abd3d1d66b19cf82e89feae23f43c4c31b0e282
parent 877e7ef9e42981f81a3db582f21811dd35001ed1
Author: triesap <tyson@radroots.org>
Date:   Sun, 12 Jul 2026 00:50:57 +0000

crate-surface: adopt final app runtime crates

- move app runtime dependencies to radroots_event and radroots_event_codec
- update trade listing runtime code for current listing payload types
- require public geohash input for structured listing drafts
- validate with workspace cargo check, tests, and removed-name scans

Diffstat:
Mcore/crates/tera_core/Cargo.toml | 6+++---
Mcore/crates/tera_core/src/runtime/mod.rs | 4++--
Mcore/crates/tera_core/src/runtime/nostr.rs | 6+++---
Mcore/crates/tera_core/src/runtime/trade_listing.rs | 20++++++++++----------
Mcore/crates/tera_core/tests/error_mapping.rs | 3++-
5 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/core/crates/tera_core/Cargo.toml b/core/crates/tera_core/Cargo.toml @@ -22,7 +22,7 @@ rt = ["radroots_net_core/rt"] nostr-client = [ "radroots_net_core/nostr-client", "dep:radroots_core", - "dep:radroots_events_codec", + "dep:radroots_event_codec", "dep:radroots_trade", "dep:radroots_identity", "dep:radroots_nostr", @@ -32,11 +32,11 @@ fs-persistence = ["radroots_net_core/fs-persistence"] [dependencies] radroots_log = { workspace = true } -radroots_events = { workspace = true } +radroots_event = { workspace = true } radroots_net_core = { workspace = true, features = ["std"] } radroots_core = { workspace = true, optional = true } radroots_identity = { workspace = true, optional = true, default-features = false, features = ["std"] } -radroots_events_codec = { workspace = true, features = ["serde_json"], optional = true } +radroots_event_codec = { workspace = true, features = ["serde_json"], optional = true } radroots_trade = { workspace = true, features = ["std", "serde", "serde_json"], optional = true } radroots_nostr = { workspace = true, features = ["events"], optional = true } chrono = { workspace = true } diff --git a/core/crates/tera_core/src/runtime/mod.rs b/core/crates/tera_core/src/runtime/mod.rs @@ -33,8 +33,8 @@ pub struct RadrootsRuntime { pub(crate) post_events_rx: Mutex< Option< Receiver< - radroots_events_codec::parsed::RadrootsParsedData< - radroots_events::post::RadrootsPost, + radroots_event_codec::parsed::RadrootsParsedData< + radroots_event::post::RadrootsPost, >, >, >, diff --git a/core/crates/tera_core/src/runtime/nostr.rs b/core/crates/tera_core/src/runtime/nostr.rs @@ -78,7 +78,7 @@ pub struct NostrPostEventMetadata { #[cfg(feature = "nostr-client")] fn map_post_event_metadata( - event: radroots_events_codec::parsed::RadrootsParsedData<radroots_events::post::RadrootsPost>, + event: radroots_event_codec::parsed::RadrootsParsedData<radroots_event::post::RadrootsPost>, ) -> NostrPostEventMetadata { NostrPostEventMetadata { id: event.id, @@ -92,8 +92,8 @@ fn map_post_event_metadata( #[cfg(feature = "nostr-client")] fn map_profile_event_metadata( - event: radroots_events_codec::parsed::RadrootsParsedData< - radroots_events_codec::profile::RadrootsProfileData, + event: radroots_event_codec::parsed::RadrootsParsedData< + radroots_event_codec::profile::RadrootsProfileData, >, ) -> NostrProfileEventMetadata { NostrProfileEventMetadata { diff --git a/core/crates/tera_core/src/runtime/trade_listing.rs b/core/crates/tera_core/src/runtime/trade_listing.rs @@ -6,18 +6,18 @@ use radroots_core::{ RadrootsCoreCurrency, RadrootsCoreDecimal, RadrootsCoreMoney, RadrootsCoreQuantity, RadrootsCoreQuantityPrice, RadrootsCoreUnit, }; -use radroots_events::{ - RadrootsNostrEvent, +use radroots_event::{ + RadrootsEventEnvelope, farm::RadrootsFarmRef, ids::{RadrootsDTag, RadrootsInventoryBinId}, kinds::KIND_LISTING, listing::{ RadrootsListing, RadrootsListingAvailability, RadrootsListingBin, - RadrootsListingDeliveryMethod, RadrootsListingLocation, RadrootsListingProduct, + RadrootsListingDeliveryMethod, RadrootsListingProduct, RadrootsListingPublicLocation, RadrootsListingStatus, }, }; -use radroots_events_codec::listing::encode::to_wire_parts as listing_to_wire_parts; +use radroots_event_codec::listing::encode::to_wire_parts as listing_to_wire_parts; use radroots_nostr::prelude::{ RadrootsNostrFilter, RadrootsNostrKind, RadrootsNostrTimestamp, radroots_event_from_nostr, }; @@ -46,6 +46,7 @@ pub struct TradeListingDraft { pub location_city: Option<String>, pub location_region: Option<String>, pub location_country: Option<String>, + pub location_geohash: String, } #[derive(uniffi::Record, Debug, Clone)] @@ -213,6 +214,7 @@ fn listing_from_draft(draft: &TradeListingDraft) -> Result<RadrootsListing, Radr let unit_price = parse_decimal(&draft.unit_price, "unit_price")?; let inventory = parse_decimal(&draft.inventory, "inventory")?; let location_primary = non_empty(draft.location_primary.clone(), "location_primary")?; + let location_geohash = non_empty(draft.location_geohash.clone(), "location_geohash")?; Ok(RadrootsListing { d_tag: listing_id, @@ -254,14 +256,12 @@ fn listing_from_draft(draft: &TradeListingDraft) -> Result<RadrootsListing, Radr status: RadrootsListingStatus::Active, }), delivery_method: Some(parse_delivery_method(&draft.delivery_method)), - location: Some(RadrootsListingLocation { + location: Some(RadrootsListingPublicLocation { primary: location_primary, city: blank_to_none(draft.location_city.clone()), region: blank_to_none(draft.location_region.clone()), country: blank_to_none(draft.location_country.clone()), - lat: None, - lng: None, - geohash: None, + geohash: location_geohash, }), images: None, }) @@ -269,7 +269,7 @@ fn listing_from_draft(draft: &TradeListingDraft) -> Result<RadrootsListing, Radr fn listing_summary_from_trade( listing: radroots_trade::listing::validation::RadrootsTradeListing, - event: &RadrootsNostrEvent, + event: &RadrootsEventEnvelope, ) -> TradeListingSummary { let primary_bin = listing .listing @@ -367,7 +367,7 @@ fn delivery_method_label(value: &RadrootsListingDeliveryMethod) -> String { } } -fn location_label(value: &RadrootsListingLocation) -> String { +fn location_label(value: &RadrootsListingPublicLocation) -> String { [ Some(value.primary.as_str()), value.city.as_deref(), diff --git a/core/crates/tera_core/tests/error_mapping.rs b/core/crates/tera_core/tests/error_mapping.rs @@ -105,9 +105,10 @@ fn trade_listing_publish_with_initialized_nostr_does_not_relock_runtime() { inventory: "10".to_string(), delivery_method: "pickup".to_string(), location_primary: "farm stand".to_string(), - location_city: None, + location_city: Some("Asheville".to_string()), location_region: None, location_country: None, + location_geohash: "9q8yy".to_string(), }; let (tx, rx) = mpsc::channel(); std::thread::spawn(move || {