Skip to content

Commit 231b137

Browse files
committed
feat: sync view while node not running
1 parent 1d0326f commit 231b137

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

app/src/main/java/to/bitkit/ui/settings/LightningConnectionsScreen.kt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ import to.bitkit.ui.components.FillHeight
5656
import to.bitkit.ui.components.LightningChannel
5757
import to.bitkit.ui.components.PrimaryButton
5858
import to.bitkit.ui.components.SecondaryButton
59+
import to.bitkit.ui.components.SyncNodeView
5960
import to.bitkit.ui.components.TertiaryButton
6061
import to.bitkit.ui.components.Title
6162
import to.bitkit.ui.components.VerticalSpacer
@@ -139,6 +140,12 @@ private fun Content(
139140
}
140141
}
141142
)
143+
144+
if (!uiState.isNodeRunning) {
145+
SyncNodeView(modifier = Modifier.fillMaxSize())
146+
return@ScreenColumn
147+
}
148+
142149
PullToRefreshBox(
143150
isRefreshing = uiState.isRefreshing,
144151
onRefresh = onRefresh,
@@ -417,3 +424,17 @@ private fun Preview() {
417424
)
418425
}
419426
}
427+
428+
@Preview
429+
@Composable
430+
private fun PreviewNodeNotRunning() {
431+
AppThemeSurface {
432+
Content(
433+
uiState = LightningConnectionsUiState(
434+
localBalance = 0u,
435+
remoteBalance = 0u,
436+
isNodeRunning = false,
437+
)
438+
)
439+
}
440+
}

app/src/main/java/to/bitkit/ui/settings/LightningConnectionsViewModel.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ class LightningConnectionsViewModel @Inject constructor(
5050

5151
fun syncState() {
5252
viewModelScope.launch {
53-
// TODO handle node not running UI
5453
val isNodeRunning = lightningRepo.lightningState.value.nodeLifecycleState.isRunning()
5554

5655
val channels = lightningRepo.getChannels().orEmpty()

0 commit comments

Comments
 (0)