From cfe3bef32d1287a4b36370ab5f3389f25a605921 Mon Sep 17 00:00:00 2001 From: Benoit Martins Date: Thu, 2 May 2024 15:38:55 +0200 Subject: [PATCH] Add green call banner --- Linphone/Localizable.xcstrings | 6 ++++++ Linphone/TelecomManager/TelecomManager.swift | 3 +++ .../UI/Call/ViewModel/CallViewModel.swift | 3 +-- Linphone/UI/Main/ContentView.swift | 21 +++++++++++++++++++ 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/Linphone/Localizable.xcstrings b/Linphone/Localizable.xcstrings index b94e6b17d..1a8f779e2 100644 --- a/Linphone/Localizable.xcstrings +++ b/Linphone/Localizable.xcstrings @@ -48,6 +48,9 @@ }, "#" : { + }, + "%@" : { + }, "%lld" : { @@ -61,6 +64,9 @@ } } } + }, + "%lld appels" : { + }, "%lld Book (Example)" : { "extractionState" : "manual", diff --git a/Linphone/TelecomManager/TelecomManager.swift b/Linphone/TelecomManager/TelecomManager.swift index e6b01dcf9..b51064db2 100644 --- a/Linphone/TelecomManager/TelecomManager.swift +++ b/Linphone/TelecomManager/TelecomManager.swift @@ -113,6 +113,9 @@ class TelecomManager: ObservableObject { setHeldOtherCalls(core: core, exceptCallid: "") requestTransaction(transaction, action: "startCall") + withAnimation { + self.callDisplayed = true + } } else { try doCall(core: core, addr: addr!, isSas: isSas, isVideo: isVideo, isConference: isConference) } diff --git a/Linphone/UI/Call/ViewModel/CallViewModel.swift b/Linphone/UI/Call/ViewModel/CallViewModel.swift index a1848c03e..cb959a89d 100644 --- a/Linphone/UI/Call/ViewModel/CallViewModel.swift +++ b/Linphone/UI/Call/ViewModel/CallViewModel.swift @@ -61,7 +61,7 @@ class CallViewModel: ObservableObject { private var mConferenceSuscriptions = Set() - var calls: [Call] = [] + @Published var calls: [Call] = [] let timer = Timer.publish(every: 1, on: .main, in: .common).autoconnect() @@ -996,7 +996,6 @@ class CallViewModel: ObservableObject { default: "cell-signal-none" } - print("iconiconicon \(icon) \(self.currentCall!.currentQuality)") DispatchQueue.main.async { self.qualityValue = quality self.qualityIcon = icon diff --git a/Linphone/UI/Main/ContentView.swift b/Linphone/UI/Main/ContentView.swift index c67e8f111..a86ce15f5 100644 --- a/Linphone/UI/Main/ContentView.swift +++ b/Linphone/UI/Main/ContentView.swift @@ -73,7 +73,28 @@ struct ContentView: View { VStack(spacing: 0) { if telecomManager.callInProgress && !fullscreenVideo && ((!telecomManager.callDisplayed && callViewModel.calls.count == 1) || callViewModel.calls.count > 1) { HStack { + Image("phone") + .renderingMode(.template) + .resizable() + .foregroundStyle(.white) + .frame(width: 26, height: 26) + .padding(.leading, 10) + if callViewModel.calls.count > 1 { + Text("\(callViewModel.calls.count) appels") + .default_text_style_white(styleSize: 16) + } else { + Text("\(callViewModel.displayName)") + .default_text_style_white(styleSize: 16) + } + + Spacer() + + if callViewModel.calls.count == 1 { + Text("\(callViewModel.isPaused || telecomManager.isPausedByRemote ? "En pause" : "Actif")") + .default_text_style_white(styleSize: 16) + .padding(.trailing, 10) + } } .frame(maxWidth: .infinity) .frame(height: 30)