MeshBeaconRepository

class MeshBeaconRepository(prefs: MeshBeaconPrefs, scope: CoroutineScope)(source)

Holds Mesh Beacon invitations received from other meshes. Beacons are advisory, zero-hop advertisements — not messages or contacts — so they live in the Discovery surface, which presents them for the user to Discover / Join / Dismiss. The list is capped and deduped in memory (the source of truth) and written through to MeshBeaconPrefs so invitations survive an app restart until the user explicitly dismisses them (Apple 014-mesh-beacons FR-015).

Note: persisted as opaque delimited records in a Preferences DataStore, not a Room table — the set is tiny (≤ MAX_OFFERS) and never queried. Promote to a Room entity alongside the discovery tables if querying/joins appear.

Constructors

Link copied to clipboard
constructor(prefs: MeshBeaconPrefs, scope: CoroutineScope)

Properties

Link copied to clipboard
val offers: StateFlow<List<MeshBeaconOffer>>

Functions

Link copied to clipboard

Records a received offer, replacing any prior offer with the same key (a re-broadcast of a standing invitation). Returns true when this is a newly-seen invitation, so the caller can notify only once rather than on every periodic re-broadcast.

Link copied to clipboard
fun dismiss(key: String)