Skip to content

Commit 2a57b9a

Browse files
authored
fix: user search (#16)
1 parent 920a178 commit 2a57b9a

File tree

2 files changed

+9
-26
lines changed

2 files changed

+9
-26
lines changed

lib/chat/common/search_model.dart

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,13 @@ class SearchModel extends SafeChangeNotifier {
7777
required Function() onFail,
7878
}) async {
7979
SearchUserDirectoryResponse? searchUserDirectoryResponse;
80-
if (_debounce?.isActive ?? false) _debounce?.cancel();
81-
_debounce = Timer(const Duration(seconds: 1), () async {
82-
try {
83-
searchUserDirectoryResponse =
84-
await _client.searchUserDirectory(searchQuery);
85-
} on Exception catch (e, s) {
86-
onFail();
87-
printMessageInDebugMode(e, s);
88-
}
89-
});
80+
try {
81+
searchUserDirectoryResponse =
82+
await _client.searchUserDirectory(searchQuery);
83+
} on Exception catch (e, s) {
84+
onFail();
85+
printMessageInDebugMode(e, s);
86+
}
9087

9188
return searchUserDirectoryResponse?.results;
9289
}

lib/chat/events/view/chat_message_bubble.dart

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,6 @@ class _ChatMessageBubbleContent extends StatelessWidget {
100100
final ChatMessageBubbleShape messageBubbleShape;
101101
final bool partOfMessageCohort;
102102

103-
String replaceColoredEmojiWithMonochrome(String text) {
104-
final RegExp emojiRegex =
105-
RegExp(r'(\p{Extended_Pictographic})\ufe0f', unicode: true);
106-
107-
return text.replaceAllMapped(emojiRegex, (match) {
108-
final String emoji = match.group(1)!;
109-
return '$emoji\ufe0e';
110-
});
111-
}
112-
113103
@override
114104
Widget build(BuildContext context) {
115105
var html = event.formattedText;
@@ -190,19 +180,15 @@ class _ChatMessageBubbleContent extends StatelessWidget {
190180
)
191181
: event.isRichMessage
192182
? HtmlMessage(
193-
html: replaceColoredEmojiWithMonochrome(
194-
html,
195-
),
183+
html: html,
196184
room: timeline.room,
197185
defaultTextColor:
198186
context.colorScheme.onSurface,
199187
)
200188
: SelectableText.rich(
201189
TextSpan(
202190
style: messageStyle,
203-
text: replaceColoredEmojiWithMonochrome(
204-
displayEvent.body,
205-
),
191+
text: displayEvent.body,
206192
),
207193
style: messageStyle,
208194
),

0 commit comments

Comments
 (0)