Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support sending replies to a specific message #83

Closed
kevinaboos opened this issue Jul 15, 2024 · 2 comments
Closed

Support sending replies to a specific message #83

kevinaboos opened this issue Jul 15, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request help wanted Looking for help from anyone!

Comments

@kevinaboos
Copy link
Member

kevinaboos commented Jul 15, 2024

This feature will enable the user to reply to a particular message. Currently Robrix only supports sending a standalone message that is not in-reply-to anything.

Implementation Approach

This requires modifying the UI in two places:

  1. adding a reply button to each message
  2. adding a "Replying-to" preview above the message input box

Reply button

For the Makepad DSL components, we can add a Reply IconButton to all of the Message-like views. Most likely, the best place to add this is as part of the MessageMenu, which itself needs to be redesigned entirely.

By default, this view would be marked as visible: false, and would only be set to visible upon hover, or by showing a context menu when right-clicking / long-pressing on a message. I think the best option is to show this on the upper-right corner of the message, which is what both Element and Discord do (see the Examples section below).

Note that we should only show the reply button if the message can be replied to, which can be determined via this function.

Makepad doesn't yet have built-in support for context menus, so it is probably best to initially make the buttons (and the MessageMenu) visible at all times (instead of just upon hover).

Makepad also doesn't yet support gestures, but eventually when it does, we'll want to add a swipe gesture to reply to a message too.

Replying-to message preview

Once the reply button has been pressed, we should add a view right above the message_input text input box (at the bottom of the RoomScreen) that shows a preview of the message that the user is about to reply to. We could likely re-use the ReplyPreview suggested in issue #82 for this.

In addition, we need a cancel (X) button that sits at the far right side of the reply preview, which allows the user to cancel the reply action, which will make the current message being composed in the message_input text box act as a regular standalone message.

Here's an example of how Element displays this "Replying to" preview:

image

Actually sending the message

Currently, messages are sent in the code here:

submit_async_request(MatrixRequest::SendMessage {

It should be straightforward to augment this to support sending a reply message. Currently, the actual message is sent here:

timeline.send(message.into()).await;
, but we should be able to easily add another case where we use send_reply() function provided by the Matrix SDK.

Examples

Here's how Element on desktop shows a message menu upon hovering over it, with the reply button in the middle:

image

Here's how Discord shows the reply button:

image
@kevinaboos kevinaboos added enhancement New feature or request help wanted Looking for help from anyone! labels Jul 15, 2024
@fmzbl fmzbl self-assigned this Jul 22, 2024
@fmzbl
Copy link
Contributor

fmzbl commented Jul 22, 2024

Will be working on this!

@kevinaboos
Copy link
Member Author

Implemented in #104

@github-project-automation github-project-automation bot moved this from In review to Done in Robrix Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Looking for help from anyone!
Projects
Status: Done
Development

No branches or pull requests

2 participants