diff --git a/Linphone/UI/Main/ContentView.swift b/Linphone/UI/Main/ContentView.swift index 1f29cd241..294231aa5 100644 --- a/Linphone/UI/Main/ContentView.swift +++ b/Linphone/UI/Main/ContentView.swift @@ -321,7 +321,7 @@ struct ContentView: View { .clipShape(Circle()) case .failure: Image(uiImage: contactsManager.textToImage( - firstName: accountProfileViewModel.avatarModel?.name ?? "", + firstName: CoreContext.shared.accounts[accountProfileViewModel.accountModelIndex ?? 0].avatarModel?.name ?? "", lastName: "")) .resizable() .frame(width: avatarSize, height: avatarSize) @@ -931,7 +931,7 @@ struct ContentView: View { SideMenu( accountProfileViewModel: accountProfileViewModel, width: geometry.size.width / 5 * 4, - isOpen: self.sideMenuIsOpen, + isOpen: $sideMenuIsOpen, menuClose: self.openMenu, safeAreaInsets: geometry.safeAreaInsets, isShowLoginFragment: $isShowLoginFragment, diff --git a/Linphone/UI/Main/Conversations/Fragments/ConversationInfoFragment.swift b/Linphone/UI/Main/Conversations/Fragments/ConversationInfoFragment.swift index a05c6cde7..26f4bf35d 100644 --- a/Linphone/UI/Main/Conversations/Fragments/ConversationInfoFragment.swift +++ b/Linphone/UI/Main/Conversations/Fragments/ConversationInfoFragment.swift @@ -47,6 +47,7 @@ struct ConversationInfoFragment: View { @State private var participantListIsOpen = true var body: some View { + let accountModel = CoreContext.shared.accounts[accountProfileViewModel.accountModelIndex ?? 0] NavigationView { GeometryReader { geometry in if conversationViewModel.displayedConversation != nil { @@ -305,7 +306,7 @@ struct ConversationInfoFragment: View { .clipShape(Circle()) case .failure: Image(uiImage: contactsManager.textToImage( - firstName: accountProfileViewModel.avatarModel?.name ?? "", + firstName: accountModel.avatarModel?.name ?? "", lastName: "")) .resizable() .frame(width: avatarSize, height: avatarSize) @@ -324,7 +325,7 @@ struct ConversationInfoFragment: View { .frame(maxWidth: .infinity, alignment: .leading) .lineLimit(1) } else { - Text(accountProfileViewModel.displayName.isEmpty ? participantConversationModel.name : accountProfileViewModel.displayName) + Text(accountModel.displayName.isEmpty ? participantConversationModel.name : accountModel.displayName) .foregroundStyle(Color.grayMain2c700) .default_text_style(styleSize: 14) .frame(maxWidth: .infinity, alignment: .leading) diff --git a/Linphone/UI/Main/Fragments/SideMenu.swift b/Linphone/UI/Main/Fragments/SideMenu.swift index 537c17d6c..bb5c3a1a6 100644 --- a/Linphone/UI/Main/Fragments/SideMenu.swift +++ b/Linphone/UI/Main/Fragments/SideMenu.swift @@ -26,7 +26,7 @@ struct SideMenu: View { @ObservedObject var accountProfileViewModel: AccountProfileViewModel let width: CGFloat - let isOpen: Bool + @Binding var isOpen: Bool let menuClose: () -> Void let safeAreaInsets: EdgeInsets @Binding var isShowLoginFragment: Bool @@ -69,7 +69,7 @@ struct SideMenu: View { List { ForEach(0.. URL { - let imagePath = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!.appendingPathComponent(self.photoAvatarModel ?? "Error") + let imagePath = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!.appendingPathComponent( + CoreContext.shared.accounts[self.accountModelIndex ?? 0].photoAvatarModel ?? "Error" + ) return imagePath } diff --git a/Linphone/UI/Main/Viewmodel/AccountModel.swift b/Linphone/UI/Main/Viewmodel/AccountModel.swift index a920fecfc..ecc451fdf 100644 --- a/Linphone/UI/Main/Viewmodel/AccountModel.swift +++ b/Linphone/UI/Main/Viewmodel/AccountModel.swift @@ -30,6 +30,9 @@ class AccountModel: ObservableObject { @Published var isDefaultAccount: Bool = false @Published var displayName: String = "" @Published var address: String = "" + @Published var avatarModel: ContactAvatarModel? + @Published var photoAvatarModel: String? + @Published var displayNameAvatar: String = "" private var accountDelegate: AccountDelegate? private var coreDelegate: CoreDelegate?