Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ jobs:
run: |
sudo apt-get install -y -q qml6-module-qtquick-controls qml6-module-qtquick-templates
python3 scripts/test-composer-emoji-ui.py
- name: Searchable reaction picker (synthetic QtTest)
run: |
sudo apt-get install -y -q qml6-module-qtquick-controls qml6-module-qtquick-templates
python3 scripts/test-reaction-ui.py
- name: OTP desktop adapter (no desktop needed)
run: |
python3 -m py_compile otp-desktop.py
Expand Down Expand Up @@ -60,7 +64,9 @@ jobs:
- name: read pushes address groups and restore focus (no macOS needed)
run: python3 bridge/mac/test_read.py
- name: tapbacks are verified by chat.db, pressed once and never mid-scroll (no macOS needed)
run: python3 bridge/mac/test_react.py
run: |
python3 bridge/mac/test_react.py
python3 bridge/mac/test_reaction_kind.py
- name: hide Spam / unknown senders (no macOS needed)
run: python3 bridge/mac/test_filtered.py
- name: contact review across sources (no macOS needed)
Expand Down
5 changes: 4 additions & 1 deletion BarWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,15 @@ BarWidget {
property var tapbackFailures: ({})
/** Every exit: (chat, ok). A view on that chat settles its pending pill. */
signal tapbackExited(string chat, bool ok)
function runTapback(chat, argv) {
function runTapback(chat, argv, body) {
if (reactProc.running) return false
root.tapbackChat = String(chat)
reactProc.lastErr = ""
reactProc.command = argv
reactProc.stdinEnabled = true
reactProc.running = true
if (body) reactProc.write(body)
reactProc.stdinEnabled = false
return true
}
function tapbackFailed(chat, text) {
Expand Down
7 changes: 4 additions & 3 deletions BlipView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -4395,13 +4395,14 @@ FocusScope {
if (root.tapbacksBusy || !root.tapbacksOn || !hostWidget || !TapbackActions.canTapback(message, root.activeIsGroup)) return
var chat = String(root.active.chat)
var current = TapbackActions.myTapback(message)
var argv = SourceId.bridgeArgv(chat, "imsg-react", hostWidget.binDir)
.concat(TapbackActions.tapbackArgs(String(message.guid), kind, current))
var request = TapbackActions.tapbackRequest(String(message.guid), kind, current)
if (!request) { root.note = "That reaction is not supported"; return }
var argv = SourceId.bridgeArgv(chat, "imsg-react", hostWidget.binDir).concat(request.args)
// the dimmed pill says it is on its way; an earlier failure is old news
if (root.note.indexOf("tapback: ") === 0) root.note = ""
hostWidget.takeTapbackFailure(chat)
root.pendingTapback = TapbackActions.pendingTapback(chat, String(message.guid), kind, current)
if (!hostWidget.runTapback(chat, argv)) root.pendingTapback = null
if (!hostWidget.runTapback(chat, argv, request.stdin)) root.pendingTapback = null
}
function openEmojiPicker() {
if (emojiPopup.visible) { emojiPopup.close(); return }
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Changelog

Picker reactions require macOS 27.2 or newer; 27.0/27.1 refuse before opening Messages. Missing event-posting permission refuses custom emoji before opening a picker.

## Unreleased

- **Stickers render as stickers (#162, Marcus Vorwaller).** A sticker used to be an empty bubble or a made-up star
Expand Down
83 changes: 13 additions & 70 deletions MessageMenu.qml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import QtQuick.Controls
// before. An attachment (picture or file chip) gets Open / Copy image / Save…
// in place of the text rows; which rows show comes from
// MessageActions.attachmentActions. With
// tapbacks=on, a row of the six classic tapbacks leads it: 1–6 pick one, or
// Left/Right move along the row and Enter/Space pick the marked one.
// tapbacks=on, classic tapbacks and the expandable emoji picker lead it:
// 1–6 pick a classic, or Left/Right and Enter/Space choose from the strip.
Menu {
id: menu
implicitWidth: 250
implicitWidth: 314
padding: 6
background: Rectangle {
color: menu.palette.window
border.color: Qt.alpha(menu.palette.windowText, 0.25)
radius: 7
radius: 14
}
property string linkUrl: ""
/** The right-clicked attachment's rows ({open, copy, save, saveLabel}); null = none. */
Expand Down Expand Up @@ -51,81 +51,24 @@ Menu {
// is the menu's first item: Down leaves it, Up from "Quote and reply" comes
// back. Menu gives focus only to a MenuItem it moves to, so the row takes it.
onOpened: {
tapbackStrip.cursor = TapbackActions.initialTapbackCursor(menu.myTapback, menu.keyHints)
tapbackStrip.reset(menu.keyHints)
if (menu.tapbacksShown) menu.currentIndex = 0
}
onCurrentIndexChanged: if (menu.currentIndex === 0 && menu.tapbacksShown) tapbackStrip.forceActiveFocus()

Item {
ReactionPicker {
id: tapbackStrip
visible: menu.tapbacksShown
focus: menu.tapbacksShown
// what Menu's Up/Down look for; without it Up stops at the first MenuItem
activeFocusOnTab: menu.tapbacksShown
/** The marked tapback, for Left/Right and Enter; -1 for none. */
property int cursor: -1
// Up/Down, Esc, and Enter with nothing marked are left unaccepted: they stay the menu's
Keys.onPressed: function(event) {
if (event.modifiers & (Qt.ControlModifier | Qt.AltModifier | Qt.MetaModifier)) return
if (event.key === Qt.Key_Left || event.key === Qt.Key_Right) {
event.accepted = true
tapbackStrip.cursor = TapbackActions.moveTapbackCursor(tapbackStrip.cursor, event.key === Qt.Key_Right ? 1 : -1)
return
}
var marked = tapbackStrip.cursor >= 0 && (event.key === Qt.Key_Return || event.key === Qt.Key_Enter || event.key === Qt.Key_Space)
var kind = marked ? TapbackActions.TAPBACKS[tapbackStrip.cursor].kind : TapbackActions.tapbackForKey(event.text)
if (kind === "") return
event.accepted = true
menu.pickTapback(kind)
}
width: menu.availableWidth
height: visible ? tapbackRow.implicitHeight + 4 : 0
Row {
id: tapbackRow
anchors.centerIn: parent
spacing: 2
Repeater {
model: TapbackActions.TAPBACKS
delegate: Rectangle {
id: tapbackCell
required property var modelData
required property int index
readonly property bool current: modelData.kind === menu.myTapback
readonly property bool marked: tapbackStrip.activeFocus && tapbackStrip.cursor === index
width: 36
height: 32
radius: 6
color: current ? Qt.alpha(menu.palette.highlight, 0.45)
: hover.hovered && !menu.tapbacksBusy ? Qt.alpha(menu.palette.windowText, 0.12) : "transparent"
border.width: marked ? 2 : 0
border.color: menu.palette.highlight
opacity: menu.tapbacksBusy ? 0.35 : 1
Accessible.role: Accessible.Button
Accessible.name: (current ? "Remove " : "") + modelData.kind
Text {
anchors.centerIn: parent
text: tapbackCell.modelData.emoji
textFormat: Text.PlainText
font.pixelSize: menu.font.pixelSize + 5
}
Text {
visible: menu.keyHints
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.rightMargin: 2
text: String(index + 1)
textFormat: Text.PlainText
font.pixelSize: Math.max(8, menu.font.pixelSize - 4)
color: Qt.alpha(menu.palette.windowText, 0.6)
}
HoverHandler { id: hover }
TapHandler {
enabled: !menu.tapbacksBusy
onTapped: menu.pickTapback(tapbackCell.modelData.kind)
}
}
}
}
height: visible ? implicitHeight + 4 : 0
font: menu.font
palette: menu.palette
busy: menu.tapbacksBusy
currentKind: menu.myTapback
keyHints: menu.keyHints
onChosen: function(kind) { menu.pickTapback(kind) }
}
MenuSeparator {
visible: menu.tapbacksShown
Expand Down
216 changes: 216 additions & 0 deletions ReactionPicker.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
import QtQuick
import QtQuick.Controls
import "TapbackActions.mjs" as TapbackActions

// Reusable picker: reactions emit a kind, composer insertion emits the glyph.
// Search/category/identity policy lives in tapback-actions.ts. GridView only
// instantiates visible cells, even with the complete Unicode catalogue open.
Control {
id: picker
objectName: "blipReactionPicker"
implicitWidth: 302
implicitHeight: column.implicitHeight
padding: 0
property bool expanded: false
property bool showClassics: true
property bool busy: false
property string currentKind: ""
property bool keyHints: false
property int cursor: -1
signal chosen(string kind)
signal emojiChosen(string emoji)
function choose(kind) {
if (picker.busy) return
var emoji = TapbackActions.reactionEmoji(kind)
if (!emoji) return
picker.chosen(kind)
picker.emojiChosen(emoji)
}
function reset(keyboard) {
expanded = !showClassics
search.text = ""
categories.currentIndex = 0
cursor = TapbackActions.initialTapbackCursor(currentKind, keyboard)
}
Keys.onPressed: function(event) {
if (search.activeFocus || grid.activeFocus || categories.activeFocus) return
if (event.modifiers & (Qt.ControlModifier | Qt.AltModifier | Qt.MetaModifier)) return
if (event.key === Qt.Key_Left || event.key === Qt.Key_Right) {
cursor = TapbackActions.moveTapbackCursor(cursor, event.key === Qt.Key_Right ? 1 : -1, 7)
event.accepted = true
return
}
var marked = cursor >= 0 && (event.key === Qt.Key_Return || event.key === Qt.Key_Enter || event.key === Qt.Key_Space)
if (marked && cursor === 6) {
expanded = !expanded
if (expanded) search.forceActiveFocus()
event.accepted = true
return
}
var kind = marked ? TapbackActions.TAPBACKS[cursor].kind : TapbackActions.tapbackForKey(event.text)
if (kind) { event.accepted = true; choose(kind) }
}
contentItem: Column {
id: column
spacing: 8
Row {
visible: picker.showClassics
width: parent.width
height: visible ? 44 : 0
spacing: 2
Repeater {
model: 7
delegate: ToolButton {
id: classic
required property int index
readonly property bool more: index === 6
readonly property var entry: more ? null : TapbackActions.TAPBACKS[index]
readonly property bool selected: !more && picker.currentKind === entry.kind
width: (column.width - 12) / 7
height: 44
enabled: !picker.busy
hoverEnabled: true
Accessible.name: more ? "More emoji" : (selected ? "Remove " : "React with ") + entry.kind
ToolTip.visible: hovered
ToolTip.text: Accessible.name
background: Rectangle {
radius: width / 2
color: classic.selected ? Qt.alpha(picker.palette.highlight, 0.3)
: classic.hovered || (classic.more && picker.expanded) ? Qt.alpha(picker.palette.windowText, 0.10) : "transparent"
border.width: picker.activeFocus && picker.cursor === classic.index ? 2 : 0
border.color: picker.palette.highlight
}
contentItem: Text {
text: classic.more ? "⊕" : classic.entry.emoji
textFormat: Text.PlainText
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.pixelSize: classic.more ? 27 : 25
color: picker.palette.windowText
opacity: picker.busy ? 0.4 : 1
}
Text {
visible: picker.keyHints && !classic.more
anchors.right: parent.right
anchors.bottom: parent.bottom
text: String(classic.index + 1)
textFormat: Text.PlainText
font.pixelSize: 9
color: picker.palette.windowText
}
onClicked: {
if (more) { picker.expanded = !picker.expanded; if (picker.expanded) search.forceActiveFocus() }
else picker.choose(entry.kind)
}
}
}
}
Column {
width: parent.width
visible: picker.expanded
height: visible ? implicitHeight : 0
spacing: 8
TextField {
id: search
objectName: "reactionEmojiSearch"
width: parent.width
placeholderText: "Search or paste an emoji"
font: picker.font
palette: picker.palette
color: picker.palette.windowText
placeholderTextColor: Qt.alpha(picker.palette.windowText, 0.45)
background: Rectangle {
radius: 8
color: Qt.alpha(picker.palette.windowText, 0.06)
border.width: 1
border.color: search.activeFocus ? picker.palette.highlight : Qt.alpha(picker.palette.windowText, 0.12)
}
maximumLength: 160
selectByMouse: true
Accessible.name: "Search emoji"
Keys.onDownPressed: { grid.currentIndex = 0; grid.forceActiveFocus() }
onAccepted: if (grid.count > 0) picker.choose(grid.model[0].kind)
onTextChanged: grid.currentIndex = -1
}
ComboBox {
id: categories
width: parent.width
model: TapbackActions.EMOJI_GROUPS
font: picker.font
palette.buttonText: picker.palette.windowText
palette.button: picker.palette.window
palette.text: picker.palette.windowText
palette.base: picker.palette.window
palette.window: picker.palette.window
palette.highlight: picker.palette.highlight
background: Rectangle {
radius: 8
color: Qt.alpha(picker.palette.windowText, 0.06)
border.color: Qt.alpha(picker.palette.windowText, 0.12)
}
Accessible.name: "Emoji category"
}
GridView {
id: grid
objectName: "reactionEmojiGrid"
width: parent.width
height: 220
clip: true
cellWidth: width / 7
cellHeight: 42
model: picker.expanded ? TapbackActions.searchReactionEmoji(search.text, categories.currentText || "All") : []
currentIndex: -1
keyNavigationEnabled: true
boundsBehavior: Flickable.StopAtBounds
ScrollBar.vertical: ScrollBar { policy: ScrollBar.AsNeeded }
Keys.onReturnPressed: if (currentIndex >= 0) picker.choose(model[currentIndex].kind)
Keys.onEnterPressed: if (currentIndex >= 0) picker.choose(model[currentIndex].kind)
Keys.onEscapePressed: search.forceActiveFocus()
delegate: ToolButton {
required property var modelData
required property int index
width: grid.cellWidth
height: grid.cellHeight
enabled: !picker.busy
hoverEnabled: true
Accessible.name: modelData.name
ToolTip.visible: hovered
ToolTip.text: modelData.name
background: Rectangle {
radius: 8
color: parent.modelData.kind === picker.currentKind ? Qt.alpha(picker.palette.highlight, 0.3)
: parent.hovered ? Qt.alpha(picker.palette.windowText, 0.10) : "transparent"
border.width: grid.activeFocus && grid.currentIndex === parent.index ? 2 : 0
border.color: picker.palette.highlight
}
contentItem: Text {
text: parent.modelData.emoji
textFormat: Text.PlainText
font.pixelSize: 25
color: picker.palette.windowText
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
onClicked: picker.choose(modelData.kind)
}
Text {
anchors.centerIn: parent
visible: grid.count === 0
text: "No matching emoji"
textFormat: Text.PlainText
color: picker.palette.windowText
font: picker.font
}
}
Text {
visible: picker.showClassics
width: parent.width
text: "Custom reactions depend on the Mac’s available emoji."
textFormat: Text.PlainText
wrapMode: Text.WordWrap
color: Qt.alpha(picker.palette.windowText, 0.65)
font.pixelSize: Math.max(10, picker.font.pixelSize - 2)
}
}
}
}
Loading
Loading