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 static let branch = "master"
public static let commit = "1501dae01"
public static let commit = "4feae7fcc"
public static let tag = "6.1.0-alpha"
}

View file

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

View file

@ -266,23 +266,25 @@ struct MeetingWaitingRoomFragment: View {
HStack {
Spacer()
Button {
!meetingWaitingRoomViewModel.videoDisplayed
? meetingWaitingRoomViewModel.enableVideoPreview() : meetingWaitingRoomViewModel.disableVideoPreview()
} label: {
HStack {
Image(meetingWaitingRoomViewModel.videoDisplayed ? "video-camera" : "video-camera-slash")
.renderingMode(.template)
.resizable()
.foregroundStyle(.white)
.frame(width: 32, height: 32)
if !SharedMainViewModel.shared.disableVideoCall {
Button {
!meetingWaitingRoomViewModel.videoDisplayed
? meetingWaitingRoomViewModel.enableVideoPreview() : meetingWaitingRoomViewModel.disableVideoPreview()
} label: {
HStack {
Image(meetingWaitingRoomViewModel.videoDisplayed ? "video-camera" : "video-camera-slash")
.renderingMode(.template)
.resizable()
.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 {
meetingWaitingRoomViewModel.toggleMuteMicrophone()

View file

@ -225,45 +225,47 @@ struct ContactInnerFragment: View {
Spacer()
Button(action: {
CoreContext.shared.doOnCoreQueue { core in
if contactAvatarModel.addresses.count == 1 {
do {
let address = try Factory.Instance.createAddress(addr: contactAvatarModel.address)
telecomManager.doCallOrJoinConf(address: address, isVideo: true)
} 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)) {
telecomManager.doCallOrJoinConf(address: address, isVideo: true)
}
} else {
DispatchQueue.main.async {
isShowSipAddressesPopupType = 2
isShowSipAddressesPopup = true
if !SharedMainViewModel.shared.disableVideoCall {
Button(action: {
CoreContext.shared.doOnCoreQueue { core in
if contactAvatarModel.addresses.count == 1 {
do {
let address = try Factory.Instance.createAddress(addr: contactAvatarModel.address)
telecomManager.doCallOrJoinConf(address: address, isVideo: true)
} 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)) {
telecomManager.doCallOrJoinConf(address: address, isVideo: true)
}
} else {
DispatchQueue.main.async {
isShowSipAddressesPopupType = 2
isShowSipAddressesPopup = true
}
}
}
}
}, label: {
VStack {
HStack(alignment: .center) {
Image("video-camera")
.renderingMode(.template)
.resizable()
.foregroundStyle(Color.grayMain2c600)
.frame(width: 25, height: 25)
}, label: {
VStack {
HStack(alignment: .center) {
Image("video-camera")
.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)
}
.padding(16)
.background(Color.grayMain2c200)
.cornerRadius(40)
})
Text("contact_video_call_action")
.default_text_style(styleSize: 14)
}
})
Spacer()
Spacer()
}
}
.padding(.top, 20)
.frame(maxWidth: .infinity)

View file

@ -284,28 +284,30 @@ struct HistoryContactFragment: View {
})
}
Spacer()
if !SharedMainViewModel.shared.disableVideoCall {
Spacer()
Button(action: {
telecomManager.doCallOrJoinConf(address: historyModel.addressLinphone, isVideo: true)
}, label: {
VStack {
HStack(alignment: .center) {
Image("video-camera")
.renderingMode(.template)
.resizable()
.foregroundStyle(Color.grayMain2c600)
.frame(width: 25, height: 25)
Button(action: {
telecomManager.doCallOrJoinConf(address: historyModel.addressLinphone, isVideo: true)
}, label: {
VStack {
HStack(alignment: .center) {
Image("video-camera")
.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 {
Button(action: {
withAnimation {

View file

@ -48,6 +48,7 @@ class SharedMainViewModel: ObservableObject {
@Published var missedCallsCount: Int = 0
@Published var cardDavFriendsListsCount: Int = 0
@Published var disableVideoCall: Bool = false
@Published var disableChatFeature: Bool = false
@Published var disableMeetingFeature: Bool = false
@ -95,8 +96,9 @@ class SharedMainViewModel: ObservableObject {
}
updateMissedCallsCount()
updateUnreadMessagesCount()
updateDisableVideoCall()
updateDisableChatFeature()
updateUnreadMessagesCount()
updateDisableMeetingFeature()
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() {
CoreContext.shared.doOnCoreQueue { core in
let disableChatFeatureTmp = CorePreferences.disableChatFeature
@ -246,6 +258,7 @@ class SharedMainViewModel: ObservableObject {
}
func updateConfigChanges() {
updateDisableVideoCall()
updateDisableChatFeature()
updateDisableMeetingFeature()
}

View file

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