mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
Fix display of multiple calls
This commit is contained in:
parent
bdd38a80b6
commit
b5e3f72cf6
6 changed files with 35 additions and 17 deletions
|
|
@ -222,13 +222,18 @@ extension ProviderDelegate: CXProviderDelegate {
|
|||
|
||||
let call = core.getCallByCallid(callId: callId)
|
||||
|
||||
let callLogIsNil = call?.callLog != nil
|
||||
|
||||
let videoEnabledTmp = call?.params?.videoEnabled
|
||||
let wasConferenceTmp = call?.callLog?.wasConference()
|
||||
|
||||
DispatchQueue.main.async {
|
||||
if UIApplication.shared.applicationState != .active {
|
||||
TelecomManager.shared.backgroundContextCall = call
|
||||
if call?.callLog != nil {
|
||||
TelecomManager.shared.backgroundContextCameraIsEnabled = call?.params?.videoEnabled == true || call?.callLog?.wasConference() == true
|
||||
if callLogIsNil {
|
||||
TelecomManager.shared.backgroundContextCameraIsEnabled = videoEnabledTmp == true || wasConferenceTmp == true
|
||||
} else {
|
||||
TelecomManager.shared.backgroundContextCameraIsEnabled = call?.params?.videoEnabled == true
|
||||
TelecomManager.shared.backgroundContextCameraIsEnabled = videoEnabledTmp == true
|
||||
}
|
||||
|
||||
if #available(iOS 16.0, *) {
|
||||
|
|
|
|||
|
|
@ -319,6 +319,15 @@ class TelecomManager: ObservableObject {
|
|||
DispatchQueue.main.async {
|
||||
self.callStarted = true
|
||||
self.isNotVerifiedCounter = 0
|
||||
if self.callDisplayed {
|
||||
self.callDisplayed = core.calls.count <= 1
|
||||
}
|
||||
}
|
||||
|
||||
if core.calls.count > 1 {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
||||
self.callDisplayed = true
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
Log.error("accept call failed \(error)")
|
||||
|
|
|
|||
|
|
@ -1915,7 +1915,7 @@ struct CallView: View {
|
|||
if callViewModel.isOneOneCall {
|
||||
VStack {
|
||||
Button {
|
||||
if callViewModel.calls.count < 2 {
|
||||
if callViewModel.callsCounter < 2 {
|
||||
withAnimation {
|
||||
callViewModel.isTransferInsteadCall = true
|
||||
MagicSearchSingleton.shared.searchForSuggestions()
|
||||
|
|
@ -1938,7 +1938,7 @@ struct CallView: View {
|
|||
.background(Color.gray500)
|
||||
.cornerRadius(40)
|
||||
|
||||
Text(callViewModel.calls.count < 2 ? "Transfer" : "Attended transfer")
|
||||
Text(callViewModel.callsCounter < 2 ? "Transfer" : "Attended transfer")
|
||||
.foregroundStyle(.white)
|
||||
.default_text_style(styleSize: 15)
|
||||
}
|
||||
|
|
@ -2039,13 +2039,13 @@ struct CallView: View {
|
|||
.background(Color.gray500)
|
||||
.cornerRadius(40)
|
||||
|
||||
if callViewModel.calls.count > 1 {
|
||||
if callViewModel.callsCounter > 1 {
|
||||
VStack {
|
||||
HStack {
|
||||
Spacer()
|
||||
|
||||
VStack {
|
||||
Text("\(callViewModel.calls.count)")
|
||||
Text("\(callViewModel.callsCounter)")
|
||||
.foregroundStyle(.white)
|
||||
.default_text_style(styleSize: 15)
|
||||
}
|
||||
|
|
@ -2261,7 +2261,7 @@ struct CallView: View {
|
|||
.background(Color.gray500)
|
||||
.cornerRadius(40)
|
||||
|
||||
Text(callViewModel.calls.count < 2 ? "Transfer" : "Attended transfer")
|
||||
Text(callViewModel.callsCounter < 2 ? "Transfer" : "Attended transfer")
|
||||
.foregroundStyle(.white)
|
||||
.default_text_style(styleSize: 15)
|
||||
}
|
||||
|
|
@ -2365,13 +2365,13 @@ struct CallView: View {
|
|||
.background(Color.gray500)
|
||||
.cornerRadius(40)
|
||||
|
||||
if callViewModel.calls.count > 1 {
|
||||
if callViewModel.callsCounter > 1 {
|
||||
VStack {
|
||||
HStack {
|
||||
Spacer()
|
||||
|
||||
VStack {
|
||||
Text("\(callViewModel.calls.count)")
|
||||
Text("\(callViewModel.callsCounter)")
|
||||
.foregroundStyle(.white)
|
||||
.default_text_style(styleSize: 15)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -327,7 +327,7 @@ struct CallsListFragment: View {
|
|||
.listStyle(.plain)
|
||||
.overlay(
|
||||
VStack {
|
||||
if callViewModel.calls.isEmpty {
|
||||
if callViewModel.callsCounter == 0 {
|
||||
Spacer()
|
||||
Image("illus-belledonne")
|
||||
.resizable()
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ class CallViewModel: ObservableObject {
|
|||
private var mConferenceSuscriptions = Set<AnyCancellable?>()
|
||||
|
||||
@Published var calls: [Call] = []
|
||||
@Published var callsCounter: Int = 0
|
||||
@Published var callsContactAvatarModel: [ContactAvatarModel?] = []
|
||||
|
||||
let timer = Timer.publish(every: 1, on: .main, in: .common).autoconnect()
|
||||
|
|
@ -106,10 +107,11 @@ class CallViewModel: ObservableObject {
|
|||
coreContext.doOnCoreQueue { core in
|
||||
if core.currentCall != nil && core.currentCall!.remoteAddress != nil {
|
||||
self.currentCall = core.currentCall
|
||||
|
||||
self.callSuscriptions.removeAll()
|
||||
self.mConferenceSuscriptions.removeAll()
|
||||
|
||||
let callsCounterTmp = core.calls.count
|
||||
|
||||
var videoDisplayedTmp = false
|
||||
do {
|
||||
let params = try core.createCallParams(call: self.currentCall)
|
||||
|
|
@ -221,6 +223,8 @@ class CallViewModel: ObservableObject {
|
|||
|
||||
self.getCallsList()
|
||||
|
||||
self.callsCounter = callsCounterTmp
|
||||
|
||||
if self.currentCall?.conference?.state == .Created {
|
||||
self.getConference()
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ struct ContentView: View {
|
|||
|
||||
GeometryReader { geometry in
|
||||
VStack(spacing: 0) {
|
||||
if telecomManager.callInProgress && !fullscreenVideo && ((!telecomManager.callDisplayed && callViewModel.calls.count == 1) || callViewModel.calls.count > 1) {
|
||||
if telecomManager.callInProgress && !fullscreenVideo && ((!telecomManager.callDisplayed && callViewModel.callsCounter == 1) || callViewModel.callsCounter > 1) {
|
||||
HStack {
|
||||
Image("phone")
|
||||
.renderingMode(.template)
|
||||
|
|
@ -82,8 +82,8 @@ struct ContentView: View {
|
|||
.frame(width: 26, height: 26)
|
||||
.padding(.leading, 10)
|
||||
|
||||
if callViewModel.calls.count > 1 {
|
||||
Text("\(callViewModel.calls.count) appels")
|
||||
if callViewModel.callsCounter > 1 {
|
||||
Text("\(callViewModel.callsCounter) appels")
|
||||
.default_text_style_white(styleSize: 16)
|
||||
} else {
|
||||
Text("\(callViewModel.displayName)")
|
||||
|
|
@ -92,7 +92,7 @@ struct ContentView: View {
|
|||
|
||||
Spacer()
|
||||
|
||||
if callViewModel.calls.count == 1 {
|
||||
if callViewModel.callsCounter == 1 {
|
||||
Text("\(callViewModel.isPaused || telecomManager.isPausedByRemote ? "En pause" : "Actif")")
|
||||
.default_text_style_white(styleSize: 16)
|
||||
.padding(.trailing, 10)
|
||||
|
|
@ -1024,7 +1024,7 @@ struct ContentView: View {
|
|||
.onAppear {
|
||||
UIApplication.shared.isIdleTimerDisabled = true
|
||||
callViewModel.resetCallView()
|
||||
if callViewModel.calls.count >= 1 {
|
||||
if callViewModel.callsCounter >= 1 {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
|
||||
callViewModel.resetCallView()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue