Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios

This commit is contained in:
Ilya Laktyushin 2021-03-11 23:01:57 +04:00
commit adbfaee2ae

View File

@ -606,36 +606,37 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
self.audioSessionShouldBeActiveDisposable = (self.audioSessionShouldBeActive.get() self.audioSessionShouldBeActiveDisposable = (self.audioSessionShouldBeActive.get()
|> deliverOnMainQueue).start(next: { [weak self] value in |> deliverOnMainQueue).start(next: { [weak self] value in
if let strongSelf = self { guard let strongSelf = self else {
if value { return
if let audioSessionControl = strongSelf.audioSessionControl { }
//let audioSessionActive: Signal<Bool, NoError> if value {
if let callKitIntegration = strongSelf.callKitIntegration { if let audioSessionControl = strongSelf.audioSessionControl {
_ = callKitIntegration.audioSessionActive //let audioSessionActive: Signal<Bool, NoError>
|> filter { $0 } if let callKitIntegration = strongSelf.callKitIntegration {
|> timeout(2.0, queue: Queue.mainQueue(), alternate: Signal { subscriber in _ = callKitIntegration.audioSessionActive
if let strongSelf = self, let _ = strongSelf.audioSessionControl { |> filter { $0 }
} |> timeout(2.0, queue: Queue.mainQueue(), alternate: Signal { subscriber in
subscriber.putNext(true) /*if let strongSelf = self, let _ = strongSelf.audioSessionControl {
subscriber.putCompletion() }*/
return EmptyDisposable subscriber.putNext(true)
}) subscriber.putCompletion()
} else { return EmptyDisposable
audioSessionControl.activate({ [weak self] _ in })
Queue.mainQueue().async {
guard let strongSelf = self else {
return
}
strongSelf.audioSessionActive.set(.single(true))
}
})
}
} else { } else {
strongSelf.audioSessionActive.set(.single(false)) audioSessionControl.activate({ _ in
Queue.mainQueue().async {
guard let strongSelf = self else {
return
}
strongSelf.audioSessionActive.set(.single(true))
}
})
} }
} else { } else {
strongSelf.audioSessionActive.set(.single(false)) strongSelf.audioSessionActive.set(.single(false))
} }
} else {
strongSelf.audioSessionActive.set(.single(false))
} }
}) })
@ -1312,9 +1313,12 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
let _ = (strongSelf.accountContext.sharedContext.hasGroupCallOnScreen let _ = (strongSelf.accountContext.sharedContext.hasGroupCallOnScreen
|> take(1) |> take(1)
|> deliverOnMainQueue).start(next: { [weak self] hasGroupCallOnScreen in |> deliverOnMainQueue).start(next: { hasGroupCallOnScreen in
guard let strongSelf = self else {
return
}
let presentationData = strongSelf.accountContext.sharedContext.currentPresentationData.with { $0 } let presentationData = strongSelf.accountContext.sharedContext.currentPresentationData.with { $0 }
if hasGroupCallOnScreen, let groupCallController = self?.accountContext.sharedContext.currentGroupCallController { if hasGroupCallOnScreen, let groupCallController = strongSelf.accountContext.sharedContext.currentGroupCallController {
var animateInAsReplacement = false var animateInAsReplacement = false
groupCallController.forEachController { c in groupCallController.forEachController { c in
if let c = c as? UndoOverlayController { if let c = c as? UndoOverlayController {