mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-13 09:37:29 +01:00
Message List: Focus bot message when updated inline keyboard
This commit is contained in:
parent
0625edb308
commit
53ec3098b8
@ -37,6 +37,7 @@ import {
|
||||
selectViewportIds,
|
||||
selectFirstUnreadId,
|
||||
selectChat,
|
||||
selectIsChatWithBot,
|
||||
} from '../../selectors';
|
||||
import { getMessageContent, isChatPrivate, isMessageLocal } from '../../helpers';
|
||||
|
||||
@ -136,6 +137,20 @@ addReducer('apiUpdate', (global, actions, update: ApiUpdate) => {
|
||||
|
||||
setGlobal(global);
|
||||
|
||||
// Scroll down if bot message height is changed with an updated inline keyboard.
|
||||
// A drawback: this will scroll down even if the previous scroll was not at bottom.
|
||||
const chat = selectChat(global, chatId);
|
||||
if (
|
||||
chat
|
||||
&& !message.isOutgoing
|
||||
&& chat.lastMessage?.id === message.id
|
||||
&& selectIsChatWithBot(global, chat)
|
||||
&& isMessageInCurrentMessageList(global, chatId, message as ApiMessage)
|
||||
&& selectIsViewportNewest(global, chatId, message.threadInfo?.threadId || MAIN_THREAD_ID)
|
||||
) {
|
||||
actions.focusLastMessage();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user