refactor: convert connectionState to StateFlow

This commit is contained in:
andrekir 2024-11-12 09:08:08 -03:00
parent a980441fd1
commit cfdb245da2
8 changed files with 25 additions and 42 deletions

View file

@ -14,7 +14,6 @@ import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.livedata.observeAsState
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.ComposeView
import androidx.compose.ui.platform.ViewCompositionStrategy
@ -96,7 +95,7 @@ fun NodesScreen(
}
val currentTimeMillis = rememberTimeTickWithLifecycle()
val connectionState by model.connectionState.observeAsState()
val connectionState by model.connectionState.collectAsStateWithLifecycle()
LazyColumn(
state = listState,
@ -140,7 +139,7 @@ fun NodesScreen(
blinking = node == focusedNode,
expanded = state.showDetails,
currentTimeMillis = currentTimeMillis,
connectionState = connectionState,
isConnected = connectionState.isConnected(),
)
}
}