diff --git a/Linphone/LinphoneApp.swift b/Linphone/LinphoneApp.swift index 85aeb7e5e..665e3586b 100644 --- a/Linphone/LinphoneApp.swift +++ b/Linphone/LinphoneApp.swift @@ -172,8 +172,6 @@ struct LinphoneApp: App { // Notify the app to navigate to the chat room navigationManager.openChatRoom(callId: callId, peerAddr: peerAddr, localAddr: localAddr) } - - //accountProfileViewModel!.setAvatarModel() } } diff --git a/Linphone/UI/Call/CallView.swift b/Linphone/UI/Call/CallView.swift index c45767251..2deb17962 100644 --- a/Linphone/UI/Call/CallView.swift +++ b/Linphone/UI/Call/CallView.swift @@ -33,14 +33,7 @@ struct CallView: View { @ObservedObject private var telecomManager = TelecomManager.shared @ObservedObject private var contactsManager = ContactsManager.shared - @ObservedObject var callViewModel: CallViewModel - @ObservedObject var conversationViewModel: ConversationViewModel - @ObservedObject var conversationsListViewModel: ConversationsListViewModel - @ObservedObject var conversationForwardMessageViewModel: ConversationForwardMessageViewModel - @ObservedObject var contactsListViewModel: ContactsListViewModel - @ObservedObject var editContactViewModel: EditContactViewModel - @ObservedObject var meetingViewModel: MeetingViewModel - @ObservedObject var accountProfileViewModel: AccountProfileViewModel + @EnvironmentObject var callViewModel: CallViewModel @State private var addParticipantsViewModel: AddParticipantsViewModel? @@ -76,7 +69,6 @@ struct CallView: View { @State var buttonSize = 60.0 @Binding var isShowEditContactFragment: Bool - @Binding var indexPage: Int @Binding var isShowScheduleMeetingFragment: Bool @@ -204,32 +196,6 @@ struct CallView: View { } } - if isShowConversationFragment && SharedMainViewModel.shared.displayedConversation != nil { - ConversationFragment( - conversationViewModel: conversationViewModel, - conversationsListViewModel: conversationsListViewModel, - conversationForwardMessageViewModel: conversationForwardMessageViewModel, - contactsListViewModel: contactsListViewModel, - editContactViewModel: editContactViewModel, - meetingViewModel: meetingViewModel, - accountProfileViewModel: accountProfileViewModel, - isShowConversationFragment: $isShowConversationFragment, - isShowStartCallGroupPopup: $isShowStartCallGroupPopup, - isShowEditContactFragment: $isShowEditContactFragment, - indexPage: $indexPage, - isShowScheduleMeetingFragment: $isShowScheduleMeetingFragment - ) - .frame(maxWidth: .infinity) - .background(Color.gray100) - .ignoresSafeArea(.keyboard) - .zIndex(4) - .transition(.move(edge: .bottom)) - .onDisappear { - SharedMainViewModel.shared.displayedConversation = nil - isShowConversationFragment = false - } - } - if callViewModel.zrtpPopupDisplayed == true { if idiom != .pad && (orientation == .landscapeLeft @@ -501,8 +467,8 @@ struct CallView: View { .frame(width: 206, height: 206) } - if callViewModel.avatarModel != nil { - Avatar(contactAvatarModel: callViewModel.avatarModel!, avatarSize: 200, hidePresence: true) + if let avatar = callViewModel.avatarModel { + Avatar(contactAvatarModel: avatar, avatarSize: 200, hidePresence: true) } if callViewModel.isRemoteDeviceTrusted { @@ -2278,8 +2244,8 @@ struct CallView: View { .frame(width: 32, height: 32, alignment: .center) .onDisappear { if SharedMainViewModel.shared.displayedConversation != nil { - indexPage = 2 - self.conversationViewModel.changeDisplayedChatRoom(conversationModel: SharedMainViewModel.shared.displayedConversation!) + SharedMainViewModel.shared.changeIndexView(indexViewInt: 2) + //self.conversationViewModel.changeDisplayedChatRoom(conversationModel: SharedMainViewModel.shared.displayedConversation!) SharedMainViewModel.shared.displayedConversation = nil withAnimation { telecomManager.callDisplayed = false @@ -2649,7 +2615,7 @@ struct CallView: View { .frame(width: 32, height: 32, alignment: .center) .onDisappear { if SharedMainViewModel.shared.displayedConversation != nil { - conversationViewModel.changeDisplayedChatRoom(conversationModel: SharedMainViewModel.shared.displayedConversation!) + //conversationViewModel.changeDisplayedChatRoom(conversationModel: SharedMainViewModel.shared.displayedConversation!) } } } @@ -2860,20 +2826,11 @@ struct PressedButtonStyle: ButtonStyle { #Preview { CallView( - callViewModel: CallViewModel(), - conversationViewModel: ConversationViewModel(), - conversationsListViewModel: ConversationsListViewModel(), - conversationForwardMessageViewModel: ConversationForwardMessageViewModel(), - contactsListViewModel: ContactsListViewModel(), - editContactViewModel: EditContactViewModel(), - meetingViewModel: MeetingViewModel(), - accountProfileViewModel: AccountProfileViewModel(), fullscreenVideo: .constant(false), isShowStartCallFragment: .constant(false), isShowConversationFragment: .constant(false), isShowStartCallGroupPopup: .constant(false), isShowEditContactFragment: .constant(false), - indexPage: .constant(0), isShowScheduleMeetingFragment: .constant(false) ) } diff --git a/Linphone/UI/Call/ViewModel/CallViewModel.swift b/Linphone/UI/Call/ViewModel/CallViewModel.swift index 2da845f32..34948e2d7 100644 --- a/Linphone/UI/Call/ViewModel/CallViewModel.swift +++ b/Linphone/UI/Call/ViewModel/CallViewModel.swift @@ -103,6 +103,7 @@ class CallViewModel: ObservableObject { func resetCallView() { DispatchQueue.main.async { self.displayName = "" + self.avatarModel = nil } coreContext.doOnCoreQueue { core in @@ -220,7 +221,6 @@ class CallViewModel: ObservableObject { self.isRemoteDeviceTrusted = isRemoteDeviceTrustedTmp self.activeSpeakerParticipant = nil - self.avatarModel = nil self.isRemoteRecording = false self.zrtpPopupDisplayed = false self.upperCaseAuthTokenToRead = "" diff --git a/Linphone/UI/Main/ContentView.swift b/Linphone/UI/Main/ContentView.swift index d8fe3c738..223234fb2 100644 --- a/Linphone/UI/Main/ContentView.swift +++ b/Linphone/UI/Main/ContentView.swift @@ -1343,25 +1343,17 @@ struct ContentView: View { } } */ - /* + if telecomManager.callDisplayed && ((telecomManager.callInProgress && telecomManager.outgoingCallStarted) || telecomManager.callConnected) && !telecomManager.meetingWaitingRoomDisplayed { CallView( - callViewModel: callViewModel, - conversationViewModel: conversationViewModel, - conversationsListViewModel: conversationsListViewModel, - conversationForwardMessageViewModel: conversationForwardMessageViewModel, - contactsListViewModel: contactsListViewModel, - editContactViewModel: editContactViewModel, - meetingViewModel: meetingViewModel, - accountProfileViewModel: accountProfileViewModel, fullscreenVideo: $fullscreenVideo, isShowStartCallFragment: $isShowStartCallFragment, isShowConversationFragment: $isShowConversationFragment, isShowStartCallGroupPopup: $isShowStartCallGroupPopup, isShowEditContactFragment: $isShowEditContactFragment, - indexPage: $index, isShowScheduleMeetingFragment: $isShowScheduleMeetingFragment ) + .environmentObject(callViewModel) .zIndex(5) .transition(.scale.combined(with: .move(edge: .top))) .onAppear { @@ -1377,7 +1369,7 @@ struct ContentView: View { UIApplication.shared.isIdleTimerDisabled = false } } - */ + ToastView() .zIndex(6) } diff --git a/Linphone/UI/Main/History/Model/HistoryModel.swift b/Linphone/UI/Main/History/Model/HistoryModel.swift index 26d27a169..6ecab9c00 100644 --- a/Linphone/UI/Main/History/Model/HistoryModel.swift +++ b/Linphone/UI/Main/History/Model/HistoryModel.swift @@ -77,7 +77,7 @@ class HistoryModel: ObservableObject, Identifiable { let addressNameTmp = confInfoTmp != nil && confInfoTmp!.subject != nil ? confInfoTmp!.subject! - : (addressLinphoneTmp.username != nil ? addressLinphoneTmp.username ?? "" : addressLinphoneTmp.displayName ?? "") + : (addressLinphoneTmp.displayName != nil ? addressLinphoneTmp.displayName ?? "" : addressLinphoneTmp.username ?? "") let addressTmp = addressLinphoneTmp.asStringUriOnly()