Implement search bar at the top of the rooms list
kevinaboos opened this issue · 1 comments
This feature simply acts as a local filter for the list of rooms currently being displayed. It does not perform any remote search for rooms or any other form of server requests for data. It only looks at the list of currently-known rooms, including both joined and invited rooms.
There are many ways one could implement this:
- [Preferred] Using the
all_rooms
vector in theRoomsList
struct:Line 202 in 106033d
- You'll need to add some more states to the
RoomPreviewEntry
, namely the set of published addresses/aliases for the room. - This currently only includes joined rooms, but doesn't include invited rooms. Those can also be added, if desired.
- You'll need to add some more states to the
- Calling the
Client::rooms_filtered()
function with the appropriateRoomStateFilter
- Calling the
Client::joined_rooms()
andClient::invited_rooms()
function
Optionally, you can also include left rooms (rooms the user had joined in the past but has since left) in the search.
Supported search terms
The keywords entered in the rooms list search bar should match on all of the following strings:
- Each room's display name
- example:
"Matrix Rust SDK Development"
- example:
- Each room's published addresses/aliases
- example:
"#matrix-rust-sdk-dev:flipdot.org"
- example:
- Each room's internal room ID
- example:
"!qSsPTKDfMGYqhgiLPJ:flipdot.org"
- example:
Upon typing one or more characters in the search bar, the list should automatically be refreshed (without the user having to click a button or press Enter/Return), and only the Rooms that (partially) match the terms should be shown.
Then, also after typing at least one character, a small X (❌) icon button should be shown on the right-hand side of the TextInput
search bar, which allows the user to clear the entered search terms. Upon clicking that, or when the search bar text is deleted/cleared, all filters should be automatically removed and all known rooms should be displayed.
When the search bar is empty, it should display the text "Filter rooms..." or "Room name, alias, or ID...", or something similar.
With #224 in place, this should be much easier to do. It should also be clearer on how to implement it based on comments in RoomsList
and the RoomDisplayFilter
type added in that PR.