UI: show Bluetooth range next to #bluetooth in location sheet

This commit is contained in:
jack
2025-08-21 00:49:12 +02:00
parent 602e93d1b2
commit 68c61476d8
+13 -1
View File
@@ -93,7 +93,7 @@ struct LocationChannelsSheet: View {
private var channelList: some View { private var channelList: some View {
List { List {
// Mesh option first // Mesh option first
channelRow(title: meshTitleWithCount(), subtitle: "#bluetooth", isSelected: isMeshSelected, titleColor: standardBlue) { channelRow(title: meshTitleWithCount(), subtitle: "#bluetooth\(bluetoothRangeString())", isSelected: isMeshSelected, titleColor: standardBlue) {
manager.select(ChannelID.mesh) manager.select(ChannelID.mesh)
isPresented = false isPresented = false
} }
@@ -336,6 +336,18 @@ extension LocationChannelsSheet {
return String(format: "%.1f", value) return String(format: "%.1f", value)
} }
private func bluetoothRangeString() -> String {
let usesMetric: Bool = {
if #available(iOS 16.0, *) {
return Locale.current.measurementSystem == .metric
} else {
return Locale.current.usesMetricSystem
}
}()
// Approximate Bluetooth LE range for typical mobile devices; environment dependent
return usesMetric ? "~1050 m" : "~30160 ft"
}
private func locationName(for level: GeohashChannelLevel) -> String? { private func locationName(for level: GeohashChannelLevel) -> String? {
manager.locationNames[level] manager.locationNames[level]
} }