mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 22:25:20 +00:00
UI: show Bluetooth range next to #bluetooth in location sheet
This commit is contained in:
@@ -93,7 +93,7 @@ struct LocationChannelsSheet: View {
|
||||
private var channelList: some View {
|
||||
List {
|
||||
// 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)
|
||||
isPresented = false
|
||||
}
|
||||
@@ -336,6 +336,18 @@ extension LocationChannelsSheet {
|
||||
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 ? "~10–50 m" : "~30–160 ft"
|
||||
}
|
||||
|
||||
private func locationName(for level: GeohashChannelLevel) -> String? {
|
||||
manager.locationNames[level]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user