mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
refactor: decouple NavGraph from ViewModel and NodeEntity
This commit is contained in:
parent
6678df78b0
commit
716a3f535f
5 changed files with 69 additions and 43 deletions
|
|
@ -68,6 +68,7 @@ import javax.inject.Inject
|
|||
* Data class that represents the current RadioConfig state.
|
||||
*/
|
||||
data class RadioConfigState(
|
||||
val isLocal: Boolean = false,
|
||||
val connected: Boolean = false,
|
||||
val route: String = "",
|
||||
val metadata: MeshProtos.DeviceMetadata = MeshProtos.DeviceMetadata.getDefaultInstance(),
|
||||
|
|
@ -121,6 +122,10 @@ class RadioConfigViewModel @Inject constructor(
|
|||
}
|
||||
}.launchIn(viewModelScope)
|
||||
|
||||
radioConfigRepository.myNodeInfo.onEach { ni ->
|
||||
_radioConfigState.update { it.copy(isLocal = destNum == null || destNum == ni?.myNodeNum) }
|
||||
}.launchIn(viewModelScope)
|
||||
|
||||
debug("RadioConfigViewModel created")
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue