Scroll timeline to the top when synchronization is over

This commit is contained in:
Shinokuni 2024-05-12 22:09:27 +02:00
parent 19409f20a5
commit ffe2d5cffb
2 changed files with 11 additions and 2 deletions

View File

@ -322,7 +322,9 @@ class TimelineScreenModel(
}
}
fun resetEndSynchronizing() {
_timelineState.update { it.copy(endSynchronizing = false) }
}
}
@Stable

View File

@ -102,6 +102,13 @@ object TimelineTab : Tab {
}
}
LaunchedEffect(state.endSynchronizing) {
if (state.endSynchronizing) {
lazyListState.animateScrollToItem(0)
viewModel.resetEndSynchronizing()
}
}
val drawerState = rememberDrawerState(
initialValue = DrawerValue.Closed,
confirmStateChange = {
@ -147,7 +154,7 @@ object TimelineTab : Tab {
}
}
}
LaunchedEffect(state.syncError) {
if (state.syncError != null) {
snackbarHostState.showSnackbar(ErrorMessage.get(state.syncError!!, context))