From 7da6f95e87c3c1c7b85e44310f05e32363256f8c Mon Sep 17 00:00:00 2001 From: jack Date: Sat, 13 Sep 2025 22:26:34 +0200 Subject: [PATCH] Fix notes icon color: subscribe/count at block-level geohash\n\n- Use block (precision 7) geohash for notes: when opening sheet, on channel changes, and when subscribing the counter.\n- Aligns with LocationNotesManager which publishes at street-level geohash, allowing the counter to detect notes and turn icon blue. --- bitchat/Views/ContentView.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bitchat/Views/ContentView.swift b/bitchat/Views/ContentView.swift index 10333d24..71e7de2b 100644 --- a/bitchat/Views/ContentView.swift +++ b/bitchat/Views/ContentView.swift @@ -1186,7 +1186,7 @@ struct ContentView: View { 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 = LocationChannelManager.shared.availableChannels.first(where: { $0.level == .block })?.geohash showLocationNotes = true }) { HStack(alignment: .center, spacing: 4) { @@ -1240,7 +1240,7 @@ struct ContentView: View { } .sheet(isPresented: $showLocationNotes) { Group { - if let gh = notesGeohash ?? LocationChannelManager.shared.availableChannels.first(where: { $0.level == .building })?.geohash { + if let gh = notesGeohash ?? LocationChannelManager.shared.availableChannels.first(where: { $0.level == .block })?.geohash { LocationNotesView(geohash: gh, onNotesCountChanged: { cnt in sheetNotesCount = cnt }) .environmentObject(viewModel) } else { @@ -1286,7 +1286,7 @@ struct ContentView: View { sheetNotesCount = 0 } .onChange(of: locationManager.availableChannels) { channels in - if let current = channels.first(where: { $0.level == .building })?.geohash, + if let current = channels.first(where: { $0.level == .block })?.geohash, notesGeohash != current { notesGeohash = current #if os(iOS) @@ -1530,8 +1530,8 @@ extension ContentView { if locationManager.permissionState == .authorized { LocationChannelManager.shared.refreshChannels() } - if let building = LocationChannelManager.shared.availableChannels.first(where: { $0.level == .building })?.geohash { - LocationNotesCounter.shared.subscribe(geohash: building) + if let block = LocationChannelManager.shared.availableChannels.first(where: { $0.level == .block })?.geohash { + LocationNotesCounter.shared.subscribe(geohash: block) } else { LocationNotesCounter.shared.cancel() }