Notes icon: use sheet count until counter finishes initial load; don’t zero on sheet close\n\n- Compute hasNotes using max(count, sheetCount) while initialLoadComplete is false.\n- Remove sheetNotesCount reset on sheet disappear to avoid transient grey.

This commit is contained in:
jack
2025-09-13 22:46:43 +02:00
parent 2b567bfb97
commit e855a2e40b
+2 -2
View File
@@ -1190,7 +1190,8 @@ struct ContentView: View {
showLocationNotes = true showLocationNotes = true
}) { }) {
HStack(alignment: .center, spacing: 4) { HStack(alignment: .center, spacing: 4) {
let hasNotes = ((notesCounter.count ?? 0) > 0) || (sheetNotesCount > 0) let currentCount = (notesCounter.count ?? 0)
let hasNotes = (!notesCounter.initialLoadComplete ? max(currentCount, sheetNotesCount) : currentCount) > 0
Image(systemName: "long.text.page.and.pencil") Image(systemName: "long.text.page.and.pencil")
.font(.system(size: 12)) .font(.system(size: 12))
.foregroundColor(hasNotes ? textColor : Color.gray) .foregroundColor(hasNotes ? textColor : Color.gray)
@@ -1283,7 +1284,6 @@ struct ContentView: View {
} }
.onDisappear { .onDisappear {
LocationChannelManager.shared.endLiveRefresh() LocationChannelManager.shared.endLiveRefresh()
sheetNotesCount = 0
} }
.onChange(of: locationManager.availableChannels) { channels in .onChange(of: locationManager.availableChannels) { channels in
if let current = channels.first(where: { $0.level == .building })?.geohash, if let current = channels.first(where: { $0.level == .building })?.geohash,