From d17a9bbe4c3d970a56e95f0a7b8247e11b7ef609 Mon Sep 17 00:00:00 2001 From: Benoit Martins Date: Tue, 15 Jul 2025 16:36:35 +0200 Subject: [PATCH] Fix avatar display in conversation list --- .../ViewModel/ConversationsListViewModel.swift | 17 ----------------- Linphone/Utils/Avatar.swift | 8 ++++---- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/Linphone/UI/Main/Conversations/ViewModel/ConversationsListViewModel.swift b/Linphone/UI/Main/Conversations/ViewModel/ConversationsListViewModel.swift index 7c268dd35..0393ccd6e 100644 --- a/Linphone/UI/Main/Conversations/ViewModel/ConversationsListViewModel.swift +++ b/Linphone/UI/Main/Conversations/ViewModel/ConversationsListViewModel.swift @@ -118,23 +118,6 @@ class ConversationsListViewModel: ObservableObject { } } } - } else if !conversationModel.isGroup { - if let address = conversationModel.participantsAddress.first { - let avatarModelTmp = ContactsManager.shared.avatarListModel.first(where: { - guard let friend = $0.friend else { return false } - return friend.name == conversationModel.subject && - friend.address?.asStringUriOnly() == address - }) ?? ContactAvatarModel( - friend: nil, - name: conversationModel.subject, - address: address, - withPresence: false - ) - - DispatchQueue.main.async { - conversationModel.avatarModel = avatarModelTmp - } - } } } } diff --git a/Linphone/Utils/Avatar.swift b/Linphone/Utils/Avatar.swift index 780f4b038..60185e5e1 100644 --- a/Linphone/Utils/Avatar.swift +++ b/Linphone/Utils/Avatar.swift @@ -36,11 +36,11 @@ struct Avatar: View { } var body: some View { - if let photoPath = contactAvatarModel.friend?.photo { - let uniqueUrl = ContactsManager.shared.getImagePath(friendPhotoPath: photoPath) - let finalUrl = uniqueUrl.appendingQueryItem("v", value: UUID().uuidString) + if !contactAvatarModel.photo.isEmpty { + let uniqueUrl = ContactsManager.shared.getImagePath(friendPhotoPath: contactAvatarModel.photo) + //let finalUrl = uniqueUrl.appendingQueryItem("v", value: UUID().uuidString) - AsyncImage(url: finalUrl) { image in + AsyncImage(url: uniqueUrl) { image in switch image { case .empty: ProgressView()