Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions bitchat/Views/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment on lines +1287 to 1291

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Notes button ignores selected location channel

Tapping the new notes button sets notesGeohash to the selected location channel (ch.geohash) but the sheet still runs an onChange handler (lines 1438‑1441) that overwrites notesGeohash with the first building-level geohash whenever location channels refresh (which happens on sheet appear). In any non-building location channel (block/city/bookmarked teleport), the notes view therefore shows and posts notes for the current building instead of the selected channel, defeating the intent of moving the button into location channels.

Useful? React with 👍 / 👎.

}) {
HStack(alignment: .center, spacing: 4) {
Expand All @@ -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))
Expand Down Expand Up @@ -1442,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
Expand Down