project-robius / robrix

A Matrix chat client written in pure Rust using the Makepad UI toolkit and the Robius app dev framework
MIT License
67 stars 11 forks source link

Display better error messages using in-app notification banners #121

Open kevinaboos opened 3 weeks ago

kevinaboos commented 3 weeks ago

Current state

Currently, Robrix can only show errors, warnings, and other non-content information by updating the Status label in the rooms_list. This is okay for early errors like login failures, but it doesn't work at all when any rooms at all are shown, as the status label will be pushed to the very bottom and replaced by a count of joined rooms found so far.

Clearly, the existing "solution" of abusing the Status label for this purpose is inadequate.

Desired solution

Instead, we should utilize some sort of pop-up banner to notify the user of any relevant info. This can be either a banner along the top or bottom, or a "toast"-like notification that auto-disappears after several seconds, or any other common notification paradigm.

In the future, this same mechanism could also be used for in-app notifications about actual Matrix content, such as informing the user of new messages that arrived in a hidden/background room that the user should be aware of.

While this mechanism doesn't yet exist in upstream Makepad, the Moxin app has implemented something very similar to notify the user that a download has completed. Here's what Moxin's in-app popup modal looks like when it is shown in the top-right corner of the app:

image

Note that the link button that will navigate to a specific part of the app should be optional, depending on the nature of the error message or other info that is included in the notification.

To implement this, we can copy the code for Moxin's PopupDialog widget and modify it to suit our needs: https://github.com/moxin-org/moxin/blob/5b21144ced0b8161c4565cba241ae0e3fd8ddf3a/src/shared/download_notification_popup.rs#L1