-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TW-2165: Improve tag suggestion with members in room (#2200)
- Loading branch information
Showing
5 changed files
with
127 additions
and
16 deletions.
There are no files selected for viewing
69 changes: 69 additions & 0 deletions
69
docs/adr/0025-improve-tag-suggesstion-and-dispay-members-in-group-chat-detail.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# 25. Improve tag suggestion and display members in group chat detail | ||
|
||
**Date:** 2024-12-30 | ||
|
||
## Status | ||
|
||
**Accepted** | ||
|
||
## Context | ||
|
||
- Issue: [#2165](https://github.com/linagora/twake-on-matrix/issues/2165) | ||
- Not all of the members are displayed in the drop-down list when using the tag suggestion feature. | ||
- Can't load more members in the drop-down list when the user scrolls down. | ||
|
||
## Decision | ||
|
||
1.1 **Improve tag suggestion feature** | ||
- When the user go to the group chat, call the func to get the members from server of the group chat. | ||
More details about this logic can be found in the [ADR #0005](https://github.com/linagora/matrix-dart-sdk/blob/cb37032f466004500c98949739720b3b4457cc73/doc/adr/0005-support-store-members-in-hive.md). | ||
|
||
```dart | ||
Future<void> _requestParticipants() async { | ||
if (room == null) return; | ||
try { | ||
await room!.requestParticipants( | ||
at: room!.prev_batch, | ||
notMembership: Membership.leave, | ||
); | ||
} catch (e) { | ||
Logs() | ||
.e('Chat::_requestParticipants(): Failed to request participants', e); | ||
} | ||
} | ||
``` | ||
- Next time when user go to the group chat, the members will be stored in the hive db and get the members from the hive db to display in the drop-down list. | ||
- When the user types the `@` character, the tag suggestion feature will be triggered. | ||
|
||
1.2 **Display members in the group chat detail** | ||
- When the user clicks on the group chat, how to display the members? | ||
1. Display members with a maximum size defined by the `_membersPerPage` variable defined in `chat_details_tab_mixin.dart`. | ||
```dart | ||
static const _membersPerPage = 30; | ||
``` | ||
2. If more members can be loaded, display the Load more button at the end of the list. | ||
3. When the user clicks on the Load more button, call the function to get more members from the Hive database. | ||
```dart | ||
void _requestMoreMembersAction() async { | ||
final currentMembersCount = _displayMembersNotifier.value?.length ?? 0; | ||
_currentMembersCount += _membersPerPage; | ||
final members = _membersNotifier.value; | ||
if (members != null && currentMembersCount < members.length) { | ||
final endIndex = _currentMembersCount > members.length | ||
? members.length | ||
: _currentMembersCount; | ||
final newMembers = members.sublist(currentMembersCount, endIndex); | ||
_displayMembersNotifier.value = [ | ||
...?_displayMembersNotifier.value, | ||
...newMembers, | ||
]; | ||
} else { | ||
_displayMembersNotifier.value = [ | ||
...?_displayMembersNotifier.value, | ||
...?members, | ||
]; | ||
} | ||
} | ||
``` | ||
4. Each call only takes a maximum of 30 members according to variable `maxMembers` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1877,7 +1877,7 @@ packages: | |
description: | ||
path: "." | ||
ref: "twake-supported-0.22.6" | ||
resolved-ref: "58585a19abc4693d96eab4f8dad9c56bf8699cc1" | ||
resolved-ref: ff95aa820c383baf7b808d8df6ebf4d25a3c6c33 | ||
url: "[email protected]:linagora/matrix-dart-sdk.git" | ||
source: git | ||
version: "0.22.6" | ||
|