diff --git a/submodules/TelegramCallsUI/Sources/PresentationCall.swift b/submodules/TelegramCallsUI/Sources/PresentationCall.swift index fbd5519971..34e27bf0fa 100644 --- a/submodules/TelegramCallsUI/Sources/PresentationCall.swift +++ b/submodules/TelegramCallsUI/Sources/PresentationCall.swift @@ -238,7 +238,27 @@ public final class PresentationCallImpl: PresentationCall { private var videoCapturer: OngoingCallVideoCapturer? - init(account: Account, audioSession: ManagedAudioSession, callSessionManager: CallSessionManager, callKitIntegration: CallKitIntegration?, serializedData: String?, dataSaving: VoiceCallDataSaving, derivedState: VoipDerivedState, getDeviceAccessData: @escaping () -> (presentationData: PresentationData, present: (ViewController, Any?) -> Void, openSettings: () -> Void), initialState: CallSession?, internalId: CallSessionInternalId, peerId: PeerId, isOutgoing: Bool, peer: Peer?, proxyServer: ProxyServerSettings?, auxiliaryServers: [CallAuxiliaryServer], currentNetworkType: NetworkType, updatedNetworkType: Signal, startWithVideo: Bool, isVideoPossible: Bool) { + init( + account: Account, + audioSession: ManagedAudioSession, + callSessionManager: CallSessionManager, + callKitIntegration: CallKitIntegration?, + serializedData: String?, + dataSaving: VoiceCallDataSaving, + derivedState: VoipDerivedState, + getDeviceAccessData: @escaping () -> (presentationData: PresentationData, present: (ViewController, Any?) -> Void, openSettings: () -> Void), + initialState: CallSession?, + internalId: CallSessionInternalId, + peerId: PeerId, + isOutgoing: Bool, + peer: Peer?, + proxyServer: ProxyServerSettings?, + auxiliaryServers: [CallAuxiliaryServer], + currentNetworkType: NetworkType, + updatedNetworkType: Signal, + startWithVideo: Bool, + isVideoPossible: Bool + ) { self.account = account self.audioSession = audioSession self.callSessionManager = callSessionManager diff --git a/submodules/TelegramCallsUI/Sources/PresentationCallManager.swift b/submodules/TelegramCallsUI/Sources/PresentationCallManager.swift index ffa70806a0..07e10639f9 100644 --- a/submodules/TelegramCallsUI/Sources/PresentationCallManager.swift +++ b/submodules/TelegramCallsUI/Sources/PresentationCallManager.swift @@ -294,7 +294,27 @@ public final class PresentationCallManagerImpl: PresentationCallManager { let autodownloadSettings = sharedData.entries[SharedDataKeys.autodownloadSettings] as? AutodownloadSettings ?? .defaultSettings let appConfiguration = preferences.values[PreferencesKeys.appConfiguration] as? AppConfiguration ?? AppConfiguration.defaultValue - let call = PresentationCallImpl(account: firstState.0, audioSession: strongSelf.audioSession, callSessionManager: firstState.0.callSessionManager, callKitIntegration: enableCallKit ? callKitIntegrationIfEnabled(strongSelf.callKitIntegration, settings: strongSelf.callSettings) : nil, serializedData: configuration.serializedData, dataSaving: effectiveDataSaving(for: strongSelf.callSettings, autodownloadSettings: autodownloadSettings), derivedState: derivedState, getDeviceAccessData: strongSelf.getDeviceAccessData, initialState: nil, internalId: firstState.2.id, peerId: firstState.2.peerId, isOutgoing: false, peer: firstState.1, proxyServer: strongSelf.proxyServer, auxiliaryServers: auxiliaryServers(appConfiguration: appConfiguration), currentNetworkType: firstState.4, updatedNetworkType: firstState.0.networkType, startWithVideo: firstState.2.isVideo, isVideoPossible: strongSelf.isVideoPossible) + let call = PresentationCallImpl( + account: firstState.0, + audioSession: strongSelf.audioSession, + callSessionManager: firstState.0.callSessionManager, + callKitIntegration: enableCallKit ? callKitIntegrationIfEnabled(strongSelf.callKitIntegration, settings: strongSelf.callSettings) : nil, + serializedData: configuration.serializedData, + dataSaving: effectiveDataSaving(for: strongSelf.callSettings, autodownloadSettings: autodownloadSettings), + derivedState: derivedState, + getDeviceAccessData: strongSelf.getDeviceAccessData, + initialState: nil, + internalId: firstState.2.id, + peerId: firstState.2.peerId, + isOutgoing: false, + peer: firstState.1, + proxyServer: strongSelf.proxyServer, + auxiliaryServers: auxiliaryServers(appConfiguration: appConfiguration), + currentNetworkType: firstState.4, + updatedNetworkType: firstState.0.networkType, + startWithVideo: firstState.2.isVideo, + isVideoPossible: strongSelf.isVideoPossible + ) strongSelf.updateCurrentCall(call) strongSelf.currentCallPromise.set(.single(call)) strongSelf.hasActiveCallsPromise.set(true) @@ -399,7 +419,13 @@ public final class PresentationCallManagerImpl: PresentationCallManager { return .requested } - private func startCall(account: Account, peerId: PeerId, isVideo: Bool, isVideoPossible: Bool, internalId: CallSessionInternalId = CallSessionInternalId()) -> Signal { + private func startCall( + account: Account, + peerId: PeerId, + isVideo: Bool, + isVideoPossible: Bool, + internalId: CallSessionInternalId = CallSessionInternalId() + ) -> Signal { let (presentationData, present, openSettings) = self.getDeviceAccessData() let accessEnabledSignal: Signal = Signal { subscriber in @@ -448,7 +474,30 @@ public final class PresentationCallManagerImpl: PresentationCallManager { let autodownloadSettings = sharedData.entries[SharedDataKeys.autodownloadSettings] as? AutodownloadSettings ?? .defaultSettings let appConfiguration = preferences.values[PreferencesKeys.appConfiguration] as? AppConfiguration ?? AppConfiguration.defaultValue - let call = PresentationCallImpl(account: account, audioSession: strongSelf.audioSession, callSessionManager: account.callSessionManager, callKitIntegration: callKitIntegrationIfEnabled(strongSelf.callKitIntegration, settings: strongSelf.callSettings), serializedData: configuration.serializedData, dataSaving: effectiveDataSaving(for: strongSelf.callSettings, autodownloadSettings: autodownloadSettings), derivedState: derivedState, getDeviceAccessData: strongSelf.getDeviceAccessData, initialState: nil, internalId: internalId, peerId: peerId, isOutgoing: true, peer: nil, proxyServer: strongSelf.proxyServer, auxiliaryServers: auxiliaryServers(appConfiguration: appConfiguration), currentNetworkType: currentNetworkType, updatedNetworkType: account.networkType, startWithVideo: isVideo, isVideoPossible: isVideoPossible) + let call = PresentationCallImpl( + account: account, + audioSession: strongSelf.audioSession, + callSessionManager: account.callSessionManager, + callKitIntegration: callKitIntegrationIfEnabled( + strongSelf.callKitIntegration, + settings: strongSelf.callSettings + ), + serializedData: configuration.serializedData, + dataSaving: effectiveDataSaving(for: strongSelf.callSettings, autodownloadSettings: autodownloadSettings), + derivedState: derivedState, + getDeviceAccessData: strongSelf.getDeviceAccessData, + initialState: nil, + internalId: internalId, + peerId: peerId, + isOutgoing: true, + peer: nil, + proxyServer: strongSelf.proxyServer, + auxiliaryServers: auxiliaryServers(appConfiguration: appConfiguration), + currentNetworkType: currentNetworkType, + updatedNetworkType: account.networkType, + startWithVideo: isVideo, + isVideoPossible: isVideoPossible + ) strongSelf.updateCurrentCall(call) strongSelf.currentCallPromise.set(.single(call)) strongSelf.hasActiveCallsPromise.set(true)