diff --git a/Linphone/UI/Call/CallView.swift b/Linphone/UI/Call/CallView.swift index 93c19fabd..eb3ffa413 100644 --- a/Linphone/UI/Call/CallView.swift +++ b/Linphone/UI/Call/CallView.swift @@ -36,6 +36,8 @@ struct CallView: View { @EnvironmentObject var callViewModel: CallViewModel @State private var addParticipantsViewModel: AddParticipantsViewModel? + + @Environment(\.scenePhase) var scenePhase private var idiom: UIUserInterfaceIdiom { UIDevice.current.userInterfaceIdiom } @State private var orientation = UIDevice.current.orientation @@ -227,6 +229,14 @@ struct CallView: View { buttonSize = 45.0 } } + .onChange(of: scenePhase) { newPhase in + switch newPhase { + case .active: + callViewModel.resetCallView() + default: + break + } + } } } diff --git a/Linphone/UI/Call/ViewModel/CallViewModel.swift b/Linphone/UI/Call/ViewModel/CallViewModel.swift index 326ef9dd0..7bf059091 100644 --- a/Linphone/UI/Call/ViewModel/CallViewModel.swift +++ b/Linphone/UI/Call/ViewModel/CallViewModel.swift @@ -109,7 +109,9 @@ class CallViewModel: ObservableObject { } coreContext.doOnCoreQueue { core in - if core.currentCall != nil && core.currentCall!.remoteAddress != nil { + if (core.currentCall != nil && core.currentCall!.remoteAddress != nil) || (core.calls.first != nil && core.calls.first!.state == .Paused) { + let currentCallTmp = core.currentCall ?? core.calls.first + if self.callDelegate != nil { self.currentCall?.removeDelegate(delegate: self.callDelegate!) self.callDelegate = nil @@ -122,7 +124,7 @@ class CallViewModel: ObservableObject { self.currentCall?.conference?.removeDelegate(delegate: self.waitingForConferenceDelegate!) self.waitingForConferenceDelegate = nil } - self.currentCall = core.currentCall + self.currentCall = currentCallTmp let callsCounterTmp = core.calls.count var videoDisplayedTmp = false