mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-01-22 03:58:47 +00:00
Add reference calls selection
This commit is contained in:
@@ -73,6 +73,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
||||
case playerEmbedding(Bool)
|
||||
case playlistPlayback(Bool)
|
||||
case videoCalls(Bool)
|
||||
case videoCallsReference(Bool)
|
||||
case videoCallsInfo(PresentationTheme, String)
|
||||
case hostInfo(PresentationTheme, String)
|
||||
case versionInfo(PresentationTheme)
|
||||
@@ -89,7 +90,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
||||
return DebugControllerSection.experiments.rawValue
|
||||
case .clearTips, .reimport, .resetData, .resetDatabase, .resetHoles, .reindexUnread, .resetBiometricsData, .optimizeDatabase, .photoPreview, .knockoutWallpaper, .alternativeFolderTabs, .playerEmbedding, .playlistPlayback:
|
||||
return DebugControllerSection.experiments.rawValue
|
||||
case .videoCalls, .videoCallsInfo:
|
||||
case .videoCalls, .videoCallsReference, .videoCallsInfo:
|
||||
return DebugControllerSection.videoExperiments.rawValue
|
||||
case .hostInfo, .versionInfo:
|
||||
return DebugControllerSection.info.rawValue
|
||||
@@ -150,12 +151,14 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
||||
return 25
|
||||
case .videoCalls:
|
||||
return 26
|
||||
case .videoCallsInfo:
|
||||
case .videoCallsReference:
|
||||
return 27
|
||||
case .hostInfo:
|
||||
case .videoCallsInfo:
|
||||
return 28
|
||||
case .versionInfo:
|
||||
case .hostInfo:
|
||||
return 29
|
||||
case .versionInfo:
|
||||
return 30
|
||||
}
|
||||
}
|
||||
|
||||
@@ -583,6 +586,16 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
||||
})
|
||||
}).start()
|
||||
})
|
||||
case let .videoCallsReference(value):
|
||||
return ItemListSwitchItem(presentationData: presentationData, title: "Reference Implementation", value: value, sectionId: self.section, style: .blocks, updated: { value in
|
||||
let _ = arguments.sharedContext.accountManager.transaction ({ transaction in
|
||||
transaction.updateSharedData(ApplicationSpecificSharedDataKeys.experimentalUISettings, { settings in
|
||||
var settings = settings as? ExperimentalUISettings ?? ExperimentalUISettings.defaultSettings
|
||||
settings.videoCallsReference = value
|
||||
return settings
|
||||
})
|
||||
}).start()
|
||||
})
|
||||
case let .videoCallsInfo(_, text):
|
||||
return ItemListTextItem(presentationData: presentationData, text: .plain(text), sectionId: self.section)
|
||||
case let .hostInfo(theme, string):
|
||||
@@ -631,6 +644,9 @@ private func debugControllerEntries(presentationData: PresentationData, loggingS
|
||||
entries.append(.playerEmbedding(experimentalSettings.playerEmbedding))
|
||||
entries.append(.playlistPlayback(experimentalSettings.playlistPlayback))
|
||||
entries.append(.videoCalls(experimentalSettings.videoCalls))
|
||||
if experimentalSettings.videoCalls {
|
||||
entries.append(.videoCallsReference(experimentalSettings.videoCallsReference))
|
||||
}
|
||||
entries.append(.videoCallsInfo(presentationData.theme, "Enables experimental transmission of electromagnetic radiation synchronized with pressure waves. Needs to be enabled on both sides."))
|
||||
|
||||
if let backupHostOverride = networkSettings?.backupHostOverride {
|
||||
|
||||
@@ -117,8 +117,8 @@ public final class PresentationCallManagerImpl: PresentationCallManager {
|
||||
return OngoingCallContext.maxLayer
|
||||
}
|
||||
|
||||
public static func voipVersions(includeExperimental: Bool) -> [String] {
|
||||
return OngoingCallContext.versions(includeExperimental: includeExperimental)
|
||||
public static func voipVersions(includeExperimental: Bool, includeReference: Bool) -> [String] {
|
||||
return OngoingCallContext.versions(includeExperimental: includeExperimental, includeReference: includeReference)
|
||||
}
|
||||
|
||||
public init(accountManager: AccountManager, enableVideoCalls: Bool, getDeviceAccessData: @escaping () -> (presentationData: PresentationData, present: (ViewController, Any?) -> Void, openSettings: () -> Void), isMediaPlaying: @escaping () -> Bool, resumeMediaPlayback: @escaping () -> Void, audioSession: ManagedAudioSession, activeAccounts: Signal<[Account], NoError>) {
|
||||
|
||||
@@ -251,7 +251,7 @@ public final class AccountContextImpl: AccountContext {
|
||||
self.experimentalUISettingsDisposable = (sharedContext.accountManager.sharedData(keys: [ApplicationSpecificSharedDataKeys.experimentalUISettings])
|
||||
|> deliverOnMainQueue).start(next: { sharedData in
|
||||
if let settings = sharedData.entries[ApplicationSpecificSharedDataKeys.experimentalUISettings] as? ExperimentalUISettings {
|
||||
account.callSessionManager.updateVersions(versions: PresentationCallManagerImpl.voipVersions(includeExperimental: settings.videoCalls))
|
||||
account.callSessionManager.updateVersions(versions: PresentationCallManagerImpl.voipVersions(includeExperimental: settings.videoCalls, includeReference: settings.videoCallsReference))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -401,7 +401,7 @@ final class SharedApplicationContext {
|
||||
}
|
||||
}
|
||||
|
||||
let networkArguments = NetworkInitializationArguments(apiId: apiId, apiHash: apiHash, languagesCategory: languagesCategory, appVersion: appVersion, voipMaxLayer: PresentationCallManagerImpl.voipMaxLayer, voipVersions: PresentationCallManagerImpl.voipVersions(includeExperimental: false), appData: self.deviceToken.get()
|
||||
let networkArguments = NetworkInitializationArguments(apiId: apiId, apiHash: apiHash, languagesCategory: languagesCategory, appVersion: appVersion, voipMaxLayer: PresentationCallManagerImpl.voipMaxLayer, voipVersions: PresentationCallManagerImpl.voipVersions(includeExperimental: false, includeReference: false), appData: self.deviceToken.get()
|
||||
|> map { token in
|
||||
let data = buildConfig.bundleData(withAppToken: token, signatureDict: signatureDict)
|
||||
if let data = data, let jsonString = String(data: data, encoding: .utf8) {
|
||||
|
||||
@@ -10,6 +10,7 @@ public struct ExperimentalUISettings: Equatable, PreferencesEntry {
|
||||
public var knockoutWallpaper: Bool
|
||||
public var foldersTabAtBottom: Bool
|
||||
public var videoCalls: Bool
|
||||
public var videoCallsReference: Bool
|
||||
public var playerEmbedding: Bool
|
||||
public var playlistPlayback: Bool
|
||||
|
||||
@@ -22,6 +23,7 @@ public struct ExperimentalUISettings: Equatable, PreferencesEntry {
|
||||
knockoutWallpaper: false,
|
||||
foldersTabAtBottom: false,
|
||||
videoCalls: false,
|
||||
videoCallsReference: true,
|
||||
playerEmbedding: false,
|
||||
playlistPlayback: false
|
||||
)
|
||||
@@ -35,6 +37,7 @@ public struct ExperimentalUISettings: Equatable, PreferencesEntry {
|
||||
knockoutWallpaper: Bool,
|
||||
foldersTabAtBottom: Bool,
|
||||
videoCalls: Bool,
|
||||
videoCallsReference: Bool,
|
||||
playerEmbedding: Bool,
|
||||
playlistPlayback: Bool
|
||||
) {
|
||||
@@ -45,6 +48,7 @@ public struct ExperimentalUISettings: Equatable, PreferencesEntry {
|
||||
self.knockoutWallpaper = knockoutWallpaper
|
||||
self.foldersTabAtBottom = foldersTabAtBottom
|
||||
self.videoCalls = videoCalls
|
||||
self.videoCallsReference = videoCallsReference
|
||||
self.playerEmbedding = playerEmbedding
|
||||
self.playlistPlayback = playlistPlayback
|
||||
}
|
||||
@@ -57,6 +61,7 @@ public struct ExperimentalUISettings: Equatable, PreferencesEntry {
|
||||
self.knockoutWallpaper = decoder.decodeInt32ForKey("knockoutWallpaper", orElse: 0) != 0
|
||||
self.foldersTabAtBottom = decoder.decodeInt32ForKey("foldersTabAtBottom", orElse: 0) != 0
|
||||
self.videoCalls = decoder.decodeInt32ForKey("videoCalls", orElse: 0) != 0
|
||||
self.videoCallsReference = decoder.decodeInt32ForKey("videoCallsReference", orElse: 1) != 0
|
||||
self.playerEmbedding = decoder.decodeInt32ForKey("playerEmbedding", orElse: 0) != 0
|
||||
self.playlistPlayback = decoder.decodeInt32ForKey("playlistPlayback", orElse: 0) != 0
|
||||
}
|
||||
@@ -69,6 +74,7 @@ public struct ExperimentalUISettings: Equatable, PreferencesEntry {
|
||||
encoder.encodeInt32(self.knockoutWallpaper ? 1 : 0, forKey: "knockoutWallpaper")
|
||||
encoder.encodeInt32(self.foldersTabAtBottom ? 1 : 0, forKey: "foldersTabAtBottom")
|
||||
encoder.encodeInt32(self.videoCalls ? 1 : 0, forKey: "videoCalls")
|
||||
encoder.encodeInt32(self.videoCallsReference ? 1 : 0, forKey: "videoCallsReference")
|
||||
encoder.encodeInt32(self.playerEmbedding ? 1 : 0, forKey: "playerEmbedding")
|
||||
encoder.encodeInt32(self.playlistPlayback ? 1 : 0, forKey: "playlistPlayback")
|
||||
}
|
||||
|
||||
@@ -468,10 +468,10 @@ public final class OngoingCallContext {
|
||||
return OngoingCallThreadLocalContext.maxLayer()
|
||||
}
|
||||
|
||||
public static func versions(includeExperimental: Bool) -> [String] {
|
||||
public static func versions(includeExperimental: Bool, includeReference: Bool) -> [String] {
|
||||
var result: [String] = [OngoingCallThreadLocalContext.version()]
|
||||
if includeExperimental {
|
||||
result.append(contentsOf: OngoingCallThreadLocalContextWebrtc.versions())
|
||||
result.append(contentsOf: OngoingCallThreadLocalContextWebrtc.versions(withIncludeReference: includeReference))
|
||||
}
|
||||
return result
|
||||
}
|
||||
@@ -495,7 +495,7 @@ public final class OngoingCallContext {
|
||||
|> take(1)
|
||||
|> deliverOn(queue)).start(next: { [weak self] _ in
|
||||
if let strongSelf = self {
|
||||
if OngoingCallThreadLocalContextWebrtc.versions().contains(version) {
|
||||
if OngoingCallThreadLocalContextWebrtc.versions(withIncludeReference: true).contains(version) {
|
||||
var voipProxyServer: VoipProxyServerWebrtc?
|
||||
if let proxyServer = proxyServer {
|
||||
switch proxyServer.connection {
|
||||
|
||||
@@ -107,7 +107,7 @@ typedef NS_ENUM(int32_t, OngoingCallDataSavingWebrtc) {
|
||||
+ (void)setupLoggingFunction:(void (* _Nullable)(NSString * _Nullable))loggingFunction;
|
||||
+ (void)applyServerConfig:(NSString * _Nullable)data;
|
||||
+ (int32_t)maxLayer;
|
||||
+ (NSArray<NSString *> * _Nonnull)versions;
|
||||
+ (NSArray<NSString *> * _Nonnull)versionsWithIncludeReference:(bool)includeReference;
|
||||
|
||||
@property (nonatomic, copy) void (^ _Nullable stateChanged)(OngoingCallStateWebrtc, OngoingCallVideoStateWebrtc, OngoingCallRemoteVideoStateWebrtc);
|
||||
@property (nonatomic, copy) void (^ _Nullable signalBarsChanged)(int32_t);
|
||||
|
||||
@@ -235,8 +235,12 @@ static void (*InternalVoipLoggingFunction)(NSString *) = NULL;
|
||||
return 92;
|
||||
}
|
||||
|
||||
+ (NSArray<NSString *> * _Nonnull)versions {
|
||||
return @[@"2.7.7", @"2.8.8"];
|
||||
+ (NSArray<NSString *> * _Nonnull)versionsWithIncludeReference:(bool)includeReference {
|
||||
if (includeReference) {
|
||||
return @[@"2.7.7", @"2.8.8"];
|
||||
} else {
|
||||
return @[@"2.7.7"];
|
||||
}
|
||||
}
|
||||
|
||||
- (instancetype _Nonnull)initWithVersion:(NSString * _Nonnull)version queue:(id<OngoingCallThreadLocalContextQueueWebrtc> _Nonnull)queue proxy:(VoipProxyServerWebrtc * _Nullable)proxy rtcServers:(NSArray<VoipRtcServerWebrtc *> * _Nonnull)rtcServers networkType:(OngoingCallNetworkTypeWebrtc)networkType dataSaving:(OngoingCallDataSavingWebrtc)dataSaving derivedState:(NSData * _Nonnull)derivedState key:(NSData * _Nonnull)key isOutgoing:(bool)isOutgoing primaryConnection:(OngoingCallConnectionDescriptionWebrtc * _Nonnull)primaryConnection alternativeConnections:(NSArray<OngoingCallConnectionDescriptionWebrtc *> * _Nonnull)alternativeConnections maxLayer:(int32_t)maxLayer allowP2P:(BOOL)allowP2P logPath:(NSString * _Nonnull)logPath sendSignalingData:(void (^)(NSData * _Nonnull))sendSignalingData videoCapturer:(OngoingCallThreadLocalContextVideoCapturer * _Nullable)videoCapturer {
|
||||
@@ -246,7 +250,7 @@ static void (*InternalVoipLoggingFunction)(NSString *) = NULL;
|
||||
_queue = queue;
|
||||
assert([queue isCurrent]);
|
||||
|
||||
assert([[OngoingCallThreadLocalContextWebrtc versions] containsObject:version]);
|
||||
assert([[OngoingCallThreadLocalContextWebrtc versionsWithIncludeReference:true] containsObject:version]);
|
||||
|
||||
_callReceiveTimeout = 20.0;
|
||||
_callRingTimeout = 90.0;
|
||||
@@ -327,9 +331,8 @@ static void (*InternalVoipLoggingFunction)(NSString *) = NULL;
|
||||
.maxApiLayer = [OngoingCallThreadLocalContextWebrtc maxLayer]
|
||||
};
|
||||
|
||||
std::vector<uint8_t> encryptionKeyValue;
|
||||
encryptionKeyValue.resize(key.length);
|
||||
memcpy(encryptionKeyValue.data(), key.bytes, key.length);
|
||||
auto encryptionKeyValue = std::make_shared<std::array<uint8_t, 256>>();
|
||||
memcpy(encryptionKeyValue->data(), key.bytes, key.length);
|
||||
|
||||
tgcalls::EncryptionKey encryptionKey(encryptionKeyValue, isOutgoing);
|
||||
|
||||
|
||||
Submodule submodules/TgVoipWebrtc/tgcalls updated: a022072ed3...8e9d3e56d4
Reference in New Issue
Block a user