Empty-mesh liveliness: nearby conversations, echoes, wave, dead drops, radar (#1409)

* Empty-mesh liveliness: nearby conversations, echoes, wave action, dead drops, radar

The empty mesh timeline was a dead end: a grey zero and "nobody in range
yet". This turns it into a live surface and gives the app pull when the
mesh wakes up:

- Nearest conversation: background geohash sampling now tracks actual
  chat messages (not just presence) per regional channel; the empty state
  surfaces the busiest nearby conversation with a preview, one tap to
  join (GeohashChatActivityTracker, fed from GeoPresenceTracker).
- Echoes: the carried 6h store-and-forward window renders as dimmed
  "heard here earlier" rows at launch (new Transport
  collectArchivedPublicMessages -> GossipSyncManager snapshot, decoded
  with signature-derived nicknames; content-identity dedup guards
  against re-synced duplicates).
- Wave: the "bitchatters nearby" notification gains a "wave" quick
  action that broadcasts a mesh 👋 straight from the notification, even
  backgrounded (first UNNotificationCategory in the app).
- Dead drops: /drop pins a note to the current building geohash as a
  kind-1 location note with a 24h NIP-40 expiry; expired notes are now
  dropped client-side at ingest; the notices sheet shows "fades in Xh";
  a "location notes" toggle plus location-permission controls live in
  app info (also fixes the duplicated Voice section).
- Radar: an ambient sonar animation shows the radio scanning, with a
  privacy-safe daily tally ("N devices passed within range today" via
  salted per-day hashes) and a "notes left here" hint that opens the
  notices geo tab.

All new user-facing strings ship in all 29 locales. 1403 tests green,
including new suites for the activity tracker, sightings tally, and
note expiry/drop publishing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Review round: app-info polish, urgent/expiry parity, centered radar, pin fill, Codex P2s

- App info: LOCATION header uppercased like sibling sections; location
  notes and live voice descriptions shortened (29 locales); redundant
  "location access granted" line removed.
- Notices parity: urgent + expiry controls now show on the geo tab too;
  the bridged Nostr note carries ["t","urgent"] and NIP-40 so relay-side
  readers see both; urgent parsed back from incoming notes.
- Radar moved from the top of the empty state to the center of the chat
  area, below the help text (empty state fills the visible height).
- Header pin fills whenever the scope has notices (was: only unseen),
  and Nostr-only nearby notes now light it too.
- Codex P2 fixes: notification completion deferred until the wave action
  is handled (background suspension dropped the send); NIP-40 notes now
  prune on a timer when they expire while displayed; the location-notes
  kill switch retargets the nearby-notes counter immediately.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Hide macOS segmented picker's built-in label in notices composer (duplicate 'expires in')

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Geo notes: permanent (∞) expiry default, urgent stays mesh-only

- Geo expiry picker gains ∞ as the default: a permanent note posts as a
  pure relay note (no NIP-40 tag, no mesh-board copy — a board copy must
  fade within days, contradicting the ∞ the user picked). 1/3/7d keep
  the board + bridged-note path with NIP-40.
- The notes manager is now owned by the notices sheet (not the list) so
  the composer local-echoes ∞ notes into the list; it revives via
  refresh() after a tab-switch cancel, and its expiry-prune timer
  survives cancel (weak self, dies with the instance).
- Urgent toggle returns to mesh-only per review — notes are ambient;
  the read-side urgent-tag parse stays so tagged notes still render.
- macOS: hide the segmented picker's built-in label (duplicate
  "expires in").

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Clearing the mesh timeline dismisses echoes for good; tighter divider copy

Triple-tap /clear emptied the timeline but the next launch re-seeded
"heard here earlier" from the persisted archive. A MeshEchoSettings
watermark now records the clear; only messages heard after it come back
(the archive itself still carries everything for peers' sync). The
echo dedup keys reset with it, and panic wipe drops the watermark.

Divider copy tightened to "heard here earlier · last 6h" (29 locales).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Echoes visual polish: tinted history block, radar-captioned tally, ambient footer

Device-test feedback on the echoes screen:
- Archived echoes now sit on a subtle tinted background (secondary at
  8%) in addition to the dim, so "heard here earlier" reads as one
  distinct block; the divider carries the echo ID prefix to join it.
- "N devices passed within range today" moves out of the narration
  lines to sit centered under the radar as its caption.
- When the timeline holds only echoes/system lines, a compact ambient
  footer (small radar + tally + live hints) renders below the history
  instead of the whole ambient layer vanishing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Notes strip persists above the mesh chat; leaner empty-state narration

- The 📍 "notes left here" line was empty-state-only, so starting a
  conversation hid it. It is now a tappable strip pinned above the mesh
  timeline whenever unexpired notes exist at this place (opens the
  notices geo tab); the nearby-notes counter runs for the whole mesh
  timeline, not just the empty state.
- Empty state narration drops "nobody in range yet..." (the radar and
  the sightings caption already say it) and the nearby-conversation
  hint moves below the help line instead of splitting the narration.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Radar means searching: hide the sweep once mesh peers are connected or reachable

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: jack <jackjackbits@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
jack
2026-07-08 13:24:44 +02:00
committed by GitHub
co-authored by jack Claude Fable 5
parent ef848857b7
commit 74b8a47d02
37 changed files with 4633 additions and 100 deletions
+100 -5
View File
@@ -19,6 +19,8 @@ struct MessageListView: View {
@EnvironmentObject private var privateConversationModel: PrivateConversationModel
@EnvironmentObject private var conversationUIModel: ConversationUIModel
@EnvironmentObject private var locationChannelsModel: LocationChannelsModel
@EnvironmentObject private var appChromeModel: AppChromeModel
@ObservedObject private var nearbyNotes = NearbyNotesCounter.shared
@Environment(\.colorScheme) private var colorScheme
@Environment(\.appTheme) private var theme
@@ -45,6 +47,9 @@ struct MessageListView: View {
/// switches swap the timeline wholesale, so a count delta is only a
/// "new messages" signal while the context is unchanged.
@State private var unseenBaselineKey = ""
/// Whether this instance holds the nearby-notes counter active (mesh
/// public timeline only); balanced against activate/deactivate.
@State private var holdsNotesCounter = false
@ThemedPalette private var palette
@@ -72,10 +77,19 @@ struct MessageListView: View {
return MessageDisplayItem(id: "\(contextKey)|\(message.id)", message: message)
}
VStack(spacing: 0) {
// Notes pinned to this place stay visible while chatting a
// conversation starting must not hide what's left here.
if privatePeer == nil,
case .mesh = locationChannelsModel.selectedChannel,
nearbyNotes.noteCount > 0 {
notesHereStrip
}
GeometryReader { geometry in
ScrollViewReader { proxy in
ScrollView {
if messageItems.isEmpty && privatePeer == nil {
publicEmptyState
publicEmptyState(fillHeight: geometry.size.height)
}
LazyVStack(alignment: .leading, spacing: 0) {
ForEach(messageItems) { item in
@@ -150,10 +164,23 @@ struct MessageListView: View {
}
.padding(.horizontal, 12)
.padding(.vertical, 1)
// Archived echoes read as one tinted block, not
// just faded rows.
.background(message.isArchivedEcho ? palette.secondary.opacity(0.08) : Color.clear)
}
}
.transaction { tx in if conversationUIModel.isBatchingPublic { tx.disablesAnimations = true } }
.padding(.vertical, 2)
// Only carried history on screen: the ambient layer (radar,
// sightings, live hints) stays visible below it instead of
// vanishing the moment echoes exist.
if privatePeer == nil, showsAmbientFooter(messageItems: messageItems) {
MeshEmptyStateView(compact: true)
.padding(.horizontal, 12)
.padding(.top, 20)
.padding(.bottom, 8)
}
}
.overlay(alignment: .bottomTrailing) {
if !isAtBottom && !messageItems.isEmpty {
@@ -246,6 +273,12 @@ struct MessageListView: View {
scrollThrottleTimer?.invalidate()
}
}
}
}
.onAppear { updateNotesCounterHold() }
.onDisappear { releaseNotesCounterHold() }
.onChange(of: locationChannelsModel.selectedChannel) { _ in updateNotesCounterHold() }
.onChange(of: privatePeer) { _ in updateNotesCounterHold() }
.environment(\.openURL, OpenURLAction { url in
// Intercept custom cashu: links created in attributed text
if let scheme = url.scheme?.lowercased(), scheme == "cashu" || scheme == "lightning" {
@@ -270,16 +303,75 @@ private extension MessageListView {
return locationChannelsModel.selectedChannel.contextKey
}
/// Tappable strip above the mesh timeline while notes are pinned at this
/// place: opens the notices sheet on the geo tab.
var notesHereStrip: some View {
let text: String = nearbyNotes.noteCount == 1
? String(localized: "content.empty.notes_one", comment: "Hint when exactly one note was left at this place")
: String(
format: String(localized: "content.empty.notes_many", comment: "Hint counting notes left at this place"),
locale: .current,
nearbyNotes.noteCount
)
return Button {
appChromeModel.presentNotices(geoTab: true)
} label: {
HStack(spacing: 6) {
Text(verbatim: "📍 \(text)")
.bitchatFont(size: 12)
.foregroundColor(palette.primary)
Spacer()
Image(systemName: "chevron.right")
.font(.bitchatSystem(size: 10))
.foregroundColor(palette.secondary)
}
.padding(.horizontal, 12)
.padding(.vertical, 7)
.background(palette.secondary.opacity(0.08))
.contentShape(Rectangle())
}
.buttonStyle(.plain)
}
/// The nearby-notes counter runs whenever the mesh public timeline is
/// showing the strip needs a live count before it can decide to exist.
func updateNotesCounterHold() {
let shouldHold = privatePeer == nil && locationChannelsModel.selectedChannel.isMesh
guard shouldHold != holdsNotesCounter else { return }
holdsNotesCounter = shouldHold
if shouldHold {
NearbyNotesCounter.shared.activate()
} else {
NearbyNotesCounter.shared.deactivate()
}
}
func releaseNotesCounterHold() {
guard holdsNotesCounter else { return }
holdsNotesCounter = false
NearbyNotesCounter.shared.deactivate()
}
/// True when the mesh timeline holds nothing but archived echoes and
/// system lines no live conversation yet, so the ambient layer still
/// applies.
private func showsAmbientFooter(messageItems: [MessageDisplayItem]) -> Bool {
guard case .mesh = locationChannelsModel.selectedChannel,
!messageItems.isEmpty else { return false }
return messageItems.allSatisfy { $0.message.isArchivedEcho || $0.message.sender == "system" }
}
/// Terminal-styled narration for an empty public timeline: says which
/// channel this is, that the app is waiting for peers, and where to go
/// next. Rendered inside the ScrollView; disappears with the first row.
var publicEmptyState: some View {
/// The mesh case fills the visible chat height so its radar can center
/// in the space below the text.
func publicEmptyState(fillHeight: CGFloat) -> some View {
VStack(alignment: .leading, spacing: 6) {
switch locationChannelsModel.selectedChannel {
case .mesh:
emptyStateLine(String(localized: "content.empty.mesh_intro", comment: "First line of the empty mesh timeline explaining what the mesh channel is"))
emptyStateLine(String(localized: "content.empty.mesh_waiting", comment: "Second line of the empty mesh timeline saying no peers are in range yet"))
emptyStateLine(String(localized: "content.empty.switch_hint", comment: "Empty timeline hint pointing at the channel switcher and the help screen"))
MeshEmptyStateView(fillHeight: max(0, fillHeight - 24))
case .location(let channel):
emptyStateLine(
String(
@@ -410,6 +502,9 @@ private extension MessageListView {
TextMessageView(message: message)
}
}
// Archived echoes ("heard here earlier") render dimmed: real history,
// visually distinct from the live conversation.
.opacity(message.isArchivedEcho ? 0.55 : 1)
}
@ViewBuilder