Notes sheet: add light haptic feedback when building geohash changes (iOS only)

This commit is contained in:
jack
2025-09-13 12:56:41 +02:00
parent 24cebfebf2
commit 58eb83b73a
+13 -5
View File
@@ -1266,11 +1266,7 @@ struct ContentView: View {
} }
.background(backgroundColor) .background(backgroundColor)
.foregroundColor(textColor) .foregroundColor(textColor)
.onChange(of: locationManager.availableChannels) { channels in // per-sheet global onChange added below
if let building = channels.first(where: { $0.level == .building }) {
if notesGeohash != building.geohash { notesGeohash = building.geohash }
}
}
} }
} }
.onAppear { .onAppear {
@@ -1281,6 +1277,18 @@ struct ContentView: View {
.onDisappear { .onDisappear {
LocationChannelManager.shared.endLiveRefresh() LocationChannelManager.shared.endLiveRefresh()
} }
.onChange(of: locationManager.availableChannels) { channels in
if let current = channels.first(where: { $0.level == .building })?.geohash,
notesGeohash != current {
notesGeohash = current
#if os(iOS)
// Light taptic when geohash changes while the sheet is open
let generator = UIImpactFeedbackGenerator(style: .light)
generator.prepare()
generator.impactOccurred()
#endif
}
}
} }
.onAppear { .onAppear {
updateNotesCounterSubscription() updateNotesCounterSubscription()