mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
feat(connections): Connecting state refactor (#3722)
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
parent
12ccb34553
commit
73d933fe14
22 changed files with 379 additions and 263 deletions
|
|
@ -17,17 +17,18 @@
|
|||
|
||||
package com.geeksville.mesh.service
|
||||
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
import org.meshtastic.core.service.ConnectionState
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Singleton
|
||||
class MeshServiceConnectionStateHolder @Inject constructor() {
|
||||
private var connectionState = ConnectionState.DISCONNECTED
|
||||
private val _connectionState = MutableStateFlow<ConnectionState>(ConnectionState.Disconnected)
|
||||
val connectionState = _connectionState.asStateFlow()
|
||||
|
||||
fun setState(state: ConnectionState) {
|
||||
connectionState = state
|
||||
_connectionState.value = state
|
||||
}
|
||||
|
||||
fun getState() = connectionState
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue