Tweak reactions again...

This commit is contained in:
Sebastian Wolf 2023-11-26 20:36:30 +01:00
parent 57017e8bff
commit 98f067cda8
No known key found for this signature in database
GPG key ID: CEA9522B5F38A90A
4 changed files with 49 additions and 20 deletions

View file

@ -132,22 +132,13 @@ ListItem {
if (messageListItem.messageReactions) { if (messageListItem.messageReactions) {
messageListItem.messageReactions = null; messageListItem.messageReactions = null;
selectReactionBubble.visible = false;
} else {
selectReactionBubble.visible = !selectReactionBubble.visible;
} }
} }
} }
onDoubleClicked: {
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);
}
}
onPressAndHold: { onPressAndHold: {
if (openMenuOnPressAndHold) { if (openMenuOnPressAndHold) {
openContextMenu() openContextMenu()
@ -658,6 +649,39 @@ ListItem {
} }
Rectangle {
id: selectReactionBubble
visible: false
anchors {
horizontalCenter: messageListItem.isOwnMessage ? messageBackground.left : messageBackground.right
verticalCenter: messageBackground.verticalCenter
}
height: Theme.itemSizeExtraSmall
width: Theme.itemSizeExtraSmall
color: Theme.primaryColor
radius: parent.width / 2
opacity: 0.5
}
IconButton {
id: selectReactionButton
visible: selectReactionBubble.visible
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;
}
}
} }
} }
@ -666,7 +690,7 @@ ListItem {
id: reactionsColumn id: reactionsColumn
width: parent.width - ( 2 * Theme.horizontalPageMargin ) width: parent.width - ( 2 * Theme.horizontalPageMargin )
anchors.top: messageTextRow.bottom anchors.top: messageTextRow.bottom
anchors.topMargin: Theme.paddingSmall anchors.topMargin: Theme.paddingMedium
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
visible: messageListItem.messageReactions ? ( messageListItem.messageReactions.length > 0 ? true : false ) : false visible: messageListItem.messageReactions ? ( messageListItem.messageReactions.length > 0 ? true : false ) : false
opacity: messageListItem.messageReactions ? ( messageListItem.messageReactions.length > 0 ? 1 : 0 ) : 0 opacity: messageListItem.messageReactions ? ( messageListItem.messageReactions.length > 0 ? 1 : 0 ) : 0
@ -675,7 +699,7 @@ ListItem {
Flickable { Flickable {
width: parent.width width: parent.width
height: reactionsResultRow.height + Theme.paddingSmall height: reactionsResultRow.height + 2 * Theme.paddingMedium
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
contentWidth: reactionsResultRow.width contentWidth: reactionsResultRow.width
clip: true clip: true
@ -691,13 +715,13 @@ ListItem {
Row { Row {
id: singleReactionRow id: singleReactionRow
spacing: Theme.paddingSmall spacing: Theme.paddingMedium
Image { Image {
id: emojiPicture id: emojiPicture
source: Emoji.getEmojiPath(modelData) source: Emoji.getEmojiPath(modelData)
width: status === Image.Ready ? Theme.fontSizeLarge : 0 width: status === Image.Ready ? Theme.fontSizeExtraLarge : 0
height: Theme.fontSizeLarge height: Theme.fontSizeExtraLarge
} }
} }
@ -721,6 +745,7 @@ ListItem {
// Reaction is not yet selected // Reaction is not yet selected
tdLibWrapper.addMessageReaction(chatId, messageId, modelData) tdLibWrapper.addMessageReaction(chatId, messageId, modelData)
messageReactions = null messageReactions = null
selectReactionBubble.visible = false
} }
} }
} }

View file

@ -610,6 +610,8 @@ Page {
chatViewCooldownTimer.restart(); chatViewCooldownTimer.restart();
chatViewStartupReadTimer.restart(); chatViewStartupReadTimer.restart();
/*
// Double-tap for reactions is currently disabled, let's see if we'll ever need it again
var remainingDoubleTapHints = appSettings.remainingDoubleTapHints; var remainingDoubleTapHints = appSettings.remainingDoubleTapHints;
Debug.log("Remaining double tap hints: " + remainingDoubleTapHints); Debug.log("Remaining double tap hints: " + remainingDoubleTapHints);
if (remainingDoubleTapHints > 0) { if (remainingDoubleTapHints > 0) {
@ -618,6 +620,8 @@ Page {
tapHintLabel.visible = true; tapHintLabel.visible = true;
appSettings.remainingDoubleTapHints = remainingDoubleTapHints - 1; appSettings.remainingDoubleTapHints = remainingDoubleTapHints - 1;
} }
*/
} }
onNewMessageReceived: { onNewMessageReceived: {
if (( chatView.manuallyScrolledToBottom && Qt.application.state === Qt.ApplicationActive ) || message.sender_id.user_id === chatPage.myUserId) { if (( chatView.manuallyScrolledToBottom && Qt.application.state === Qt.ApplicationActive ) || message.sender_id.user_id === chatPage.myUserId) {

View file

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

View file

@ -1,7 +1,7 @@
Name: harbour-fernschreiber Name: harbour-fernschreiber
Summary: Fernschreiber is a Telegram client for Sailfish OS Summary: Fernschreiber is a Telegram client for Sailfish OS
Version: 0.17 Version: 0.17
Release: 6 Release: 7
# The contents of the Group field should be one of the groups listed here: # The contents of the Group field should be one of the groups listed here:
# https://github.com/mer-tools/spectacle/blob/master/data/GROUPS # https://github.com/mer-tools/spectacle/blob/master/data/GROUPS
Group: Qt/Qt Group: Qt/Qt
@ -46,7 +46,7 @@ Requires:
# All installed files # All installed files
Files: Files:
- '%{_bindir}/*' - '%{_bindir}/%{name}'
- '%{_datadir}/%{name}' - '%{_datadir}/%{name}'
- '%{_datadir}/applications/%{name}.desktop' - '%{_datadir}/applications/%{name}.desktop'
- '%{_datadir}/icons/hicolor/*/apps/%{name}.png' - '%{_datadir}/icons/hicolor/*/apps/%{name}.png'