refactor: improve BluetoothState.bondedDevices updates

- add `BluetoothState` updates from `BluetoothDevice.ACTION_BOND_STATE_CHANGED` intents
- convert `bondedDevices` to List instead of nested Flow
This commit is contained in:
andrekir 2023-06-29 21:29:38 -03:00
parent cdea292169
commit b41d92be32
5 changed files with 27 additions and 30 deletions

View file

@ -50,10 +50,10 @@ class BTScanModel @Inject constructor(
init {
combine(
bluetoothRepository.state.value.bondedDevices,
bluetoothRepository.state,
usbRepository.serialDevicesWithDrivers
) { ble, usb ->
bleDevices.value = ble
bleDevices.value = ble.bondedDevices
usbDevices.value = usb
}.onEach { setupScan() }.launchIn(viewModelScope)