Add muted and joining icons in conf call

This commit is contained in:
Benoit Martins 2024-04-17 15:48:23 +02:00
parent 2133934e28
commit c350def616
5 changed files with 121 additions and 31 deletions

View file

@ -419,6 +419,9 @@
},
"Job title" : {
},
"Joining..." : {
},
"Key" : {
"extractionState" : "manual"

View file

@ -519,7 +519,7 @@ struct CallView: View {
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
)
}
} else if callViewModel.isConference && !telecomManager.outgoingCallStarted && callViewModel.activeSpeakerParticipant != nil {
} else if callViewModel.isConference && !telecomManager.outgoingCallStarted && callViewModel.activeSpeakerParticipant != nil {
VStack {
Spacer()
ZStack {
@ -613,6 +613,27 @@ struct CallView: View {
}
}
}
if callViewModel.isConference && !telecomManager.outgoingCallStarted && callViewModel.activeSpeakerParticipant != nil && callViewModel.activeSpeakerParticipant!.isMuted {
VStack {
HStack {
Spacer()
HStack(alignment: .center) {
Image("microphone-slash")
.renderingMode(.template)
.resizable()
.foregroundStyle(Color.grayMain2c800)
.frame(width: 20, height: 20)
}
.padding(5)
.background(.white)
.cornerRadius(40)
}
Spacer()
}
.frame(maxWidth: .infinity)
.padding(.all, 20)
}
if callViewModel.isConference {
HStack {
@ -654,6 +675,7 @@ struct CallView: View {
.scaledToFill()
.clipped()
}
VStack(alignment: .leading) {
Spacer()
@ -677,21 +699,63 @@ struct CallView: View {
ForEach(0..<callViewModel.participantList.count, id: \.self) { index in
if callViewModel.activeSpeakerParticipant != nil && !callViewModel.participantList[index].address.equal(address2: callViewModel.activeSpeakerParticipant!.address) {
ZStack {
VStack {
Spacer()
if callViewModel.participantList[index].isJoining {
VStack {
Spacer()
ActivityIndicator(color: .white)
.frame(width: 40, height: 40)
.padding(.bottom, 5)
Text("Joining...")
.frame(maxWidth: .infinity, alignment: .center)
.foregroundStyle(Color.white)
.default_text_style_500(styleSize: 14)
.lineLimit(1)
.padding(.horizontal, 10)
Spacer()
}
} else {
VStack {
Spacer()
Avatar(contactAvatarModel: callViewModel.participantList[index].avatarModel, avatarSize: 50, hidePresence: true)
Spacer()
}
Avatar(contactAvatarModel: callViewModel.participantList[index].avatarModel, avatarSize: 50, hidePresence: true)
Spacer()
}
LinphoneVideoViewHolder { view in
coreContext.doOnCoreQueue { core in
let participantVideo = core.currentCall?.conference?.participantList.first(where: {$0.address!.equal(address2: callViewModel.participantList[index].address)})
if participantVideo != nil && participantVideo!.devices.first != nil {
participantVideo!.devices.first!.nativeVideoWindowId = UnsafeMutableRawPointer(Unmanaged.passRetained(view).toOpaque())
LinphoneVideoViewHolder { view in
coreContext.doOnCoreQueue { core in
let participantVideo = core.currentCall?.conference?.participantList.first(where: {$0.address!.equal(address2: callViewModel.participantList[index].address)})
if participantVideo != nil && participantVideo!.devices.first != nil {
participantVideo!.devices.first!.nativeVideoWindowId = UnsafeMutableRawPointer(Unmanaged.passRetained(view).toOpaque())
}
}
}
if callViewModel.participantList[index].isMuted {
VStack {
HStack {
Spacer()
HStack(alignment: .center) {
Image("microphone-slash")
.renderingMode(.template)
.resizable()
.foregroundStyle(Color.grayMain2c800)
.frame(width: 12, height: 12)
}
.padding(2)
.background(.white)
.cornerRadius(40)
}
Spacer()
}
.frame(maxWidth: .infinity)
.padding(.all, 10)
}
}
VStack(alignment: .leading) {
@ -706,7 +770,6 @@ struct CallView: View {
.padding(.bottom, 6)
}
.frame(maxWidth: .infinity)
}
.frame(width: 140, height: 140)
.background(Color.gray600)

View file

@ -29,8 +29,9 @@ class ParticipantModel: ObservableObject {
@Published var name: String
@Published var avatarModel: ContactAvatarModel
@Published var isJoining: Bool
@Published var isMuted: Bool
init(address: Address, isJoining: Bool) {
init(address: Address, isJoining: Bool, isMuted: Bool) {
self.address = address
self.sipUri = address.asStringUriOnly()
@ -57,5 +58,6 @@ class ParticipantModel: ObservableObject {
: ContactAvatarModel(friend: nil, name: nameTmp, withPresence: false)
self.isJoining = isJoining
self.isMuted = isMuted
}
}

View file

@ -159,15 +159,15 @@ class CallViewModel: ObservableObject {
self.participantList = []
if conf.me?.address != nil {
self.myParticipantModel = ParticipantModel(address: conf.me!.address!, isJoining: false)
self.myParticipantModel = ParticipantModel(address: conf.me!.address!, isJoining: false, isMuted: false)
} else if self.currentCall?.callLog?.localAddress != nil {
self.myParticipantModel = ParticipantModel(address: self.currentCall!.callLog!.localAddress!, isJoining: false)
self.myParticipantModel = ParticipantModel(address: self.currentCall!.callLog!.localAddress!, isJoining: false, isMuted: false)
}
if conf.activeSpeakerParticipantDevice?.address != nil {
self.activeSpeakerParticipant = ParticipantModel(address: conf.activeSpeakerParticipantDevice!.address!, isJoining: false)
self.activeSpeakerParticipant = ParticipantModel(address: conf.activeSpeakerParticipantDevice!.address!, isJoining: false, isMuted: conf.activeSpeakerParticipantDevice!.isMuted)
} else if conf.participantList.first?.address != nil {
self.activeSpeakerParticipant = ParticipantModel(address: conf.participantList.first!.address!, isJoining: false)
self.activeSpeakerParticipant = ParticipantModel(address: conf.participantDeviceList.first!.address!, isJoining: false, isMuted: conf.participantDeviceList.first!.isMuted)
}
if self.activeSpeakerParticipant != nil {
@ -186,7 +186,9 @@ class CallViewModel: ObservableObject {
conf.participantDeviceList.forEach({ participantDevice in
if participantDevice.address != nil && !conf.isMe(uri: participantDevice.address!.clone()!) {
if !conf.isMe(uri: participantDevice.address!.clone()!) {
self.participantList.append(ParticipantModel(address: participantDevice.address!, isJoining: participantDevice.state == .Joining))
self.participantList.append(
ParticipantModel(address: participantDevice.address!, isJoining: participantDevice.state == .Joining || participantDevice.state == .Alerting, isMuted: participantDevice.isMuted)
)
}
}
})
@ -215,7 +217,7 @@ class CallViewModel: ObservableObject {
self.currentCall?.conference?.publisher?.onActiveSpeakerParticipantDevice?.postOnMainQueue {(cbValue: (conference: Conference, participantDevice: ParticipantDevice)) in
if cbValue.participantDevice.address != nil {
let activeSpeakerParticipantTmp = self.activeSpeakerParticipant
self.activeSpeakerParticipant = ParticipantModel(address: cbValue.participantDevice.address!, isJoining: false)
self.activeSpeakerParticipant = ParticipantModel(address: cbValue.participantDevice.address!, isJoining: false, isMuted: cbValue.participantDevice.isMuted)
if self.activeSpeakerParticipant != nil {
let friend = ContactsManager.shared.getFriendWithAddress(address: self.activeSpeakerParticipant!.address)
@ -238,7 +240,9 @@ class CallViewModel: ObservableObject {
cbValue.conference.participantDeviceList.forEach({ participantDevice in
if participantDevice.address != nil && !cbValue.conference.isMe(uri: participantDevice.address!.clone()!) {
if !cbValue.conference.isMe(uri: participantDevice.address!.clone()!) {
self.participantList.append(ParticipantModel(address: participantDevice.address!, isJoining: participantDevice.state == .Joining))
self.participantList.append(
ParticipantModel(address: participantDevice.address!, isJoining: participantDevice.state == .Joining || participantDevice.state == .Alerting, isMuted: participantDevice.isMuted)
)
}
}
})
@ -248,13 +252,15 @@ class CallViewModel: ObservableObject {
)
self.mConferenceSuscriptions.insert(
self.currentCall?.conference?.publisher?.onParticipantAdded?.postOnMainQueue {(cbValue: (conference: Conference, participant: Participant)) in
if cbValue.participant.address != nil {
self.currentCall?.conference?.publisher?.onParticipantDeviceAdded?.postOnMainQueue {(cbValue: (conference: Conference, participantDevice: ParticipantDevice)) in
if cbValue.participantDevice.address != nil {
self.participantList = []
cbValue.conference.participantDeviceList.forEach({ participantDevice in
if participantDevice.address != nil && !cbValue.conference.isMe(uri: participantDevice.address!.clone()!) {
if !cbValue.conference.isMe(uri: participantDevice.address!.clone()!) {
self.participantList.append(ParticipantModel(address: participantDevice.address!, isJoining: participantDevice.state == .Joining))
self.participantList.append(
ParticipantModel(address: participantDevice.address!, isJoining: participantDevice.state == .Joining || participantDevice.state == .Alerting, isMuted: participantDevice.isMuted)
)
}
}
})
@ -263,13 +269,15 @@ class CallViewModel: ObservableObject {
)
self.mConferenceSuscriptions.insert(
self.currentCall?.conference?.publisher?.onParticipantRemoved?.postOnMainQueue {(cbValue: (conference: Conference, participant: Participant)) in
if cbValue.participant.address != nil {
self.currentCall?.conference?.publisher?.onParticipantDeviceRemoved?.postOnMainQueue {(cbValue: (conference: Conference, participantDevice: ParticipantDevice)) in
if cbValue.participantDevice.address != nil {
self.participantList = []
cbValue.conference.participantDeviceList.forEach({ participantDevice in
if participantDevice.address != nil && !cbValue.conference.isMe(uri: participantDevice.address!.clone()!) {
if !cbValue.conference.isMe(uri: participantDevice.address!.clone()!) {
self.participantList.append(ParticipantModel(address: participantDevice.address!, isJoining: participantDevice.state == .Joining))
self.participantList.append(
ParticipantModel(address: participantDevice.address!, isJoining: participantDevice.state == .Joining || participantDevice.state == .Alerting, isMuted: participantDevice.isMuted)
)
}
}
})
@ -277,6 +285,20 @@ class CallViewModel: ObservableObject {
}
)
self.mConferenceSuscriptions.insert(
self.currentCall?.conference?.publisher?.onParticipantDeviceIsMuted?.postOnMainQueue {(cbValue: (conference: Conference, participantDevice: ParticipantDevice, isMuted: Bool)) in
if self.activeSpeakerParticipant != nil && self.activeSpeakerParticipant!.address.equal(address2: cbValue.participantDevice.address!) {
self.activeSpeakerParticipant!.isMuted = cbValue.isMuted
} else {
self.participantList.forEach({ participantDevice in
if participantDevice.address.equal(address2: cbValue.participantDevice.address!) {
participantDevice.isMuted = cbValue.isMuted
}
})
}
}
)
self.mConferenceSuscriptions.insert(
self.currentCall?.conference?.publisher?.onParticipantDeviceStateChanged?.postOnMainQueue {(cbValue: (conference: Conference, device: ParticipantDevice, state: ParticipantDevice.State)) in
Log.info(
@ -285,7 +307,7 @@ class CallViewModel: ObservableObject {
self.participantList.forEach({ participantDevice in
if participantDevice.address.equal(address2: cbValue.device.address!) {
participantDevice.isJoining = cbValue.state == .Joining
participantDevice.isJoining = cbValue.state == .Joining || cbValue.state == .Alerting
}
})
}

View file

@ -223,7 +223,7 @@ struct HistoryListFragment: View {
)
*/
let reutest = try Factory.Instance.createAddress(addr: "sip:conference-focus@sip.linphone.org;conf-id=iVs8XshC~;gr=0ee3f37f-6df2-0071-bb9a-a4e24be30135")
let reutest = try Factory.Instance.createAddress(addr: "sip:conference-focus@sip.linphone.org;conf-id=7M7oqGrZS;gr=0ee3f37f-6df2-0071-bb9a-a4e24be30135")
telecomManager.meetingWaitingRoomDisplayed = true
telecomManager.meetingWaitingRoomSelected = reutest
@ -244,7 +244,7 @@ struct HistoryListFragment: View {
)
*/
let reutest = try Factory.Instance.createAddress(addr: "sip:conference-focus@sip.linphone.org;conf-id=iVs8XshC~;gr=0ee3f37f-6df2-0071-bb9a-a4e24be30135")
let reutest = try Factory.Instance.createAddress(addr: "sip:conference-focus@sip.linphone.org;conf-id=7M7oqGrZS;gr=0ee3f37f-6df2-0071-bb9a-a4e24be30135")
telecomManager.meetingWaitingRoomDisplayed = true
telecomManager.meetingWaitingRoomSelected = reutest