Notes header: show count in parentheses; icon shows blue if any notes, grey if none; only start live location updates while sheet is open; reduce nickname width; set live distance filter to 10m

This commit is contained in:
jack
2025-09-13 12:31:02 +02:00
parent 78f1bd3ad9
commit e08e5c8e65
3 changed files with 7 additions and 31 deletions
+1 -1
View File
@@ -103,7 +103,7 @@ enum TransportConfig {
// Location // Location
static let locationDistanceFilterMeters: Double = 1000 static let locationDistanceFilterMeters: Double = 1000
// Live (channel sheet open) distance threshold for meaningful updates // Live (channel sheet open) distance threshold for meaningful updates
static let locationDistanceFilterLiveMeters: Double = 21.0 static let locationDistanceFilterLiveMeters: Double = 10.0
static let locationLiveRefreshInterval: TimeInterval = 5.0 static let locationLiveRefreshInterval: TimeInterval = 5.0
// Notifications (geohash) // Notifications (geohash)
+5 -29
View File
@@ -1185,15 +1185,11 @@ struct ContentView: View {
showLocationNotes = true showLocationNotes = true
}) { }) {
HStack(alignment: .center, spacing: 4) { HStack(alignment: .center, spacing: 4) {
let hasNotes = (notesCounter.count ?? 0) > 0
Image(systemName: "long.text.page.and.pencil") Image(systemName: "long.text.page.and.pencil")
.font(.system(size: 12)) .font(.system(size: 12))
.foregroundColor(Color(hue: 0.60, saturation: 0.85, brightness: 0.82)) .foregroundColor(hasNotes ? Color(hue: 0.60, saturation: 0.85, brightness: 0.82) : Color.gray)
.padding(.top, 1) .padding(.top, 1)
Text("\(notesCounter.count ?? 0)")
.font(.system(size: 11, design: .monospaced))
.foregroundColor(Color(hue: 0.60, saturation: 0.85, brightness: 0.82))
.lineLimit(1)
.fixedSize(horizontal: true, vertical: false)
} }
.fixedSize(horizontal: true, vertical: false) .fixedSize(horizontal: true, vertical: false)
} }
@@ -1286,30 +1282,10 @@ struct ContentView: View {
LocationChannelManager.shared.endLiveRefresh() LocationChannelManager.shared.endLiveRefresh()
} }
} }
.onAppear { .onAppear { updateNotesCounterSubscription() }
updateNotesCounterSubscription() .onChange(of: locationManager.selectedChannel) { _ in updateNotesCounterSubscription() }
// Keep live updates running while on mesh to follow building changes
if case .mesh = locationManager.selectedChannel, locationManager.permissionState == .authorized {
LocationChannelManager.shared.beginLiveRefresh()
}
}
.onChange(of: locationManager.selectedChannel) { _ in
updateNotesCounterSubscription()
if case .mesh = locationManager.selectedChannel, locationManager.permissionState == .authorized {
LocationChannelManager.shared.beginLiveRefresh()
} else {
LocationChannelManager.shared.endLiveRefresh()
}
}
.onChange(of: locationManager.availableChannels) { _ in updateNotesCounterSubscription() } .onChange(of: locationManager.availableChannels) { _ in updateNotesCounterSubscription() }
.onChange(of: locationManager.permissionState) { _ in .onChange(of: locationManager.permissionState) { _ in updateNotesCounterSubscription() }
updateNotesCounterSubscription()
if case .mesh = locationManager.selectedChannel, locationManager.permissionState == .authorized {
LocationChannelManager.shared.beginLiveRefresh()
} else {
LocationChannelManager.shared.endLiveRefresh()
}
}
.alert("heads up", isPresented: $viewModel.showScreenshotPrivacyWarning) { .alert("heads up", isPresented: $viewModel.showScreenshotPrivacyWarning) {
Button("ok", role: .cancel) {} Button("ok", role: .cancel) {}
} message: { } message: {
+1 -1
View File
@@ -42,7 +42,7 @@ struct LocationNotesView: View {
private var header: some View { private var header: some View {
HStack { HStack {
VStack(alignment: .leading, spacing: 2) { VStack(alignment: .leading, spacing: 2) {
Text("notes @ #\(geohash)") Text("notes @ #\(geohash) (\(manager.notes.count))")
.font(.system(size: 16, weight: .bold, design: .monospaced)) .font(.system(size: 16, weight: .bold, design: .monospaced))
if let buildingName = locationManager.locationNames[.building], !buildingName.isEmpty { if let buildingName = locationManager.locationNames[.building], !buildingName.isEmpty {
Text(buildingName) Text(buildingName)