mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Fix call issue
This commit is contained in:
@@ -84,7 +84,8 @@ final class AuthorizedApplicationContext {
|
||||
let notificationController: NotificationContainerController
|
||||
|
||||
private var scheduledOpenNotificationSettings: Bool = false
|
||||
private var scheduledOperChatWithPeerId: (PeerId, MessageId?, Bool)?
|
||||
private var scheduledOpenChatWithPeerId: (PeerId, MessageId?, Bool)?
|
||||
private let scheduledCallPeerDisposable = MetaDisposable()
|
||||
private var scheduledOpenExternalUrl: URL?
|
||||
|
||||
private let passcodeStatusDisposable = MetaDisposable()
|
||||
@@ -738,6 +739,7 @@ final class AuthorizedApplicationContext {
|
||||
self.termsOfServiceProceedToBotDisposable.dispose()
|
||||
self.watchNavigateToMessageDisposable.dispose()
|
||||
self.permissionsDisposable.dispose()
|
||||
self.scheduledCallPeerDisposable.dispose()
|
||||
}
|
||||
|
||||
func openNotificationSettings() {
|
||||
@@ -748,6 +750,23 @@ final class AuthorizedApplicationContext {
|
||||
}
|
||||
}
|
||||
|
||||
func startCall(peerId: PeerId) {
|
||||
guard let appLockContext = self.context.sharedContext.appLockContext as? AppLockContextImpl else {
|
||||
return
|
||||
}
|
||||
self.scheduledCallPeerDisposable.set((appLockContext.isCurrentlyLocked
|
||||
|> filter {
|
||||
!$0
|
||||
}
|
||||
|> take(1)
|
||||
|> deliverOnMainQueue).start(next: { [weak self] _ in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
let _ = strongSelf.context.sharedContext.callManager?.requestCall(account: strongSelf.context.account, peerId: peerId, endCurrentIfAny: false)
|
||||
}))
|
||||
}
|
||||
|
||||
func openChatWithPeerId(peerId: PeerId, messageId: MessageId? = nil, activateInput: Bool = false) {
|
||||
var visiblePeerId: PeerId?
|
||||
if let controller = self.rootController.topViewController as? ChatControllerImpl, case let .peer(peerId) = controller.chatLocation {
|
||||
@@ -758,7 +777,7 @@ final class AuthorizedApplicationContext {
|
||||
if self.rootController.rootTabController != nil {
|
||||
self.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: self.rootController, context: self.context, chatLocation: .peer(peerId), subject: messageId.flatMap { .message($0) }, activateInput: activateInput))
|
||||
} else {
|
||||
self.scheduledOperChatWithPeerId = (peerId, messageId, activateInput)
|
||||
self.scheduledOpenChatWithPeerId = (peerId, messageId, activateInput)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user