diff --git a/Linphone/UI/Call/CallView.swift b/Linphone/UI/Call/CallView.swift index f5e01f466..cf65931df 100644 --- a/Linphone/UI/Call/CallView.swift +++ b/Linphone/UI/Call/CallView.swift @@ -402,6 +402,7 @@ struct CallView: View { } } + // swiftlint:disable:next cyclomatic_complexity func simpleCallView(geometry: GeometryProxy) -> some View { ZStack { if !callViewModel.isConference { @@ -598,7 +599,7 @@ struct CallView: View { if viewIsDisplayed && (callViewModel.receiveVideo || telecomManager.remoteConfVideo) { */ - if (callViewModel.receiveVideo || telecomManager.remoteConfVideo) { + if (callViewModel.receiveVideo || telecomManager.remoteConfVideo) && !telecomManager.outgoingCallStarted { LinphoneVideoViewHolder { view in coreContext.doOnCoreQueue { core in //core.nativeVideoWindow = view @@ -623,13 +624,73 @@ struct CallView: View { } } + /* + HStack { + Spacer() + VStack { + Spacer() + LinphoneVideoViewHolder { view in + coreContext.doOnCoreQueue { core in + core.nativePreviewWindow = view + } + } + .frame(width: angleDegree == 0 ? 120*1.2 : 160*1.2, height: angleDegree == 0 ? 160*1.2 : 120*1.2) + .cornerRadius(20) + .padding(10) + .padding(.trailing, abs(angleDegree/2)) + } + } + .frame( + maxWidth: fullscreenVideo && !telecomManager.isPausedByRemote ? geometry.size.width : geometry.size.width - 8, + maxHeight: fullscreenVideo && !telecomManager.isPausedByRemote ? geometry.size.height + geometry.safeAreaInsets.top + geometry.safeAreaInsets.bottom : geometry.size.height - (minBottomSheetHeight * geometry.size.height > 80 ? minBottomSheetHeight * geometry.size.height : 78) - 40 - 20 + geometry.safeAreaInsets.bottom + ) + */ + } + + if !telecomManager.outgoingCallStarted { HStack { Spacer() VStack { Spacer() ScrollView(.horizontal) { HStack { - ForEach(0.. 80 ? minBottomSheetHeight * geometry.size.height : 78) - 40 - 20 + geometry.safeAreaInsets.bottom ) .padding(.bottom, 10) - /* - HStack { - Spacer() - VStack { - Spacer() - LinphoneVideoViewHolder { view in - coreContext.doOnCoreQueue { core in - core.nativePreviewWindow = view - } - } - .frame(width: angleDegree == 0 ? 120*1.2 : 160*1.2, height: angleDegree == 0 ? 160*1.2 : 120*1.2) - .cornerRadius(20) - .padding(10) - .padding(.trailing, abs(angleDegree/2)) - } - } - .frame( - maxWidth: fullscreenVideo && !telecomManager.isPausedByRemote ? geometry.size.width : geometry.size.width - 8, - maxHeight: fullscreenVideo && !telecomManager.isPausedByRemote ? geometry.size.height + geometry.safeAreaInsets.top + geometry.safeAreaInsets.bottom : geometry.size.height - (minBottomSheetHeight * geometry.size.height > 80 ? minBottomSheetHeight * geometry.size.height : 78) - 40 - 20 + geometry.safeAreaInsets.bottom - ) - */ } } @@ -711,7 +751,7 @@ struct CallView: View { ) } - if telecomManager.outgoingCallStarted { + if telecomManager.outgoingCallStarted { VStack { ActivityIndicator() .frame(width: 20, height: 20) diff --git a/Linphone/UI/Call/ViewModel/CallViewModel.swift b/Linphone/UI/Call/ViewModel/CallViewModel.swift index 8f832665e..38ef4a84b 100644 --- a/Linphone/UI/Call/ViewModel/CallViewModel.swift +++ b/Linphone/UI/Call/ViewModel/CallViewModel.swift @@ -50,6 +50,7 @@ class CallViewModel: ObservableObject { @Published var receiveVideo: Bool = false @Published var participantList: [ParticipantModel] = [] @Published var activeSpeakerParticipant: ParticipantModel? = nil + @Published var myParticipantModel: ParticipantModel? = nil private var mConferenceSuscriptions = Set() @@ -148,7 +149,13 @@ class CallViewModel: ObservableObject { self.participantList = [] conf?.participantInfos.forEach({ participantInfo in if participantInfo.address != nil { - self.participantList.append(ParticipantModel(address: participantInfo.address!)) + if participantInfo.address!.equal(address2: (self.currentCall?.callLog?.localAddress!)!) { + self.myParticipantModel = ParticipantModel(address: participantInfo.address!) + } else { + if self.activeSpeakerParticipant != nil && !participantInfo.address!.equal(address2: self.activeSpeakerParticipant!.address) { + self.participantList.append(ParticipantModel(address: participantInfo.address!)) + } + } } }) self.addConferenceCallBacks() @@ -167,9 +174,24 @@ class CallViewModel: ObservableObject { self.receiveVideo = direction == MediaDirection.SendRecv || direction == MediaDirection.SendOnly if cbValue.participantDevice.address != nil { + let activeSpeakerParticipantTmp = self.activeSpeakerParticipant self.activeSpeakerParticipant = ParticipantModel(address: cbValue.participantDevice.address!) + + if self.activeSpeakerParticipant != nil + && ((activeSpeakerParticipantTmp != nil && !activeSpeakerParticipantTmp!.address.equal(address2: self.activeSpeakerParticipant!.address)) + || ( activeSpeakerParticipantTmp == nil)) { + + self.participantList = [] + cbValue.conference.participantList.forEach({ participant in + if participant.address != nil && !cbValue.conference.isMe(uri: participant.address!) { + if !cbValue.conference.isMe(uri: participant.address!) && !participant.address!.equal(address2: self.activeSpeakerParticipant!.address) { + self.participantList.append(ParticipantModel(address: participant.address!)) + } + } + }) + } } - }) + }) } }