Fix paused call view

This commit is contained in:
Benoit Martins 2025-07-16 16:49:44 +02:00
parent d17a9bbe4c
commit d170e1e52e
2 changed files with 14 additions and 2 deletions

View file

@ -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
}
}
}
}

View file

@ -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