diff --git a/Linphone/UI/Main/Conversations/Fragments/ConversationInfoFragment.swift b/Linphone/UI/Main/Conversations/Fragments/ConversationInfoFragment.swift index e33830faf..a05c6cde7 100644 --- a/Linphone/UI/Main/Conversations/Fragments/ConversationInfoFragment.swift +++ b/Linphone/UI/Main/Conversations/Fragments/ConversationInfoFragment.swift @@ -317,11 +317,19 @@ struct ConversationInfoFragment: View { } VStack { - Text(participantConversationModel.name) - .foregroundStyle(Color.grayMain2c700) - .default_text_style(styleSize: 14) - .frame(maxWidth: .infinity, alignment: .leading) - .lineLimit(1) + if conversationViewModel.myParticipantConversationModel != nil && conversationViewModel.myParticipantConversationModel!.address != participantConversationModel.address { + Text(participantConversationModel.name) + .foregroundStyle(Color.grayMain2c700) + .default_text_style(styleSize: 14) + .frame(maxWidth: .infinity, alignment: .leading) + .lineLimit(1) + } else { + Text(accountProfileViewModel.displayName.isEmpty ? participantConversationModel.name : accountProfileViewModel.displayName) + .foregroundStyle(Color.grayMain2c700) + .default_text_style(styleSize: 14) + .frame(maxWidth: .infinity, alignment: .leading) + .lineLimit(1) + } let participantConversationModelIsAdmin = conversationViewModel.participantConversationModelAdmin.first( where: {$0.address == participantConversationModel.address}) diff --git a/Linphone/UI/Main/Settings/ViewModel/AccountProfileViewModel.swift b/Linphone/UI/Main/Settings/ViewModel/AccountProfileViewModel.swift index 4c2ad177e..4a21f1c47 100644 --- a/Linphone/UI/Main/Settings/ViewModel/AccountProfileViewModel.swift +++ b/Linphone/UI/Main/Settings/ViewModel/AccountProfileViewModel.swift @@ -36,22 +36,21 @@ class AccountProfileViewModel: ObservableObject { func saveChangesWhenLeaving() { CoreContext.shared.doOnCoreQueue { core in let newParams = core.defaultAccount!.params?.clone() - print("getImagePath 0 \(self.displayName) \(newParams?.identityAddress?.displayName ?? "NIL")") - if self.displayName != newParams?.identityAddress?.displayName { + if (self.displayName != newParams?.identityAddress?.displayName) + && (newParams?.identityAddress?.displayName != nil || !self.displayName.isEmpty) { if let newIdentityAddress = newParams?.identityAddress?.clone() { try? newIdentityAddress.setDisplayname(newValue: self.displayName) try? newParams?.setIdentityaddress(newValue: newIdentityAddress) } - print("getImagePath 1 \(self.getImagePath().lastPathComponent)") - - if self.getImagePath().lastPathComponent.contains("-default") { - print("getImagePath 2") - self.saveImage( - image: ContactsManager.shared.textToImage( - firstName: self.displayName.isEmpty ? core.defaultAccount!.displayName() : self.displayName, lastName: ""), - name: self.displayName.isEmpty ? core.defaultAccount!.displayName() : self.displayName, - prefix: "-default") + if self.getImagePath().lastPathComponent.contains("-default") || self.getImagePath().lastPathComponent == "Documents" { + DispatchQueue.main.async { + self.saveImage( + image: ContactsManager.shared.textToImage( + firstName: self.displayName.isEmpty ? core.defaultAccount!.displayName() : self.displayName, lastName: ""), + name: self.displayName.isEmpty ? core.defaultAccount!.displayName() : self.displayName, + prefix: "-default") + } } }