mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
40 lines
1.1 KiB
Swift
40 lines
1.1 KiB
Swift
import SyncCore
|
|
|
|
public struct VideoCallsConfiguration: Equatable {
|
|
public enum VideoCallsSupport {
|
|
case disabled
|
|
case full
|
|
case onlyVideo
|
|
}
|
|
|
|
public var videoCallsSupport: VideoCallsSupport
|
|
|
|
public init(appConfiguration: AppConfiguration) {
|
|
var videoCallsSupport: VideoCallsSupport = .full
|
|
if let data = appConfiguration.data, let value = data["video_calls_support"] as? String {
|
|
switch value {
|
|
case "disabled":
|
|
videoCallsSupport = .disabled
|
|
case "full":
|
|
videoCallsSupport = .full
|
|
case "only_video":
|
|
videoCallsSupport = .onlyVideo
|
|
default:
|
|
videoCallsSupport = .full
|
|
}
|
|
}
|
|
self.videoCallsSupport = videoCallsSupport
|
|
}
|
|
}
|
|
|
|
public extension VideoCallsConfiguration {
|
|
var areVideoCallsEnabled: Bool {
|
|
switch self.videoCallsSupport {
|
|
case .disabled:
|
|
return false
|
|
case .full, .onlyVideo:
|
|
return true
|
|
}
|
|
}
|
|
}
|