refactor: remove RadioInterfaceService from MainActivity

This commit is contained in:
andrekir 2023-05-24 06:43:58 -03:00
parent d01e8e8e74
commit 956db658e9
2 changed files with 7 additions and 7 deletions

View file

@ -29,6 +29,7 @@ import com.geeksville.mesh.LocalOnlyProtos.LocalModuleConfig
import com.geeksville.mesh.MeshProtos.User
import com.geeksville.mesh.database.PacketRepository
import com.geeksville.mesh.repository.datastore.RadioConfigRepository
import com.geeksville.mesh.repository.radio.RadioInterfaceService
import com.geeksville.mesh.service.MeshService
import com.geeksville.mesh.util.GPSFormat
import com.geeksville.mesh.util.positionToMeter
@ -86,6 +87,7 @@ fun getInitials(nameIn: String): String {
class UIViewModel @Inject constructor(
private val app: Application,
private val radioConfigRepository: RadioConfigRepository,
private val radioInterfaceService: RadioInterfaceService,
private val meshLogRepository: MeshLogRepository,
private val packetRepository: PacketRepository,
private val quickChatActionRepository: QuickChatActionRepository,
@ -96,6 +98,9 @@ class UIViewModel @Inject constructor(
var meshService: IMeshService? = null
val nodeDB = NodeDB(this)
val bondedAddress get() = radioInterfaceService.getBondedDeviceAddress()
val selectedBluetooth: Boolean get() = bondedAddress?.getOrNull(0) == 'x'
private val _meshLog = MutableStateFlow<List<MeshLog>>(emptyList())
val meshLog: StateFlow<List<MeshLog>> = _meshLog