Try it again with loading more messages automatically
This commit is contained in:
parent
5c16a13b25
commit
5fcca3c405
2 changed files with 10 additions and 5 deletions
|
@ -249,7 +249,7 @@ Page {
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id: chatViewLoadingTimer
|
id: chatViewLoadingTimer
|
||||||
interval: 500
|
interval: 100
|
||||||
repeat: false
|
repeat: false
|
||||||
running: false
|
running: false
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
|
@ -269,13 +269,18 @@ Page {
|
||||||
highlightFollowsCurrentItem: true
|
highlightFollowsCurrentItem: true
|
||||||
|
|
||||||
function handleScrollPositionChanged() {
|
function handleScrollPositionChanged() {
|
||||||
|
console.log("Current position: " + chatView.contentY);
|
||||||
tdLibWrapper.viewMessage(chatInformation.id, chatView.itemAt(chatView.contentX, ( chatView.contentY + chatView.height - Theme.horizontalPageMargin )).myMessage.id);
|
tdLibWrapper.viewMessage(chatInformation.id, chatView.itemAt(chatView.contentX, ( chatView.contentY + chatView.height - Theme.horizontalPageMargin )).myMessage.id);
|
||||||
// if (chatView.indexAt(chatView.contentX, chatView.contentY) < 10) {
|
var indexAtCursor = chatView.indexAt(chatView.contentX, chatView.contentY);
|
||||||
// chatModel.triggerLoadMoreHistory();
|
// If the list is at the top or close to the top, the index jumps to the top of the new list
|
||||||
// }
|
// Before we find a solution, we don't reload at the top... TODO ;)
|
||||||
|
if (indexAtCursor > 5 && indexAtCursor < 25) {
|
||||||
|
chatModel.triggerLoadMoreHistory();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onContentYChanged: {
|
onContentYChanged: {
|
||||||
|
chatViewLoadingTimer.stop();
|
||||||
chatViewLoadingTimer.start();
|
chatViewLoadingTimer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ void TDLibReceiver::receiverLoop()
|
||||||
const char *result = td_json_client_receive(this->tdLibClient, WAIT_TIMEOUT);
|
const char *result = td_json_client_receive(this->tdLibClient, WAIT_TIMEOUT);
|
||||||
if (result) {
|
if (result) {
|
||||||
QJsonDocument receivedJsonDocument = QJsonDocument::fromJson(QByteArray(result));
|
QJsonDocument receivedJsonDocument = QJsonDocument::fromJson(QByteArray(result));
|
||||||
// qDebug().noquote() << "[TDLibReceiver] Raw result: " << receivedJsonDocument.toJson(QJsonDocument::Indented);
|
qDebug().noquote() << "[TDLibReceiver] Raw result: " << receivedJsonDocument.toJson(QJsonDocument::Indented);
|
||||||
processReceivedDocument(receivedJsonDocument);
|
processReceivedDocument(receivedJsonDocument);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue