desktop: better autoscroll to bottom on new message (#2973)

This commit is contained in:
Stanislav Dmitrenko 2023-08-25 12:09:21 +03:00 committed by GitHub
parent 06369e277c
commit 7f894abbad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -880,7 +880,7 @@ private fun ScrollToBottom(chatId: ChatId, listState: LazyListState, chatItems:
.filter { listState.layoutInfo.visibleItemsInfo.firstOrNull()?.key != it }
.collect {
try {
if (listState.firstVisibleItemIndex == 0) {
if (listState.firstVisibleItemIndex == 0 || (listState.firstVisibleItemIndex == 1 && listState.layoutInfo.totalItemsCount == chatItems.size)) {
listState.animateScrollToItem(0)
} else {
listState.animateScrollBy(scrollDistance)