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;
}
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: {
if (messageListItem.precalculatedValues.pageIsSelecting) {
page.toggleMessageSelection(myMessage);
@ -134,11 +147,17 @@ ListItem {
messageListItem.messageReactions = null;
selectReactionBubble.visible = false;
} else {
selectReactionBubble.visible = !selectReactionBubble.visible;
if (messageListItem.chatReactions) {
selectReactionBubble.visible = !selectReactionBubble.visible;
}
}
}
}
onDoubleClicked: {
openReactions();
}
onPressAndHold: {
if (openMenuOnPressAndHold) {
openContextMenu()
@ -643,6 +662,17 @@ ListItem {
textFormat: Text.StyledText
maximumLineCount: 1
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"
anchors.centerIn: selectReactionBubble
onClicked: {
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;
openReactions();
}
}

View file

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

View file

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

View file

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

View file

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