Voice Chat UI improvements

This commit is contained in:
Ilya Laktyushin
2020-12-08 21:06:03 +04:00
parent 9eddf57416
commit e94885aa08
70 changed files with 4378 additions and 3941 deletions

View File

@@ -300,11 +300,11 @@ public final class AccountContextImpl: AccountContext {
}
}
public func joinGroupCall(peerId: PeerId, activeCall: CachedChannelData.ActiveCall, sourcePanel: ASDisplayNode?) {
let callResult = self.sharedContext.callManager?.joinGroupCall(context: self, peerId: peerId, initialCall: activeCall, endCurrentIfAny: false, sourcePanel: nil)
public func joinGroupCall(peerId: PeerId, activeCall: CachedChannelData.ActiveCall) {
let callResult = self.sharedContext.callManager?.joinGroupCall(context: self, peerId: peerId, initialCall: activeCall, endCurrentIfAny: false)
if let callResult = callResult, case let .alreadyInProgress(currentPeerId) = callResult {
if currentPeerId == peerId {
self.sharedContext.navigateToCurrentCall(sourcePanel: nil)
self.sharedContext.navigateToCurrentCall()
} else {
let _ = (self.account.postbox.transaction { transaction -> (Peer?, Peer?) in
return (transaction.getPeer(peerId), currentPeerId.flatMap(transaction.getPeer))
@@ -323,14 +323,14 @@ public final class AccountContextImpl: AccountContext {
guard let strongSelf = self else {
return
}
let _ = strongSelf.sharedContext.callManager?.joinGroupCall(context: strongSelf, peerId: peer.id, initialCall: activeCall, endCurrentIfAny: true, sourcePanel: nil)
let _ = strongSelf.sharedContext.callManager?.joinGroupCall(context: strongSelf, peerId: peer.id, initialCall: activeCall, endCurrentIfAny: true)
})]), on: .root)
} else {
strongSelf.sharedContext.mainWindow?.present(textAlertController(context: strongSelf, title: presentationData.strings.Call_CallInProgressTitle, text: presentationData.strings.Call_CallInProgressVoiceChatMessage(current.compactDisplayTitle, peer.compactDisplayTitle).0, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_Cancel, action: {}), TextAlertAction(type: .genericAction, title: presentationData.strings.Common_OK, action: {
guard let strongSelf = self else {
return
}
let _ = strongSelf.sharedContext.callManager?.joinGroupCall(context: strongSelf, peerId: peer.id, initialCall: activeCall, endCurrentIfAny: true, sourcePanel: nil)
let _ = strongSelf.sharedContext.callManager?.joinGroupCall(context: strongSelf, peerId: peer.id, initialCall: activeCall, endCurrentIfAny: true)
})]), on: .root)
}
} else {
@@ -350,7 +350,7 @@ public final class AccountContextImpl: AccountContext {
if case let .alreadyInProgress(currentPeerId) = callResult {
if currentPeerId == peerId {
completion()
self.sharedContext.navigateToCurrentCall(sourcePanel: nil)
self.sharedContext.navigateToCurrentCall()
} else {
let _ = (self.account.postbox.transaction { transaction -> (Peer?, Peer?) in
return (transaction.getPeer(peerId), currentPeerId.flatMap(transaction.getPeer))