Auto-scroll to message if user sent it

This commit is contained in:
Sebastian J. Wolf 2020-09-22 20:32:35 +02:00
parent fcfd839585
commit fcc46fbc94
6 changed files with 8 additions and 7 deletions

View file

@ -52,6 +52,7 @@ SAILFISHAPP_ICONS = 86x86 108x108 128x128 172x172 256x256
TRANSLATIONS += translations/harbour-fernschreiber-de.ts \ TRANSLATIONS += translations/harbour-fernschreiber-de.ts \
translations/harbour-fernschreiber-es.ts \ translations/harbour-fernschreiber-es.ts \
translations/harbour-fernschreiber-pl.ts \
translations/harbour-fernschreiber-zh_CN.ts translations/harbour-fernschreiber-zh_CN.ts
LIBS += -L$$PWD/tdlib/lib/ -ltdjson LIBS += -L$$PWD/tdlib/lib/ -ltdjson

View file

@ -137,9 +137,6 @@ Item {
asynchronous: true asynchronous: true
width: parent.width width: parent.width
sourceComponent: profileImageComponent sourceComponent: profileImageComponent
onLoaded: {
console.log(profileThumbnail.photoData.local.path);
}
} }
Item { Item {

View file

@ -201,7 +201,10 @@ Page {
} }
} }
onNewMessageReceived: { onNewMessageReceived: {
// Notify user about new messages... if (message.sender_user_id === chatPage.myUserId) {
console.log("[ChatPage] Own message received, scrolling down to see it...");
chatView.scrollToBottom();
}
} }
onUnreadCountUpdated: { onUnreadCountUpdated: {
console.log("[ChatPage] Unread count updated, new count: " + unreadCount); console.log("[ChatPage] Unread count updated, new count: " + unreadCount);

View file

@ -175,7 +175,7 @@ void ChatModel::handleNewMessageReceived(const QString &chatId, const QVariantMa
this->insertMessages(); this->insertMessages();
this->messagesMutex.unlock(); this->messagesMutex.unlock();
emit newMessageReceived(); emit newMessageReceived(message);
} }
} }

View file

@ -44,7 +44,7 @@ public:
signals: signals:
void messagesReceived(const int &modelIndex, const int &lastReadSentIndex); void messagesReceived(const int &modelIndex, const int &lastReadSentIndex);
void messagesIncrementalUpdate(const int &modelIndex, const int &lastReadSentIndex); void messagesIncrementalUpdate(const int &modelIndex, const int &lastReadSentIndex);
void newMessageReceived(); void newMessageReceived(const QVariantMap &message);
void unreadCountUpdated(const int &unreadCount, const QString &lastReadInboxMessageId); void unreadCountUpdated(const int &unreadCount, const QString &lastReadInboxMessageId);
void lastReadSentMessageUpdated(const int &lastReadSentIndex); void lastReadSentMessageUpdated(const int &lastReadSentIndex);
void notificationSettingsUpdated(); void notificationSettingsUpdated();

View file

@ -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));
// Too much information... qDebug().noquote() << "[TDLibReceiver] Raw result: " << receivedJsonDocument.toJson(QJsonDocument::Indented); qDebug().noquote() << "[TDLibReceiver] Raw result: " << receivedJsonDocument.toJson(QJsonDocument::Indented);
processReceivedDocument(receivedJsonDocument); processReceivedDocument(receivedJsonDocument);
} }
} }