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

TW-1774: Update avatar when have changes #1953

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
11 changes: 8 additions & 3 deletions lib/pages/chat_list/chat_list_item_avatar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,13 @@ class _ChatListItemAvatarState extends State<ChatListItemAvatar> {
void updateDirectChatAvatar() {
final event = widget.joinedRoomUpdate?.timeline?.events?.last;
final avatarMxc = event?.content['avatar_url'];
if (avatarMxc is String &&
avatarMxc.isNotEmpty &&
event?.senderId == widget.room.directChatMatrixID) {
if (event?.senderId != widget.room.directChatMatrixID) {
return;
}
if (avatarMxc is String && avatarMxc.isNotEmpty) {
avatarUrlNotifier.value = Uri.tryParse(avatarMxc);
} else {
avatarUrlNotifier.value = Uri();
}
sherlockvn marked this conversation as resolved.
Show resolved Hide resolved
}

Expand All @@ -99,6 +102,8 @@ class _ChatListItemAvatarState extends State<ChatListItemAvatar> {

if (avatarMxc is String && avatarMxc.isNotEmpty) {
avatarUrlNotifier.value = Uri.tryParse(avatarMxc);
} else {
avatarUrlNotifier.value = Uri();
}
}
}