mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
fix: move device list sorting to ViewModel
This commit is contained in:
parent
7e54ad950c
commit
417523967e
2 changed files with 2 additions and 8 deletions
|
|
@ -70,9 +70,7 @@ class BTScanModel @Inject constructor(
|
|||
}
|
||||
|
||||
// Include paired Bluetooth devices
|
||||
ble.bondedDevices.forEach {
|
||||
addDevice(BLEDeviceListEntry(it))
|
||||
}
|
||||
ble.bondedDevices.map(::BLEDeviceListEntry).sortedBy { it.name }.forEach(::addDevice)
|
||||
|
||||
// Include Network Service Discovery
|
||||
tcp.forEach { service ->
|
||||
|
|
|
|||
|
|
@ -365,11 +365,7 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
|||
if (devices == null) return
|
||||
|
||||
var hasShownOurDevice = false
|
||||
devices.values
|
||||
// Display the device list in alphabetical order while keeping the "None (Disabled)"
|
||||
// device (fullAddress == n) at the top
|
||||
.sortedBy { dle -> if (dle.fullAddress == "n") "0" else dle.name }
|
||||
.forEach { device ->
|
||||
devices.values.forEach { device ->
|
||||
if (device.fullAddress == scanModel.selectedNotNull) {
|
||||
hasShownOurDevice = true
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue