From 1e75eb845ff5b1f87cb2c7ab61875f56d633b0ad Mon Sep 17 00:00:00 2001 From: "evgeniy.chernomortsev" Date: Tue, 9 Dec 2025 03:56:40 +0400 Subject: [PATCH 1/2] fix(ui): move location notes button from #mesh to location channels Notes post permanent data to Nostr (internet), not to local mesh. Showing this button in #mesh was confusing and risked accidental location linking. Now only appears in geohash-based channels. Closes #904 --- bitchat/Views/ContentView.swift | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/bitchat/Views/ContentView.swift b/bitchat/Views/ContentView.swift index ba69c9596..45d36fbe8 100644 --- a/bitchat/Views/ContentView.swift +++ b/bitchat/Views/ContentView.swift @@ -1282,14 +1282,12 @@ struct ContentView: View { String(localized: "content.accessibility.open_unread_private_chat", comment: "Accessibility label for the unread private chat button") ) } - // Notes icon (mesh only and when location is authorized), to the left of #mesh - if case .mesh = locationManager.selectedChannel, locationManager.permissionState == .authorized { + // Bookmark toggle and notes icon (geochats only): to the left of #geohash + // Notes post to Nostr (internet), so they belong in location channels, not #mesh + if case .location(let ch) = locationManager.selectedChannel { + // Notes icon - posts permanent notes to Nostr for this location Button(action: { - // Kick a one-shot refresh and show the sheet immediately. - LocationChannelManager.shared.enableLocationChannels() - LocationChannelManager.shared.refreshChannels() - // If we already have a block geohash, pass it; otherwise wait in the sheet. - notesGeohash = LocationChannelManager.shared.availableChannels.first(where: { $0.level == .building })?.geohash + notesGeohash = ch.geohash showLocationNotes = true }) { HStack(alignment: .center, spacing: 4) { @@ -1304,10 +1302,6 @@ struct ContentView: View { .accessibilityLabel( String(localized: "content.accessibility.location_notes", comment: "Accessibility label for location notes button") ) - } - - // Bookmark toggle (geochats): to the left of #geohash - if case .location(let ch) = locationManager.selectedChannel { Button(action: { GeohashBookmarksStore.shared.toggle(ch.geohash) }) { Image(systemName: GeohashBookmarksStore.shared.isBookmarked(ch.geohash) ? "bookmark.fill" : "bookmark") .font(.bitchatSystem(size: 12)) From c320ad24dd662a041bf209b826540431617ad02f Mon Sep 17 00:00:00 2001 From: "evgeniy.chernomortsev" Date: Tue, 9 Dec 2025 15:04:37 +0400 Subject: [PATCH 2/2] fix: preserve selected geohash when notes sheet is open Don't auto-update notesGeohash when location channels refresh if the notes sheet is already open. This ensures the user sees notes for the channel they selected, not the current building location. Addresses review feedback from Codex bot. --- bitchat/Views/ContentView.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bitchat/Views/ContentView.swift b/bitchat/Views/ContentView.swift index 45d36fbe8..2d827e351 100644 --- a/bitchat/Views/ContentView.swift +++ b/bitchat/Views/ContentView.swift @@ -1436,6 +1436,9 @@ struct ContentView: View { LocationChannelManager.shared.endLiveRefresh() } .onChange(of: locationManager.availableChannels) { channels in + // Only auto-update notesGeohash if sheet is not already open + // (user may have selected a specific channel's geohash) + guard !showLocationNotes else { return } if let current = channels.first(where: { $0.level == .building })?.geohash, notesGeohash != current { notesGeohash = current