mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
refactor: implement repository pattern for ConnectionState
This commit is contained in:
parent
179c176baf
commit
13c76f49ee
3 changed files with 7 additions and 67 deletions
|
|
@ -305,15 +305,9 @@ class UIViewModel @Inject constructor(
|
|||
context.getSharedPreferences("ui-prefs", Context.MODE_PRIVATE)
|
||||
}
|
||||
|
||||
/// Connection state to our radio device
|
||||
private val _connectionState = MutableLiveData(MeshService.ConnectionState.DISCONNECTED)
|
||||
val connectionState: LiveData<MeshService.ConnectionState> get() = _connectionState
|
||||
|
||||
fun isConnected() = _connectionState.value != MeshService.ConnectionState.DISCONNECTED
|
||||
|
||||
fun setConnectionState(connectionState: MeshService.ConnectionState) {
|
||||
_connectionState.value = connectionState
|
||||
}
|
||||
// Connection state to our radio device
|
||||
val connectionState get() = radioConfigRepository.connectionState.asLiveData()
|
||||
fun isConnected() = connectionState.value != MeshService.ConnectionState.DISCONNECTED
|
||||
|
||||
private val _requestChannelUrl = MutableLiveData<Uri?>(null)
|
||||
val requestChannelUrl: LiveData<Uri?> get() = _requestChannelUrl
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue