Add voice chat invite links support

This commit is contained in:
Ilya Laktyushin
2021-03-11 16:29:42 +04:00
parent b9f5db6a5a
commit e2a6a70ea2
31 changed files with 3492 additions and 2684 deletions

View File

@@ -624,9 +624,15 @@ public final class PresentationCallManagerImpl: PresentationCallManager {
}
}
public func joinGroupCall(context: AccountContext, peerId: PeerId, joinAsPeerId: PeerId?, initialCall: CachedChannelData.ActiveCall, endCurrentIfAny: Bool) -> JoinGroupCallManagerResult {
public func joinGroupCall(context: AccountContext, peerId: PeerId, invite: String?, requestJoinAsPeerId: ((@escaping (PeerId?) -> Void) -> Void)?, initialCall: CachedChannelData.ActiveCall, endCurrentIfAny: Bool) -> JoinGroupCallManagerResult {
let begin: () -> Void = { [weak self] in
let _ = self?.startGroupCall(accountContext: context, peerId: peerId, joinAsPeerId: joinAsPeerId, initialCall: initialCall).start()
if let requestJoinAsPeerId = requestJoinAsPeerId {
requestJoinAsPeerId({ joinAsPeerId in
let _ = self?.startGroupCall(accountContext: context, peerId: peerId, invite: invite, joinAsPeerId: joinAsPeerId, initialCall: initialCall).start()
})
} else {
let _ = self?.startGroupCall(accountContext: context, peerId: peerId, invite: invite, joinAsPeerId: nil, initialCall: initialCall).start()
}
}
if let currentGroupCall = self.currentGroupCallValue {
@@ -660,6 +666,7 @@ public final class PresentationCallManagerImpl: PresentationCallManager {
private func startGroupCall(
accountContext: AccountContext,
peerId: PeerId,
invite: String?,
joinAsPeerId: PeerId?,
initialCall: CachedChannelData.ActiveCall,
internalId: CallSessionInternalId = CallSessionInternalId()
@@ -711,6 +718,7 @@ public final class PresentationCallManagerImpl: PresentationCallManager {
initialCall: initialCall,
internalId: internalId,
peerId: peerId,
invite: invite,
joinAsPeerId: joinAsPeerId
)
strongSelf.updateCurrentGroupCall(call)