Chat : Stay at end.

This commit is contained in:
Julien Wadel 2023-03-28 09:20:46 +02:00
parent 4a1cfe0c91
commit 39cb5db106
4 changed files with 7 additions and 18 deletions

View file

@ -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

View file

@ -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
// ---------------------------------------------------------------------------

View file

@ -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) {

View file

@ -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()
}
}