Fix media encryption state in CallView

This commit is contained in:
Benoit Martins 2026-03-18 15:05:16 +01:00
parent 1943f0f21c
commit 068d2d2902
3 changed files with 7 additions and 9 deletions

View file

@ -2,6 +2,6 @@ import Foundation
public enum AppGitInfo {
public static let branch = "master"
public static let commit = "1ffcd3e1a"
public static let commit = "1943f0f21"
public static let tag = "6.1.0-alpha"
}

View file

@ -408,7 +408,7 @@ struct CallView: View {
.zIndex(1)
} else if callViewModel.isNotEncrypted {
HStack {
Image("lock_simple")
Image("lock-simple-open")
.renderingMode(.template)
.resizable()
.foregroundStyle(.white)

View file

@ -275,7 +275,7 @@ class CallViewModel: ObservableObject {
}
}
self.callDelegate = CallDelegateStub(onEncryptionChanged: { (_: Call, _: Bool, _: String)in
self.callDelegate = CallDelegateStub(onEncryptionChanged: { (_: Call, _: Bool, _: String) in
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
self.updateEncryption(withToast: false)
}
@ -297,10 +297,6 @@ class CallViewModel: ObservableObject {
self.zrtpPopupDisplayed = true
}
}
}, onStateChanged: { (_: Call, state: Call.State, message: String) in
if let currentParamsTmp = self.currentCall?.currentParams, state == .StreamsRunning, currentParamsTmp.mediaEncryption == .None || currentParamsTmp.mediaEncryption == .SRTP {
self.updateEncryption(withToast: false)
}
}, onStatsUpdated: { (_: Call, stats: CallStats) in
DispatchQueue.main.async {
if self.currentCall != nil {
@ -994,9 +990,11 @@ class CallViewModel: ObservableObject {
self.isNotEncrypted = false
}
case MediaEncryption.None:
let isNotEncryptedTmp = self.currentCall?.state == .StreamsRunning && !self.telecomManager.outgoingCallStarted
let isMediaEncryptedTmp = self.currentCall?.params?.mediaEncryption != .None && self.currentCall?.params?.mediaEncryption != .ZRTP
let isNotEncryptedTmp = self.currentCall?.params?.mediaEncryption == .None
DispatchQueue.main.async {
self.isMediaEncrypted = false
self.isMediaEncrypted = isMediaEncryptedTmp
self.isZrtp = false
self.isNotEncrypted = isNotEncryptedTmp
}