From 98f067cda8d03df29cb7639410b95a651f805ce6 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Sun, 26 Nov 2023 20:36:30 +0100 Subject: [PATCH] Tweak reactions again... --- qml/components/MessageListViewItem.qml | 59 ++++++++++++++++++-------- qml/pages/ChatPage.qml | 4 ++ rpm/harbour-fernschreiber.spec | 2 +- rpm/harbour-fernschreiber.yaml | 4 +- 4 files changed, 49 insertions(+), 20 deletions(-) diff --git a/qml/components/MessageListViewItem.qml b/qml/components/MessageListViewItem.qml index 6065842..737a26d 100644 --- a/qml/components/MessageListViewItem.qml +++ b/qml/components/MessageListViewItem.qml @@ -132,22 +132,13 @@ ListItem { if (messageListItem.messageReactions) { 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: { if (openMenuOnPressAndHold) { 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 width: parent.width - ( 2 * Theme.horizontalPageMargin ) anchors.top: messageTextRow.bottom - anchors.topMargin: Theme.paddingSmall + anchors.topMargin: Theme.paddingMedium anchors.horizontalCenter: parent.horizontalCenter visible: messageListItem.messageReactions ? ( messageListItem.messageReactions.length > 0 ? true : false ) : false opacity: messageListItem.messageReactions ? ( messageListItem.messageReactions.length > 0 ? 1 : 0 ) : 0 @@ -675,7 +699,7 @@ ListItem { Flickable { width: parent.width - height: reactionsResultRow.height + Theme.paddingSmall + height: reactionsResultRow.height + 2 * Theme.paddingMedium anchors.horizontalCenter: parent.horizontalCenter contentWidth: reactionsResultRow.width clip: true @@ -691,13 +715,13 @@ ListItem { Row { id: singleReactionRow - spacing: Theme.paddingSmall + spacing: Theme.paddingMedium Image { id: emojiPicture source: Emoji.getEmojiPath(modelData) - width: status === Image.Ready ? Theme.fontSizeLarge : 0 - height: Theme.fontSizeLarge + width: status === Image.Ready ? Theme.fontSizeExtraLarge : 0 + height: Theme.fontSizeExtraLarge } } @@ -721,6 +745,7 @@ ListItem { // Reaction is not yet selected tdLibWrapper.addMessageReaction(chatId, messageId, modelData) messageReactions = null + selectReactionBubble.visible = false } } } diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index 23f0da0..c70e454 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -610,6 +610,8 @@ Page { chatViewCooldownTimer.restart(); chatViewStartupReadTimer.restart(); + /* + // Double-tap for reactions is currently disabled, let's see if we'll ever need it again var remainingDoubleTapHints = appSettings.remainingDoubleTapHints; Debug.log("Remaining double tap hints: " + remainingDoubleTapHints); if (remainingDoubleTapHints > 0) { @@ -618,6 +620,8 @@ Page { tapHintLabel.visible = true; appSettings.remainingDoubleTapHints = remainingDoubleTapHints - 1; } + */ + } onNewMessageReceived: { if (( chatView.manuallyScrolledToBottom && Qt.application.state === Qt.ApplicationActive ) || message.sender_id.user_id === chatPage.myUserId) { diff --git a/rpm/harbour-fernschreiber.spec b/rpm/harbour-fernschreiber.spec index 6d8bef5..e114f17 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: 6 +Release: 7 Group: Qt/Qt License: LICENSE URL: http://werkwolf.eu/ diff --git a/rpm/harbour-fernschreiber.yaml b/rpm/harbour-fernschreiber.yaml index 04890d5..4f49d27 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: 6 +Release: 7 # 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 @@ -46,7 +46,7 @@ Requires: # All installed files Files: - - '%{_bindir}/*' + - '%{_bindir}/%{name}' - '%{_datadir}/%{name}' - '%{_datadir}/applications/%{name}.desktop' - '%{_datadir}/icons/hicolor/*/apps/%{name}.png'