mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
This commit is contained in:
commit
0a8d06f51f
@ -823,14 +823,14 @@ public final class ManagedAudioSession {
|
|||||||
|
|
||||||
print("\(CFAbsoluteTimeGetCurrent()) AudioSession activate: \((CFAbsoluteTimeGetCurrent() - startTime) * 1000.0) ms")
|
print("\(CFAbsoluteTimeGetCurrent()) AudioSession activate: \((CFAbsoluteTimeGetCurrent() - startTime) * 1000.0) ms")
|
||||||
|
|
||||||
self.updateCurrentAudioRouteInfo()
|
|
||||||
|
|
||||||
print("\(CFAbsoluteTimeGetCurrent()) AudioSession updateCurrentAudioRouteInfo: \((CFAbsoluteTimeGetCurrent() - startTime) * 1000.0) ms")
|
|
||||||
|
|
||||||
try self.setupOutputMode(outputMode, type: type)
|
try self.setupOutputMode(outputMode, type: type)
|
||||||
|
|
||||||
print("\(CFAbsoluteTimeGetCurrent()) AudioSession setupOutputMode: \((CFAbsoluteTimeGetCurrent() - startTime) * 1000.0) ms")
|
print("\(CFAbsoluteTimeGetCurrent()) AudioSession setupOutputMode: \((CFAbsoluteTimeGetCurrent() - startTime) * 1000.0) ms")
|
||||||
|
|
||||||
|
self.updateCurrentAudioRouteInfo()
|
||||||
|
|
||||||
|
print("\(CFAbsoluteTimeGetCurrent()) AudioSession updateCurrentAudioRouteInfo: \((CFAbsoluteTimeGetCurrent() - startTime) * 1000.0) ms")
|
||||||
|
|
||||||
if case .voiceCall = type {
|
if case .voiceCall = type {
|
||||||
try AVAudioSession.sharedInstance().setPreferredIOBufferDuration(0.005)
|
try AVAudioSession.sharedInstance().setPreferredIOBufferDuration(0.005)
|
||||||
}
|
}
|
||||||
|
@ -463,6 +463,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
|||||||
|
|
||||||
if !audioSession.getIsHeadsetPluggedIn() {
|
if !audioSession.getIsHeadsetPluggedIn() {
|
||||||
self.currentSelectedAudioOutputValue = .speaker
|
self.currentSelectedAudioOutputValue = .speaker
|
||||||
|
self.audioOutputStatePromise.set(.single(([], .speaker)))
|
||||||
}
|
}
|
||||||
|
|
||||||
self.audioSessionDisposable = audioSession.push(audioSessionType: .voiceCall, manualActivate: { [weak self] control in
|
self.audioSessionDisposable = audioSession.push(audioSessionType: .voiceCall, manualActivate: { [weak self] control in
|
||||||
@ -493,7 +494,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
|||||||
if !didReceiveAudioOutputs {
|
if !didReceiveAudioOutputs {
|
||||||
didReceiveAudioOutputs = true
|
didReceiveAudioOutputs = true
|
||||||
if currentOutput == .speaker {
|
if currentOutput == .speaker {
|
||||||
signal = .single((availableOutputs, .builtin))
|
signal = .single((availableOutputs, .speaker))
|
||||||
|> then(
|
|> then(
|
||||||
signal
|
signal
|
||||||
|> delay(1.0, queue: Queue.mainQueue())
|
|> delay(1.0, queue: Queue.mainQueue())
|
||||||
@ -989,6 +990,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
|||||||
|
|
||||||
strongSelf.stateValue.adminIds = adminIds
|
strongSelf.stateValue.adminIds = adminIds
|
||||||
|
|
||||||
|
strongSelf.stateValue.canManageCall = state.isCreator || adminIds.contains(strongSelf.accountContext.account.peerId)
|
||||||
if (state.isCreator || strongSelf.stateValue.adminIds.contains(strongSelf.accountContext.account.peerId)) && state.defaultParticipantsAreMuted.canChange {
|
if (state.isCreator || strongSelf.stateValue.adminIds.contains(strongSelf.accountContext.account.peerId)) && state.defaultParticipantsAreMuted.canChange {
|
||||||
strongSelf.stateValue.defaultParticipantMuteState = state.defaultParticipantsAreMuted.isMuted ? .muted : .unmuted
|
strongSelf.stateValue.defaultParticipantMuteState = state.defaultParticipantsAreMuted.isMuted ? .muted : .unmuted
|
||||||
}
|
}
|
||||||
|
@ -908,10 +908,14 @@ public final class VoiceChatController: ViewController {
|
|||||||
guard let strongSelf = self else {
|
guard let strongSelf = self else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
let wasEmpty = strongSelf.audioOutputState == nil
|
||||||
strongSelf.audioOutputState = state
|
strongSelf.audioOutputState = state
|
||||||
if let (layout, navigationHeight) = strongSelf.validLayout {
|
if let (layout, navigationHeight) = strongSelf.validLayout {
|
||||||
strongSelf.containerLayoutUpdated(layout, navigationHeight: navigationHeight, transition: .immediate)
|
strongSelf.containerLayoutUpdated(layout, navigationHeight: navigationHeight, transition: .immediate)
|
||||||
}
|
}
|
||||||
|
if wasEmpty {
|
||||||
|
strongSelf.controller?.audioOutputStateReady.set(true)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
self.audioLevelsDisposable = (call.audioLevels
|
self.audioLevelsDisposable = (call.audioLevels
|
||||||
@ -1859,6 +1863,7 @@ public final class VoiceChatController: ViewController {
|
|||||||
|
|
||||||
fileprivate let contentsReady = ValuePromise<Bool>(false, ignoreRepeated: true)
|
fileprivate let contentsReady = ValuePromise<Bool>(false, ignoreRepeated: true)
|
||||||
fileprivate let dataReady = ValuePromise<Bool>(false, ignoreRepeated: true)
|
fileprivate let dataReady = ValuePromise<Bool>(false, ignoreRepeated: true)
|
||||||
|
fileprivate let audioOutputStateReady = ValuePromise<Bool>(false, ignoreRepeated: true)
|
||||||
private let _ready = Promise<Bool>(false)
|
private let _ready = Promise<Bool>(false)
|
||||||
override public var ready: Promise<Bool> {
|
override public var ready: Promise<Bool> {
|
||||||
return self._ready
|
return self._ready
|
||||||
@ -1895,7 +1900,8 @@ public final class VoiceChatController: ViewController {
|
|||||||
|
|
||||||
self._ready.set(combineLatest([
|
self._ready.set(combineLatest([
|
||||||
self.contentsReady.get(),
|
self.contentsReady.get(),
|
||||||
self.dataReady.get()
|
self.dataReady.get(),
|
||||||
|
self.audioOutputStateReady.get()
|
||||||
])
|
])
|
||||||
|> map { values -> Bool in
|
|> map { values -> Bool in
|
||||||
for value in values {
|
for value in values {
|
||||||
|
@ -2975,7 +2975,7 @@ func replayFinalState(accountManager: AccountManager, postbox: Postbox, accountP
|
|||||||
case let .groupCall(flags, _, _, _, _, _):
|
case let .groupCall(flags, _, _, _, _, _):
|
||||||
let isMuted = (flags & (1 << 1)) != 0
|
let isMuted = (flags & (1 << 1)) != 0
|
||||||
let canChange = (flags & (1 << 2)) != 0
|
let canChange = (flags & (1 << 2)) != 0
|
||||||
let defaultParticipantsAreMuted = GroupCallParticipantsContext.State.DefaultParticipantsAreMuted(isMuted: isMuted, canChange: isMuted)
|
let defaultParticipantsAreMuted = GroupCallParticipantsContext.State.DefaultParticipantsAreMuted(isMuted: isMuted, canChange: canChange)
|
||||||
updatedGroupCallParticipants.append((
|
updatedGroupCallParticipants.append((
|
||||||
info.id,
|
info.id,
|
||||||
.call(isTerminated: false, defaultParticipantsAreMuted: defaultParticipantsAreMuted)
|
.call(isTerminated: false, defaultParticipantsAreMuted: defaultParticipantsAreMuted)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user