mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 19:45:22 +00:00
Notes header: show building name when available (fallback to block name)
This commit is contained in:
@@ -52,6 +52,7 @@ struct ContentView: View {
|
|||||||
@State private var expandedMessageIDs: Set<String> = []
|
@State private var expandedMessageIDs: Set<String> = []
|
||||||
@State private var showLocationNotes = false
|
@State private var showLocationNotes = false
|
||||||
@State private var notesGeohash: String? = nil
|
@State private var notesGeohash: String? = nil
|
||||||
|
@State private var notesRefreshTimer: Timer? = nil
|
||||||
// Window sizes for rendering (infinite scroll up)
|
// Window sizes for rendering (infinite scroll up)
|
||||||
@State private var windowCountPublic: Int = 300
|
@State private var windowCountPublic: Int = 300
|
||||||
@State private var windowCountPrivate: [String: Int] = [:]
|
@State private var windowCountPrivate: [String: Int] = [:]
|
||||||
@@ -1269,12 +1270,25 @@ struct ContentView: View {
|
|||||||
.background(backgroundColor)
|
.background(backgroundColor)
|
||||||
.foregroundColor(textColor)
|
.foregroundColor(textColor)
|
||||||
.onChange(of: locationManager.availableChannels) { channels in
|
.onChange(of: locationManager.availableChannels) { channels in
|
||||||
if notesGeohash == nil, let building = channels.first(where: { $0.level == .building }) {
|
if let building = channels.first(where: { $0.level == .building }) {
|
||||||
notesGeohash = building.geohash
|
if notesGeohash != building.geohash { notesGeohash = building.geohash }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.onAppear {
|
||||||
|
// Ensure we are authorized and start periodic refresh while the sheet is open
|
||||||
|
LocationChannelManager.shared.enableLocationChannels()
|
||||||
|
LocationChannelManager.shared.refreshChannels()
|
||||||
|
notesRefreshTimer?.invalidate()
|
||||||
|
notesRefreshTimer = Timer.scheduledTimer(withTimeInterval: 10.0, repeats: true) { _ in
|
||||||
|
LocationChannelManager.shared.refreshChannels()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.onDisappear {
|
||||||
|
notesRefreshTimer?.invalidate()
|
||||||
|
notesRefreshTimer = nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.onAppear { updateNotesCounterSubscription() }
|
.onAppear { updateNotesCounterSubscription() }
|
||||||
.onChange(of: locationManager.selectedChannel) { _ in updateNotesCounterSubscription() }
|
.onChange(of: locationManager.selectedChannel) { _ in updateNotesCounterSubscription() }
|
||||||
|
|||||||
@@ -44,7 +44,11 @@ struct LocationNotesView: View {
|
|||||||
VStack(alignment: .leading, spacing: 2) {
|
VStack(alignment: .leading, spacing: 2) {
|
||||||
Text("notes @ #\(geohash)")
|
Text("notes @ #\(geohash)")
|
||||||
.font(.system(size: 16, weight: .bold, design: .monospaced))
|
.font(.system(size: 16, weight: .bold, design: .monospaced))
|
||||||
if let blockName = locationManager.locationNames[.block], !blockName.isEmpty {
|
if let buildingName = locationManager.locationNames[.building], !buildingName.isEmpty {
|
||||||
|
Text(buildingName)
|
||||||
|
.font(.system(size: 12, design: .monospaced))
|
||||||
|
.foregroundColor(secondaryTextColor)
|
||||||
|
} else if let blockName = locationManager.locationNames[.block], !blockName.isEmpty {
|
||||||
Text(blockName)
|
Text(blockName)
|
||||||
.font(.system(size: 12, design: .monospaced))
|
.font(.system(size: 12, design: .monospaced))
|
||||||
.foregroundColor(secondaryTextColor)
|
.foregroundColor(secondaryTextColor)
|
||||||
|
|||||||
Reference in New Issue
Block a user