Disable video calls when core.videoEnabled is false

This commit is contained in:
Benoit Martins 2025-12-18 10:42:28 +01:00
parent 4feae7fccd
commit 4c45a9bb1e
7 changed files with 121 additions and 100 deletions

View file

@ -2,6 +2,6 @@ import Foundation
public enum AppGitInfo { public enum AppGitInfo {
public static let branch = "master" public static let branch = "master"
public static let commit = "1501dae01" public static let commit = "4feae7fcc"
public static let tag = "6.1.0-alpha" public static let tag = "6.1.0-alpha"
} }

View file

@ -1956,36 +1956,38 @@ struct CallView: View {
Spacer() Spacer()
ZStack { if !SharedMainViewModel.shared.disableVideoCall {
Button { ZStack {
if optionsChangeLayout == 3 { Button {
optionsChangeLayout = 2 if optionsChangeLayout == 3 {
callViewModel.toggleVideoMode(isAudioOnlyMode: false) optionsChangeLayout = 2
} else { callViewModel.toggleVideoMode(isAudioOnlyMode: false)
callViewModel.displayMyVideo() } else {
callViewModel.displayMyVideo()
}
} label: {
HStack {
Image(callViewModel.videoDisplayed ? "video-camera" : "video-camera-slash")
.renderingMode(.template)
.resizable()
.foregroundStyle(.white)
.frame(width: 32, height: 32)
}
} }
} label: { .buttonStyle(PressedButtonStyle(buttonSize: buttonSize))
HStack { .frame(width: buttonSize, height: buttonSize)
Image(callViewModel.videoDisplayed ? "video-camera" : "video-camera-slash") .background(Color.gray500)
.renderingMode(.template) .cornerRadius(40)
.resizable() .disabled(callViewModel.isPaused || telecomManager.isPausedByRemote || telecomManager.outgoingCallStarted || optionsChangeLayout == 3)
.foregroundStyle(.white)
.frame(width: 32, height: 32) if callViewModel.isPaused || telecomManager.isPausedByRemote || telecomManager.outgoingCallStarted || optionsChangeLayout == 3 {
Color.gray600.opacity(0.8)
.cornerRadius(40)
.allowsHitTesting(false)
} }
} }
.buttonStyle(PressedButtonStyle(buttonSize: buttonSize))
.frame(width: buttonSize, height: buttonSize) .frame(width: buttonSize, height: buttonSize)
.background(Color.gray500)
.cornerRadius(40)
.disabled(callViewModel.isPaused || telecomManager.isPausedByRemote || telecomManager.outgoingCallStarted || optionsChangeLayout == 3)
if callViewModel.isPaused || telecomManager.isPausedByRemote || telecomManager.outgoingCallStarted || optionsChangeLayout == 3 {
Color.gray600.opacity(0.8)
.cornerRadius(40)
.allowsHitTesting(false)
}
} }
.frame(width: buttonSize, height: buttonSize)
Button { Button {
callViewModel.toggleMuteMicrophone() callViewModel.toggleMuteMicrophone()

View file

@ -266,23 +266,25 @@ struct MeetingWaitingRoomFragment: View {
HStack { HStack {
Spacer() Spacer()
Button { if !SharedMainViewModel.shared.disableVideoCall {
!meetingWaitingRoomViewModel.videoDisplayed Button {
? meetingWaitingRoomViewModel.enableVideoPreview() : meetingWaitingRoomViewModel.disableVideoPreview() !meetingWaitingRoomViewModel.videoDisplayed
} label: { ? meetingWaitingRoomViewModel.enableVideoPreview() : meetingWaitingRoomViewModel.disableVideoPreview()
HStack { } label: {
Image(meetingWaitingRoomViewModel.videoDisplayed ? "video-camera" : "video-camera-slash") HStack {
.renderingMode(.template) Image(meetingWaitingRoomViewModel.videoDisplayed ? "video-camera" : "video-camera-slash")
.resizable() .renderingMode(.template)
.foregroundStyle(.white) .resizable()
.frame(width: 32, height: 32) .foregroundStyle(.white)
.frame(width: 32, height: 32)
}
} }
.buttonStyle(PressedButtonStyle(buttonSize: 60))
.frame(width: 60, height: 60)
.background(Color.gray500)
.cornerRadius(40)
.padding(.horizontal, 5)
} }
.buttonStyle(PressedButtonStyle(buttonSize: 60))
.frame(width: 60, height: 60)
.background(Color.gray500)
.cornerRadius(40)
.padding(.horizontal, 5)
Button { Button {
meetingWaitingRoomViewModel.toggleMuteMicrophone() meetingWaitingRoomViewModel.toggleMuteMicrophone()

View file

@ -225,45 +225,47 @@ struct ContactInnerFragment: View {
Spacer() Spacer()
Button(action: { if !SharedMainViewModel.shared.disableVideoCall {
CoreContext.shared.doOnCoreQueue { core in Button(action: {
if contactAvatarModel.addresses.count == 1 { CoreContext.shared.doOnCoreQueue { core in
do { if contactAvatarModel.addresses.count == 1 {
let address = try Factory.Instance.createAddress(addr: contactAvatarModel.address) do {
telecomManager.doCallOrJoinConf(address: address, isVideo: true) let address = try Factory.Instance.createAddress(addr: contactAvatarModel.address)
} catch { telecomManager.doCallOrJoinConf(address: address, isVideo: true)
Log.error("[ContactInnerFragment] unable to create address for a new outgoing call : \(contactAvatarModel.address) \(error) ") } catch {
} Log.error("[ContactInnerFragment] unable to create address for a new outgoing call : \(contactAvatarModel.address) \(error) ")
} else if contactAvatarModel.addresses.count < 1 && contactAvatarModel.phoneNumbersWithLabel.count == 1 { }
if let firstPhoneNumbersWithLabel = contactAvatarModel.phoneNumbersWithLabel.first, let address = core.interpretUrl(url: firstPhoneNumbersWithLabel.phoneNumber, applyInternationalPrefix: LinphoneUtils.applyInternationalPrefix(core: core)) { } else if contactAvatarModel.addresses.count < 1 && contactAvatarModel.phoneNumbersWithLabel.count == 1 {
telecomManager.doCallOrJoinConf(address: address, isVideo: true) if let firstPhoneNumbersWithLabel = contactAvatarModel.phoneNumbersWithLabel.first, let address = core.interpretUrl(url: firstPhoneNumbersWithLabel.phoneNumber, applyInternationalPrefix: LinphoneUtils.applyInternationalPrefix(core: core)) {
} telecomManager.doCallOrJoinConf(address: address, isVideo: true)
} else { }
DispatchQueue.main.async { } else {
isShowSipAddressesPopupType = 2 DispatchQueue.main.async {
isShowSipAddressesPopup = true isShowSipAddressesPopupType = 2
isShowSipAddressesPopup = true
}
} }
} }
} }, label: {
}, label: { VStack {
VStack { HStack(alignment: .center) {
HStack(alignment: .center) { Image("video-camera")
Image("video-camera") .renderingMode(.template)
.renderingMode(.template) .resizable()
.resizable() .foregroundStyle(Color.grayMain2c600)
.foregroundStyle(Color.grayMain2c600) .frame(width: 25, height: 25)
.frame(width: 25, height: 25) }
.padding(16)
.background(Color.grayMain2c200)
.cornerRadius(40)
Text("contact_video_call_action")
.default_text_style(styleSize: 14)
} }
.padding(16) })
.background(Color.grayMain2c200)
.cornerRadius(40) Spacer()
}
Text("contact_video_call_action")
.default_text_style(styleSize: 14)
}
})
Spacer()
} }
.padding(.top, 20) .padding(.top, 20)
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)

View file

@ -283,29 +283,31 @@ struct HistoryContactFragment: View {
} }
}) })
} }
Spacer()
Button(action: { if !SharedMainViewModel.shared.disableVideoCall {
telecomManager.doCallOrJoinConf(address: historyModel.addressLinphone, isVideo: true) Spacer()
}, label: {
VStack { Button(action: {
HStack(alignment: .center) { telecomManager.doCallOrJoinConf(address: historyModel.addressLinphone, isVideo: true)
Image("video-camera") }, label: {
.renderingMode(.template) VStack {
.resizable() HStack(alignment: .center) {
.foregroundStyle(Color.grayMain2c600) Image("video-camera")
.frame(width: 25, height: 25) .renderingMode(.template)
.resizable()
.foregroundStyle(Color.grayMain2c600)
.frame(width: 25, height: 25)
}
.padding(16)
.background(Color.grayMain2c200)
.cornerRadius(40)
Text("contact_video_call_action")
.default_text_style(styleSize: 14)
.frame(minWidth: 80)
} }
.padding(16) })
.background(Color.grayMain2c200) }
.cornerRadius(40)
Text("contact_video_call_action")
.default_text_style(styleSize: 14)
.frame(minWidth: 80)
}
})
} else { } else {
Button(action: { Button(action: {
withAnimation { withAnimation {

View file

@ -48,6 +48,7 @@ class SharedMainViewModel: ObservableObject {
@Published var missedCallsCount: Int = 0 @Published var missedCallsCount: Int = 0
@Published var cardDavFriendsListsCount: Int = 0 @Published var cardDavFriendsListsCount: Int = 0
@Published var disableVideoCall: Bool = false
@Published var disableChatFeature: Bool = false @Published var disableChatFeature: Bool = false
@Published var disableMeetingFeature: Bool = false @Published var disableMeetingFeature: Bool = false
@ -95,8 +96,9 @@ class SharedMainViewModel: ObservableObject {
} }
updateMissedCallsCount() updateMissedCallsCount()
updateUnreadMessagesCount() updateDisableVideoCall()
updateDisableChatFeature() updateDisableChatFeature()
updateUnreadMessagesCount()
updateDisableMeetingFeature() updateDisableMeetingFeature()
getCardDavFriendsListsCount() getCardDavFriendsListsCount()
@ -225,6 +227,16 @@ class SharedMainViewModel: ObservableObject {
} }
} }
func updateDisableVideoCall() {
CoreContext.shared.doOnCoreQueue { core in
let disableVideoCallFeatureTmp = !core.videoEnabled
DispatchQueue.main.async {
self.disableVideoCall = disableVideoCallFeatureTmp
}
}
}
func updateDisableChatFeature() { func updateDisableChatFeature() {
CoreContext.shared.doOnCoreQueue { core in CoreContext.shared.doOnCoreQueue { core in
let disableChatFeatureTmp = CorePreferences.disableChatFeature let disableChatFeatureTmp = CorePreferences.disableChatFeature
@ -246,6 +258,7 @@ class SharedMainViewModel: ObservableObject {
} }
func updateConfigChanges() { func updateConfigChanges() {
updateDisableVideoCall()
updateDisableChatFeature() updateDisableChatFeature()
updateDisableMeetingFeature() updateDisableMeetingFeature()
} }

View file

@ -123,7 +123,7 @@
"location" : "https://gitlab.linphone.org/BC/public/linphone-sdk-swift-ios.git", "location" : "https://gitlab.linphone.org/BC/public/linphone-sdk-swift-ios.git",
"state" : { "state" : {
"branch" : "alpha", "branch" : "alpha",
"revision" : "1e266452f9e464d8d6ea8359722d9038c5f46b9d" "revision" : "e82eb03f276a3c6f4b9b4d87ca7faff5f5d42b8a"
} }
}, },
{ {