Commit 92d076ff authored by Ronan Abhamon's avatar Ronan Abhamon

fix(ui/modules/Linphone/Chat/Chat): use `Connections` component

parent 4a228d31
......@@ -52,6 +52,13 @@ Rectangle {
}
}
function _initView () {
_tryToLoadMoreEntries = false
_bindToEnd = true
positionViewAtEnd()
}
// -----------------------------------------------------------------------
Layout.fillHeight: true
......@@ -77,28 +84,12 @@ Rectangle {
}
goToEnd()
var initView = function () {
_tryToLoadMoreEntries = false
_bindToEnd = true
positionViewAtEnd()
}
// Received only if more entries were loaded.
proxyModel.moreEntriesLoaded.connect(function (n) {
positionViewAtIndex(n - 1, ListView.Beginning)
_tryToLoadMoreEntries = false
})
// When the view is changed (for example `Calls` -> `Messages`),
// the position is set at end and it can be possible to load
// more entries.
proxyModel.entryTypeFilterChanged.connect(initView)
// First render.
initView()
_initView()
}
// -----------------------------------------------------------------------
onMovementStarted: _bindToEnd = false
onMovementEnded: {
if (atYEnd) {
......@@ -108,6 +99,22 @@ Rectangle {
onContentYChanged: _loadMoreEntries()
// -----------------------------------------------------------------------
Connections {
target: proxyModel
// When the view is changed (for example `Calls` -> `Messages`),
// the position is set at end and it can be possible to load
// more entries.
onEntryTypeFilterChanged: _initView()
onMoreEntriesLoaded: {
chat.positionViewAtIndex(n - 1, ListView.Beginning)
chat._tryToLoadMoreEntries = false
}
}
// -----------------------------------------------------------------------
// Heading.
// -----------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment