From 39cb5db1061bd30ba0aceaa92bfd93ed9af51187 Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Tue, 28 Mar 2023 09:20:46 +0200 Subject: [PATCH] Chat : Stay at end. --- CHANGELOG.md | 3 +++ .../modules/Common/View/ScrollableListView.qml | 4 +++- linphone-app/ui/modules/Linphone/Chat/Chat.js | 2 +- linphone-app/ui/modules/Linphone/Chat/Chat.qml | 16 ---------------- 4 files changed, 7 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index af6032879..0a5025753 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## 5.1.0 - undefined + + ### Added - VFS Encryption - File viewer in chats (Image/Animated Image/Video/Texts) with the option to export the file. @@ -15,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Fixed - Fix using only username in URI handlers. +- Chat flickering on load. ## 5.0.14 - 2023-03-16 diff --git a/linphone-app/ui/modules/Common/View/ScrollableListView.qml b/linphone-app/ui/modules/Common/View/ScrollableListView.qml index 9e5b8d7bc..cbdabd5ba 100644 --- a/linphone-app/ui/modules/Common/View/ScrollableListView.qml +++ b/linphone-app/ui/modules/Common/View/ScrollableListView.qml @@ -12,6 +12,7 @@ ListView { property alias horizontalScrollPolicy : hScrollBar.policy property bool fitCacheToContent: true + property bool bindToEnd: false function getVisibleIndex(checkMax) { var center_x = view.x + view.width / 2 @@ -59,10 +60,11 @@ ListView { contentHeight: height - (hScrollBar.visible?hScrollBar.height:0) spacing: 0 synchronousDrag: true - + onBindToEndChanged: if(bindToEnd) positionViewAtEnd() onContentHeightChanged: { if(fitCacheToContent) cacheBuffer= (view.contentHeight > 0 ? view.contentHeight : 0) + if(bindToEnd) positionViewAtEnd() } cacheBuffer: height > 0 ? height : 0 // --------------------------------------------------------------------------- diff --git a/linphone-app/ui/modules/Linphone/Chat/Chat.js b/linphone-app/ui/modules/Linphone/Chat/Chat.js index 9a9daef2b..d151c1289 100644 --- a/linphone-app/ui/modules/Linphone/Chat/Chat.js +++ b/linphone-app/ui/modules/Linphone/Chat/Chat.js @@ -30,11 +30,11 @@ function initView () { chat.bindToEnd = true - chat.positionViewAtEnd() if(chat.atYBeginning && !chat.loadingEntries){//Check if we are at beginning chat.displaying = true container.proxyModel.loadMoreEntriesAsync() } + chat.positionViewAtEnd() } function getComponentFromEntry (chatEntry) { diff --git a/linphone-app/ui/modules/Linphone/Chat/Chat.qml b/linphone-app/ui/modules/Linphone/Chat/Chat.qml index 1726da736..cc82c198d 100644 --- a/linphone-app/ui/modules/Linphone/Chat/Chat.qml +++ b/linphone-app/ui/modules/Linphone/Chat/Chat.qml @@ -57,7 +57,6 @@ Rectangle { ScrollableListView { id: chat // ----------------------------------------------------------------------- - property bool bindToEnd: false property bool displaying: false property bool loadingEntries: (container.proxyModel.chatRoomModel && container.proxyModel.chatRoomModel.entriesLoading) || displaying property bool tryToLoadMoreEntries: loadingEntries || remainingLoadersCount>0 @@ -462,20 +461,5 @@ Rectangle { }// ColumnLayout }// Bottom background } - - - - // --------------------------------------------------------------------------- - // Scroll at end if necessary. - // --------------------------------------------------------------------------- - - Timer { - interval: 100 - repeat: true - running: true - - onTriggered: chat.bindToEnd && chat.positionViewAtEnd() - } - }