First/Last to join conference

Support simulator for play pause
Removed unused code (chat room access in conference)
This commit is contained in:
Christophe Deschamps 2022-06-10 11:07:58 +02:00
parent 8c66c4f96a
commit 698bb7882a
5 changed files with 30 additions and 61 deletions

View file

@ -349,6 +349,14 @@ import AVFoundation
}
func setHeld(call: Call, hold: Bool) {
#if targetEnvironment(simulator)
if (hold) {
try?call.pause()
} else {
try?call.resume()
}
#else
let callid = call.callLog?.callId ?? ""
let uuid = providerDelegate.uuids["\(callid)"]
if (uuid == nil) {
@ -358,6 +366,7 @@ import AVFoundation
let setHeldAction = CXSetHeldCallAction(call: uuid!, onHold: hold)
let transaction = CXTransaction(action: setHeldAction)
requestTransaction(transaction, action: "setHeld")
#endif
}
@objc func setHeldOtherCalls(exceptCallid: String) {

View file

@ -140,7 +140,7 @@ import SVProgressHUD
contentView.addSubview(viaChatLabel)
viaChatLabel.matchParentSideBorders(insetedByDx: form_margin).alignUnder(view: schedulingStack,withMargin: 2*form_margin).done()
ConferenceSchedulingViewModel.shared.sendInviteViaChat.readCurrentAndObserve { (sendChat) in
viaChatLabel.isHidden = sendChat != true || ConferenceSchedulingViewModel.shared.scheduleForLater.value != true
viaChatLabel.isHidden = sendChat != true || ConferenceSchedulingViewModel.shared.scheduleForLater.value != true
}
// Participants
@ -191,10 +191,6 @@ import SVProgressHUD
enableCreationTimeOut = false
if (ConferenceSchedulingViewModel.shared.scheduleForLater.value == true) {
PhoneMainView.instance().pop(toView:ScheduledConferencesView.compositeDescription)
} else {
let view: ConferenceWaitingRoomFragment = self.VIEW(ConferenceWaitingRoomFragment.compositeViewDescription());
PhoneMainView.instance().pop(toView:view.compositeViewDescription())
view.setDetails(subject: pair!.second!, url: pair!.first!)
}
}
ConferenceSchedulingViewModel.shared.onErrorEvent.observe { error in

View file

@ -37,7 +37,7 @@ import UIKit
static let call_error_incompatible_media_params = NSLocalizedString("Incompatible media parameters",comment:"")
static let call_error_network_unreachable = NSLocalizedString("Network is unreachable",comment:"")
static let call_error_io_error = NSLocalizedString("Service unavailable or network error",comment:"")
static let call_error_server_timeout = NSLocalizedString("Server timeout",comment:"")
static let call_error_server_timeout = NSLocalizedString("Server error, please try again later.",comment:"")
static let call_error_temporarily_unavailable = NSLocalizedString("Temporarily unavailable",comment:"")
static let call_error_generic = NSLocalizedString("Error: %s",comment:"")
static let call_video_update_requested_dialog = NSLocalizedString("Correspondent would like to turn the video on",comment:"")
@ -109,6 +109,11 @@ import UIKit
static let conference_creation_failed = NSLocalizedString("Failed to create conference",comment:"")
static let conference_info_confirm_removal = NSLocalizedString("Do you really want to delete this conference?",comment:"")
static let conference_info_confirm_removal_delete = NSLocalizedString("Delete",comment:"")
static let conference_last_user = NSLocalizedString("All other participants have left the group call",comment:"")
static let conference_first_to_join = NSLocalizedString("You're the first to join the group call",comment:"")
// Call Stats

View file

@ -59,7 +59,6 @@ class CallData {
)
call.addDelegate(delegate: callDelegate!)
update()
initChatRoom()
}
@ -104,59 +103,6 @@ class CallData {
callState.value = call.state
}
private func initChatRoom() {
return // V1 work around
let localSipUri = Core.get().defaultAccount?.params?.identityAddress?.asStringUriOnly()
let remoteSipUri = call.remoteAddress?.asStringUriOnly()
let conference = call.conference
guard
let localSipUri = Core.get().defaultAccount?.params?.identityAddress?.asStringUriOnly(),
let remoteSipUri = call.remoteAddress?.asStringUriOnly(),
let localAddress = try?Factory.Instance.createAddress(addr: localSipUri),
let remoteSipAddress = try?Factory.Instance.createAddress(addr: remoteSipUri)
else {
Log.e("[Call] Failed to get either local \(localSipUri.orNil) or remote \(remoteSipUri.orNil) SIP address!")
return
}
do {
if let conferenceInfo = Core.get().findConferenceInformationFromUri(uri: call.remoteAddress!), let params = try?Core.get().createDefaultChatRoomParams() {
params.subject = conferenceInfo.subject
params.backend = ChatRoomBackend.FlexisipChat
params.groupEnabled = true
chatRoom = Core.get().searchChatRoom(params: params, localAddr: localAddress, remoteAddr: nil, participants: conferenceInfo.participants)
} else {
chatRoom = Core.get().searchChatRoom(params: nil, localAddr: localAddress, remoteAddr: remoteSipAddress, participants: [])
if (chatRoom == nil) {
chatRoom = Core.get().searchChatRoom(params: nil, localAddr: localAddress, remoteAddr: nil, participants: [remoteSipAddress])
}
}
if (chatRoom == nil) {
let chatRoomParams = try Core.get().createDefaultChatRoomParams()
if let conferenceInfo = Core.get().findConferenceInformationFromUri(uri: call.remoteAddress!) {
Log.w("[Call] Failed to find existing chat room with same subject & participants, creating it")
chatRoomParams.backend = ChatRoomBackend.FlexisipChat
chatRoomParams.groupEnabled = true
chatRoomParams.subject = conferenceInfo.subject
chatRoom = try?Core.get().createChatRoom(params: chatRoomParams, localAddr: localAddress, participants: conferenceInfo.participants)
} else {
Log.w("[Call] Failed to find existing chat room with same participants, creating it")
// TODO: configure chat room params
chatRoom = try?Core.get().createChatRoom(params: chatRoomParams, localAddr: localAddress, participants: [remoteSipAddress])
}
}
if (chatRoom == nil) {
Log.e("[Call] Failed to create a chat room for local address \(localSipUri) and remote address \(remoteSipUri)!")
}
} catch {
Log.e("[Call] Exception caught initiating a chat room for local address \(localSipUri) and remote address \(remoteSipUri) Error : \(error)!")
}
}
func sendDTMF(dtmf:String) {
enteredDTMF.value = enteredDTMF.value! + dtmf

View file

@ -276,7 +276,20 @@ import linphonesw
self.audioRoutesView!.isHidden = audioRoutesSelected != true
}
audioRoutesView!.alignAbove(view:controlsView,withMargin:SharedLayoutConstants.buttons_bottom_margin).centerX().done()
// First/Last to join conference :
ConferenceViewModel.shared.allParticipantsLeftEvent.observe { (allLeft) in
if (allLeft == true) {
VoipDialog.toast(message: VoipTexts.conference_last_user)
}
}
ConferenceViewModel.shared.firstToJoinEvent.observe { (first) in
if (first == true) {
VoipDialog.toast(message: VoipTexts.conference_first_to_join)
}
}
}
override func viewWillAppear(_ animated: Bool) {