mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
refactor: move RadioInterfaceService out of Activity / Fragment
This commit is contained in:
parent
94507195a8
commit
3922bfbffb
6 changed files with 28 additions and 64 deletions
|
|
@ -47,6 +47,10 @@ class BTScanModel @Inject constructor(
|
|||
private val bleDevices = MutableLiveData<List<BluetoothDevice>>(listOf())
|
||||
private val usbDevices = MutableLiveData<Map<String, UsbSerialDriver>>(mapOf())
|
||||
|
||||
val isMockInterfaceAddressValid: Boolean by lazy {
|
||||
radioInterfaceService.isAddressValid(radioInterfaceService.mockInterfaceAddress)
|
||||
}
|
||||
|
||||
init {
|
||||
combine(
|
||||
bluetoothRepository.state,
|
||||
|
|
@ -180,7 +184,7 @@ class BTScanModel @Inject constructor(
|
|||
private fun setupScan(): Boolean {
|
||||
selectedAddress = radioInterfaceService.getDeviceAddress()
|
||||
|
||||
return if (radioInterfaceService.isAddressValid(radioInterfaceService.mockInterfaceAddress)) {
|
||||
return if (isMockInterfaceAddressValid) {
|
||||
warn("Running under emulator/test lab")
|
||||
|
||||
val testnodes = listOf(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue