Skip to content

Commit

Permalink
Only one star per list, restore users in poll results
Browse files Browse the repository at this point in the history
  • Loading branch information
Wunderfitz committed Nov 29, 2023
1 parent 8258867 commit 80ecf50
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 9 deletions.
21 changes: 18 additions & 3 deletions qml/components/MessageListViewItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -285,6 +297,9 @@ ListItem {
messageListItem.messageReactions = null;
}
}
onReactionsUpdated: {
chatReactions = tdLibWrapper.getChatReactions(page.chatInformation.id);
}
}

Timer {
Expand Down
5 changes: 5 additions & 0 deletions qml/pages/ChatPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ Page {
property bool doSendBotStartMessage
property string sendBotStartMessageParameter
property var availableReactions
signal resetElements()
signal elementSelected(int elementIndex)

states: [
State {
Expand Down Expand Up @@ -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;
}
}
Expand Down
7 changes: 4 additions & 3 deletions qml/pages/PollResultsPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion rpm/harbour-fernschreiber.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
2 changes: 1 addition & 1 deletion rpm/harbour-fernschreiber.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 7 additions & 0 deletions src/tdlibreceiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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");
Expand Down
4 changes: 3 additions & 1 deletion src/tdlibreceiver.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ class TDLibReceiver : public QThread
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);
Expand Down Expand Up @@ -173,6 +174,7 @@ class TDLibReceiver : public QThread
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);
Expand Down
1 change: 1 addition & 0 deletions src/tdlibwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
Expand Down
1 change: 1 addition & 0 deletions src/tdlibwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ class TDLibWrapper : public QObject
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);
Expand Down

0 comments on commit 80ecf50

Please sign in to comment.