diff --git a/qml/components/MessageListViewItem.qml b/qml/components/MessageListViewItem.qml index 98a5c32..8de7e7c 100644 --- a/qml/components/MessageListViewItem.qml +++ b/qml/components/MessageListViewItem.qml @@ -147,9 +147,8 @@ ListItem { messageListItem.messageReactions = null; selectReactionBubble.visible = false; } else { - if (messageListItem.chatReactions) { - selectReactionBubble.visible = !selectReactionBubble.visible; - } + selectReactionBubble.visible = !selectReactionBubble.visible; + elementSelected(index); } } } @@ -181,6 +180,19 @@ ListItem { } } + Connections { + target: chatPage + onResetElements: { + messageListItem.messageReactions = null; + selectReactionBubble.visible = false; + } + onElementSelected: { + if (elementIndex !== index) { + selectReactionBubble.visible = false; + } + } + } + Loader { id: contextMenuLoader active: false @@ -285,6 +297,9 @@ ListItem { messageListItem.messageReactions = null; } } + onReactionsUpdated: { + chatReactions = tdLibWrapper.getChatReactions(page.chatInformation.id); + } } Timer { diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index 48d741b..c7b1a73 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -67,6 +67,8 @@ Page { property bool doSendBotStartMessage property string sendBotStartMessageParameter property var availableReactions + signal resetElements() + signal elementSelected(int elementIndex) states: [ State { @@ -480,7 +482,10 @@ Page { if (pageStack.depth === 1) { // Only clear chat model if navigated back to overview page. In other cases we keep the information... chatModel.clear(); + } else { + resetElements(); } + break; } } diff --git a/qml/pages/PollResultsPage.qml b/qml/pages/PollResultsPage.qml index 69dabb7..0368757 100644 --- a/qml/pages/PollResultsPage.qml +++ b/qml/pages/PollResultsPage.qml @@ -143,10 +143,11 @@ Page { Connections { target: tdLibWrapper - onUsersReceived: { + onMessageSendersReceived: { + Debug.log("Received poll users...") if(extra === optionDelegate.usersResponseIdentifierString) { - for(var i = 0; i < userIds.length; i += 1) { - optionDelegate.users.append({id: userIds[i], user:tdLibWrapper.getUserInformation(userIds[i])}); + for(var i = 0; i < senders.length; i += 1) { + optionDelegate.users.append({id: senders[i].user_id, user:tdLibWrapper.getUserInformation(senders[i].user_id)}); } loadUsersTimer.start(); } diff --git a/rpm/harbour-fernschreiber.spec b/rpm/harbour-fernschreiber.spec index e074a21..420a075 100644 --- a/rpm/harbour-fernschreiber.spec +++ b/rpm/harbour-fernschreiber.spec @@ -12,7 +12,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.17 -Release: 8 +Release: 10 Group: Qt/Qt License: LICENSE URL: http://werkwolf.eu/ diff --git a/rpm/harbour-fernschreiber.yaml b/rpm/harbour-fernschreiber.yaml index 05f2fd4..655a6ce 100644 --- a/rpm/harbour-fernschreiber.yaml +++ b/rpm/harbour-fernschreiber.yaml @@ -1,7 +1,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.17 -Release: 8 +Release: 10 # The contents of the Group field should be one of the groups listed here: # https://github.com/mer-tools/spectacle/blob/master/data/GROUPS Group: Qt/Qt diff --git a/src/tdlibreceiver.cpp b/src/tdlibreceiver.cpp index abd9d03..c93b549 100644 --- a/src/tdlibreceiver.cpp +++ b/src/tdlibreceiver.cpp @@ -160,6 +160,7 @@ TDLibReceiver::TDLibReceiver(void *tdLibClient, QObject *parent) : QThread(paren handlers.insert("updateChatPinnedMessage", &TDLibReceiver::processUpdateChatPinnedMessage); handlers.insert("updateMessageIsPinned", &TDLibReceiver::processUpdateMessageIsPinned); handlers.insert("users", &TDLibReceiver::processUsers); + handlers.insert("messageSenders", &TDLibReceiver::processMessageSenders); handlers.insert("error", &TDLibReceiver::processError); handlers.insert("ok", &TDLibReceiver::ok); handlers.insert("secretChat", &TDLibReceiver::processSecretChat); @@ -634,6 +635,12 @@ void TDLibReceiver::processUsers(const QVariantMap &receivedInformation) emit usersReceived(receivedInformation.value(_EXTRA).toString(), receivedInformation.value("user_ids").toList(), receivedInformation.value(TOTAL_COUNT).toInt()); } +void TDLibReceiver::processMessageSenders(const QVariantMap &receivedInformation) +{ + LOG("Received Message Senders"); + emit messageSendersReceived(receivedInformation.value(_EXTRA).toString(), receivedInformation.value("senders").toList(), receivedInformation.value(TOTAL_COUNT).toInt()); +} + void TDLibReceiver::processError(const QVariantMap &receivedInformation) { LOG("Received an error"); diff --git a/src/tdlibreceiver.h b/src/tdlibreceiver.h index bfb380e..dda2cd0 100644 --- a/src/tdlibreceiver.h +++ b/src/tdlibreceiver.h @@ -88,7 +88,8 @@ signals: void chatTitleUpdated(const QString &chatId, const QString &title); void chatPinnedMessageUpdated(qlonglong chatId, qlonglong pinnedMessageId); void messageIsPinnedUpdated(qlonglong chatId, qlonglong messageId, bool isPinned); - void usersReceived(const QString &extra, const QVariantList &userIds, int totalUsers); + void usersReceived(const QString &extra, const QVariantList &senders, int totalUsers); + void messageSendersReceived(const QString &extra, const QVariantList &userIds, int totalUsers); void errorReceived(const int code, const QString &message, const QString &extra); void secretChat(qlonglong secretChatId, const QVariantMap &secretChat); void secretChatUpdated(qlonglong secretChatId, const QVariantMap &secretChat); @@ -173,6 +174,7 @@ private: void processUpdateChatPinnedMessage(const QVariantMap &receivedInformation); void processUpdateMessageIsPinned(const QVariantMap &receivedInformation); void processUsers(const QVariantMap &receivedInformation); + void processMessageSenders(const QVariantMap &receivedInformation); void processError(const QVariantMap &receivedInformation); void processSecretChat(const QVariantMap &receivedInformation); void processUpdateSecretChat(const QVariantMap &receivedInformation); diff --git a/src/tdlibwrapper.cpp b/src/tdlibwrapper.cpp index 6b3e994..6abda99 100644 --- a/src/tdlibwrapper.cpp +++ b/src/tdlibwrapper.cpp @@ -176,6 +176,7 @@ void TDLibWrapper::initializeTDLibReceiver() { connect(this->tdLibReceiver, SIGNAL(chatPinnedMessageUpdated(qlonglong, qlonglong)), this, SIGNAL(chatPinnedMessageUpdated(qlonglong, qlonglong))); connect(this->tdLibReceiver, SIGNAL(messageIsPinnedUpdated(qlonglong, qlonglong, bool)), this, SLOT(handleMessageIsPinnedUpdated(qlonglong, qlonglong, bool))); connect(this->tdLibReceiver, SIGNAL(usersReceived(QString, QVariantList, int)), this, SIGNAL(usersReceived(QString, QVariantList, int))); + connect(this->tdLibReceiver, SIGNAL(messageSendersReceived(QString, QVariantList, int)), this, SIGNAL(messageSendersReceived(QString, QVariantList, int))); connect(this->tdLibReceiver, SIGNAL(errorReceived(int, QString, QString)), this, SLOT(handleErrorReceived(int, QString, QString))); connect(this->tdLibReceiver, SIGNAL(contactsImported(QVariantList, QVariantList)), this, SIGNAL(contactsImported(QVariantList, QVariantList))); connect(this->tdLibReceiver, SIGNAL(messageEditedUpdated(qlonglong, qlonglong, QVariantMap)), this, SIGNAL(messageEditedUpdated(qlonglong, qlonglong, QVariantMap))); diff --git a/src/tdlibwrapper.h b/src/tdlibwrapper.h index c4773e3..90ccf53 100644 --- a/src/tdlibwrapper.h +++ b/src/tdlibwrapper.h @@ -323,6 +323,7 @@ signals: void chatTitleUpdated(const QString &chatId, const QString &title); void chatPinnedMessageUpdated(qlonglong chatId, qlonglong pinnedMessageId); void usersReceived(const QString &extra, const QVariantList &userIds, int totalUsers); + void messageSendersReceived(const QString &extra, const QVariantList &senders, int totalUsers); void errorReceived(int code, const QString &message, const QString &extra); void contactsImported(const QVariantList &importerCount, const QVariantList &userIds); void messageNotFound(qlonglong chatId, qlonglong messageId);