Joining the waiting room when calling a conference

This commit is contained in:
Benoit Martins 2024-05-14 10:32:24 +02:00
parent 14daf5bd40
commit 5beb5c088c
9 changed files with 32 additions and 57 deletions

View file

@ -162,6 +162,21 @@ class TelecomManager: ObservableObject {
}
}
func doCallOrJoinConf(address: Address, isVideo: Bool = false, isConference: Bool = false) {
if address.asStringUriOnly().hasPrefix("sip:conference-focus@sip.linphone.org") {
do {
let meetingAddress = try Factory.Instance.createAddress(addr: address.asStringUriOnly())
meetingWaitingRoomDisplayed = true
meetingWaitingRoomSelected = meetingAddress
} catch {}
} else {
doCallWithCore(
addr: address, isVideo: isVideo, isConference: isConference
)
}
}
func doCallWithCore(addr: Address, isVideo: Bool, isConference: Bool) {
CoreContext.shared.doOnCoreQueue { core in
do {

View file

@ -93,9 +93,7 @@ struct ContactInnerActionsFragment: View {
.background(.white)
.onTapGesture {
withAnimation {
telecomManager.doCallWithCore(
addr: contactsManager.lastSearch[contactViewModel.indexDisplayedFriend!].friend!.addresses[index], isVideo: false, isConference: false
)
telecomManager.doCallOrJoinConf(address: contactsManager.lastSearch[contactViewModel.indexDisplayedFriend!].friend!.addresses[index])
}
}
.onLongPressGesture(minimumDuration: 0.2) {

View file

@ -158,7 +158,7 @@ struct ContactInnerFragment: View {
Spacer()
Button(action: {
telecomManager.doCallWithCore(addr: contactsManager.lastSearch[contactViewModel.indexDisplayedFriend!].friend!.address!, isVideo: false, isConference: false)
telecomManager.doCallOrJoinConf(address: contactsManager.lastSearch[contactViewModel.indexDisplayedFriend!].friend!.address!)
}, label: {
VStack {
HStack(alignment: .center) {
@ -208,7 +208,7 @@ struct ContactInnerFragment: View {
Spacer()
Button(action: {
telecomManager.doCallWithCore(addr: contactsManager.lastSearch[contactViewModel.indexDisplayedFriend!].friend!.address!, isVideo: true, isConference: false)
telecomManager.doCallOrJoinConf(address: contactsManager.lastSearch[contactViewModel.indexDisplayedFriend!].friend!.address!, isVideo: true)
}, label: {
VStack {
HStack(alignment: .center) {

View file

@ -74,13 +74,13 @@ struct ChatBubbleView: View {
.if(result.1 < geometryProxy.size.height/2) { view in
view.frame(maxHeight: result.1)
}
.if(result.0 >= result.1 && result.0 >= geometryProxy.size.width - 110 && result.1 >= geometryProxy.size.height/2.5) { view in
.if(result.0 >= result.1 && geometryProxy.size.width > 0 && result.0 >= geometryProxy.size.width - 110 && result.1 >= geometryProxy.size.height/2.5) { view in
view.frame(
maxWidth: geometryProxy.size.width - 110,
maxHeight: result.1 * ((geometryProxy.size.width - 110) / result.0)
)
}
.if(result.0 < result.1 && result.1 >= geometryProxy.size.height/2.5) { view in
.if(result.0 < result.1 && geometryProxy.size.width > 0 && result.1 >= geometryProxy.size.height/2.5) { view in
view.frame(
maxWidth: result.0 * ((geometryProxy.size.height/2.5) / result.1),
maxHeight: geometryProxy.size.height/2.5

View file

@ -128,9 +128,7 @@ class ConversationModel: ObservableObject {
func call() {
coreContext.doOnCoreQueue { _ in
if self.chatRoom.peerAddress != nil {
TelecomManager.shared.doCallWithCore(
addr: self.chatRoom.peerAddress!, isVideo: false, isConference: false
)
TelecomManager.shared.doCallOrJoinConf(address: self.chatRoom.peerAddress!)
}
}
}

View file

@ -451,7 +451,7 @@ struct DialerBottomSheet: View {
if !startCallViewModel.searchField.isEmpty {
do {
let address = try Factory.Instance.createAddress(addr: String("sip:" + startCallViewModel.searchField + "@" + startCallViewModel.domain))
telecomManager.doCallWithCore(addr: address, isVideo: false, isConference: false)
telecomManager.doCallOrJoinConf(address: address)
} catch {
}

View file

@ -413,13 +413,9 @@ struct HistoryContactFragment: View {
if historyViewModel.displayedCallIsConference.isEmpty {
Button(action: {
if historyViewModel.displayedCall!.dir == .Outgoing && historyViewModel.displayedCall!.toAddress != nil {
telecomManager.doCallWithCore(
addr: historyViewModel.displayedCall!.toAddress!, isVideo: false, isConference: false
)
telecomManager.doCallOrJoinConf(address: historyViewModel.displayedCall!.toAddress!)
} else if historyViewModel.displayedCall!.dir == .Incoming && historyViewModel.displayedCall!.fromAddress != nil {
telecomManager.doCallWithCore(
addr: historyViewModel.displayedCall!.fromAddress!, isVideo: false, isConference: false
)
telecomManager.doCallOrJoinConf(address: historyViewModel.displayedCall!.fromAddress!)
}
}, label: {
VStack {
@ -473,13 +469,9 @@ struct HistoryContactFragment: View {
Button(action: {
if historyViewModel.displayedCall!.dir == .Outgoing && historyViewModel.displayedCall!.toAddress != nil {
telecomManager.doCallWithCore(
addr: historyViewModel.displayedCall!.toAddress!, isVideo: true, isConference: false
)
telecomManager.doCallOrJoinConf(address: historyViewModel.displayedCall!.toAddress!, isVideo: true)
} else if historyViewModel.displayedCall!.dir == .Incoming && historyViewModel.displayedCall!.fromAddress != nil {
telecomManager.doCallWithCore(
addr: historyViewModel.displayedCall!.fromAddress!, isVideo: true, isConference: false
)
telecomManager.doCallOrJoinConf(address: historyViewModel.displayedCall!.fromAddress!, isVideo: true)
}
}, label: {
VStack {
@ -511,9 +503,7 @@ struct HistoryContactFragment: View {
telecomManager.meetingWaitingRoomSelected = meetingAddress
} catch {}
} else {
telecomManager.doCallWithCore(
addr: historyViewModel.displayedCall!.toAddress!, isVideo: false, isConference: false
)
telecomManager.doCallOrJoinConf(address: historyViewModel.displayedCall!.toAddress!)
}
} else if historyViewModel.displayedCall!.fromAddress != nil {
if historyViewModel.displayedCall!.fromAddress!.asStringUriOnly().hasPrefix("sip:conference-focus@sip.linphone.org") {
@ -524,9 +514,7 @@ struct HistoryContactFragment: View {
telecomManager.meetingWaitingRoomSelected = meetingAddress
} catch {}
} else {
telecomManager.doCallWithCore(
addr: historyViewModel.displayedCall!.fromAddress!, isVideo: false, isConference: false
)
telecomManager.doCallOrJoinConf(address: historyViewModel.displayedCall!.fromAddress!)
}
}
}

View file

@ -257,31 +257,9 @@ struct HistoryListFragment: View {
func doCall(index: Int) {
if historyListViewModel.callLogs[index].dir == .Outgoing && historyListViewModel.callLogs[index].toAddress != nil {
if historyListViewModel.callLogs[index].toAddress!.asStringUriOnly().hasPrefix("sip:conference-focus@sip.linphone.org") {
do {
let meetingAddress = try Factory.Instance.createAddress(addr: historyListViewModel.callLogs[index].toAddress!.asStringUriOnly())
telecomManager.meetingWaitingRoomDisplayed = true
telecomManager.meetingWaitingRoomSelected = meetingAddress
} catch {}
} else {
telecomManager.doCallWithCore(
addr: historyListViewModel.callLogs[index].toAddress!, isVideo: false, isConference: false
)
}
telecomManager.doCallOrJoinConf(address: historyListViewModel.callLogs[index].toAddress!)
} else if historyListViewModel.callLogs[index].fromAddress != nil {
if historyListViewModel.callLogs[index].fromAddress!.asStringUriOnly().hasPrefix("sip:conference-focus@sip.linphone.org") {
do {
let meetingAddress = try Factory.Instance.createAddress(addr: historyListViewModel.callLogs[index].fromAddress!.asStringUriOnly())
telecomManager.meetingWaitingRoomDisplayed = true
telecomManager.meetingWaitingRoomSelected = meetingAddress
} catch {}
} else {
telecomManager.doCallWithCore(
addr: historyListViewModel.callLogs[index].fromAddress!, isVideo: false, isConference: false
)
}
telecomManager.doCallOrJoinConf(address: historyListViewModel.callLogs[index].fromAddress!)
}
}
}

View file

@ -219,7 +219,7 @@ struct StartCallFragment: View {
withAnimation {
isShowStartCallFragment.toggle()
telecomManager.doCallWithCore(addr: addr, isVideo: false, isConference: false)
telecomManager.doCallOrJoinConf(address: addr)
}
}
})
@ -304,9 +304,7 @@ struct StartCallFragment: View {
withAnimation {
isShowStartCallFragment.toggle()
if contactsManager.lastSearchSuggestions[index].address != nil {
telecomManager.doCallWithCore(
addr: contactsManager.lastSearchSuggestions[index].address!, isVideo: false, isConference: false
)
telecomManager.doCallOrJoinConf(address: contactsManager.lastSearchSuggestions[index].address!)
}
}
}