More tweaks for reactions

This commit is contained in:
Sebastian Wolf 2023-11-26 23:36:29 +01:00 committed by Denis Fedoseev
parent 1c9fcac9cd
commit ec972d7edc
5 changed files with 38 additions and 12 deletions

View file

@ -115,6 +115,19 @@ ListItem {
return interactionText; return interactionText;
} }
function openReactions() {
if (messageListItem.chatReactions) {
Debug.log("Using chat reactions")
messageListItem.messageReactions = chatReactions
showItemCompletelyTimer.requestedIndex = index;
showItemCompletelyTimer.start();
} else {
Debug.log("Obtaining message reactions")
tdLibWrapper.getMessageAvailableReactions(messageListItem.chatId, messageListItem.messageId);
}
selectReactionBubble.visible = false;
}
onClicked: { onClicked: {
if (messageListItem.precalculatedValues.pageIsSelecting) { if (messageListItem.precalculatedValues.pageIsSelecting) {
page.toggleMessageSelection(myMessage); page.toggleMessageSelection(myMessage);
@ -134,11 +147,17 @@ ListItem {
messageListItem.messageReactions = null; messageListItem.messageReactions = null;
selectReactionBubble.visible = false; selectReactionBubble.visible = false;
} else { } else {
selectReactionBubble.visible = !selectReactionBubble.visible; if (messageListItem.chatReactions) {
selectReactionBubble.visible = !selectReactionBubble.visible;
}
} }
} }
} }
onDoubleClicked: {
openReactions();
}
onPressAndHold: { onPressAndHold: {
if (openMenuOnPressAndHold) { if (openMenuOnPressAndHold) {
openContextMenu() openContextMenu()
@ -643,6 +662,17 @@ ListItem {
textFormat: Text.StyledText textFormat: Text.StyledText
maximumLineCount: 1 maximumLineCount: 1
elide: Text.ElideRight elide: Text.ElideRight
MouseArea {
anchors.fill: parent
onClicked: {
if (messageListItem.messageReactions) {
messageListItem.messageReactions = null;
selectReactionBubble.visible = false;
} else {
openReactions();
}
}
}
} }
} }
} }
@ -672,16 +702,7 @@ ListItem {
icon.source: "image://theme/icon-s-favorite" icon.source: "image://theme/icon-s-favorite"
anchors.centerIn: selectReactionBubble anchors.centerIn: selectReactionBubble
onClicked: { onClicked: {
if (messageListItem.chatReactions) { openReactions();
Debug.log("Using chat reactions")
messageListItem.messageReactions = chatReactions
showItemCompletelyTimer.requestedIndex = index;
showItemCompletelyTimer.start();
} else {
Debug.log("Obtaining message reactions")
tdLibWrapper.getMessageAvailableReactions(messageListItem.chatId, messageListItem.messageId);
}
selectReactionBubble.visible = false;
} }
} }

View file

@ -576,6 +576,9 @@ Page {
onSponsoredMessageReceived: { onSponsoredMessageReceived: {
chatPage.containsSponsoredMessages = true; chatPage.containsSponsoredMessages = true;
} }
onReactionsUpdated: {
availableReactions = tdLibWrapper.getChatReactions(chatInformation.id);
}
} }
Connections { Connections {

View file

@ -12,7 +12,7 @@ Name: harbour-fernschreiber
Summary: Fernschreiber is a Telegram client for Aurora OS Summary: Fernschreiber is a Telegram client for Aurora OS
Version: 0.17 Version: 0.17
Release: 7 Release: 8
Group: Qt/Qt Group: Qt/Qt
License: LICENSE License: LICENSE
URL: http://werkwolf.eu/ URL: http://werkwolf.eu/

View file

@ -2093,6 +2093,7 @@ void TDLibWrapper::handleActiveEmojiReactionsUpdated(const QStringList& emojis)
if (activeEmojiReactions != emojis) { if (activeEmojiReactions != emojis) {
activeEmojiReactions = emojis; activeEmojiReactions = emojis;
LOG(emojis.count() << "reaction(s) available"); LOG(emojis.count() << "reaction(s) available");
emit reactionsUpdated();
} }
} }

View file

@ -339,6 +339,7 @@ signals:
void chatUnreadMentionCountUpdated(qlonglong chatId, int unreadMentionCount); void chatUnreadMentionCountUpdated(qlonglong chatId, int unreadMentionCount);
void chatUnreadReactionCountUpdated(qlonglong chatId, int unreadReactionCount); void chatUnreadReactionCountUpdated(qlonglong chatId, int unreadReactionCount);
void tgUrlFound(const QString &tgUrl); void tgUrlFound(const QString &tgUrl);
void reactionsUpdated();
public slots: public slots:
void handleVersionDetected(const QString &version); void handleVersionDetected(const QString &version);