diff --git a/submodules/TelegramCore/Sources/InvitationLinks.swift b/submodules/TelegramCore/Sources/InvitationLinks.swift index 7a5eb1434f..fc9491db1b 100644 --- a/submodules/TelegramCore/Sources/InvitationLinks.swift +++ b/submodules/TelegramCore/Sources/InvitationLinks.swift @@ -6,64 +6,64 @@ import MtProtoKit import SyncCore - -public func ensuredExistingPeerExportedInvitation(account: Account, peerId: PeerId, revokeExisted: Bool = false) -> Signal { - return account.postbox.transaction { transaction -> Signal in - if let peer = transaction.getPeer(peerId), let inputPeer = apiInputPeer(peer) { - if let _ = peer as? TelegramChannel { - if let cachedData = transaction.getPeerCachedData(peerId: peerId) as? CachedChannelData, cachedData.exportedInvitation != nil && !revokeExisted { - return .single(cachedData.exportedInvitation) - } else { - return account.network.request(Api.functions.messages.exportChatInvite(peer: inputPeer)) - |> retryRequest - |> mapToSignal { result -> Signal in - return account.postbox.transaction { transaction -> ExportedInvitation? in - if let invitation = ExportedInvitation(apiExportedInvite: result) { - transaction.updatePeerCachedData(peerIds: Set([peerId]), update: { _, current in - if let current = current as? CachedChannelData { - return current.withUpdatedExportedInvitation(invitation) - } else { - return CachedChannelData().withUpdatedExportedInvitation(invitation) - } - }) - return invitation - } else { - return nil - } - } - } - } - } else if let _ = peer as? TelegramGroup { - if let cachedData = transaction.getPeerCachedData(peerId: peerId) as? CachedGroupData, cachedData.exportedInvitation != nil && !revokeExisted { - return .single(cachedData.exportedInvitation) - } else { - return account.network.request(Api.functions.messages.exportChatInvite(peer: inputPeer)) - |> retryRequest - |> mapToSignal { result -> Signal in - return account.postbox.transaction { transaction -> ExportedInvitation? in - if let invitation = ExportedInvitation(apiExportedInvite: result) { - transaction.updatePeerCachedData(peerIds: Set([peerId]), update: { _, current in - if let current = current as? CachedGroupData { - return current.withUpdatedExportedInvitation(invitation) - } else { - return current - } - }) - return invitation - } else { - return nil - } - } - } - } - } else { - return .complete() - } - } else { - return .complete() - } - } |> switchToLatest -} +// +//public func ensuredExistingPeerExportedInvitation(account: Account, peerId: PeerId, revokeExisted: Bool = false) -> Signal { +// return account.postbox.transaction { transaction -> Signal in +// if let peer = transaction.getPeer(peerId), let inputPeer = apiInputPeer(peer) { +// if let _ = peer as? TelegramChannel { +// if let cachedData = transaction.getPeerCachedData(peerId: peerId) as? CachedChannelData, cachedData.exportedInvitation != nil && !revokeExisted { +// return .single(cachedData.exportedInvitation) +// } else { +// return account.network.request(Api.functions.messages.exportChatInvite(peer: inputPeer)) +// |> retryRequest +// |> mapToSignal { result -> Signal in +// return account.postbox.transaction { transaction -> ExportedInvitation? in +// if let invitation = ExportedInvitation(apiExportedInvite: result) { +// transaction.updatePeerCachedData(peerIds: Set([peerId]), update: { _, current in +// if let current = current as? CachedChannelData { +// return current.withUpdatedExportedInvitation(invitation) +// } else { +// return CachedChannelData().withUpdatedExportedInvitation(invitation) +// } +// }) +// return invitation +// } else { +// return nil +// } +// } +// } +// } +// } else if let _ = peer as? TelegramGroup { +// if let cachedData = transaction.getPeerCachedData(peerId: peerId) as? CachedGroupData, cachedData.exportedInvitation != nil && !revokeExisted { +// return .single(cachedData.exportedInvitation) +// } else { +// return account.network.request(Api.functions.messages.exportChatInvite(peer: inputPeer)) +// |> retryRequest +// |> mapToSignal { result -> Signal in +// return account.postbox.transaction { transaction -> ExportedInvitation? in +// if let invitation = ExportedInvitation(apiExportedInvite: result) { +// transaction.updatePeerCachedData(peerIds: Set([peerId]), update: { _, current in +// if let current = current as? CachedGroupData { +// return current.withUpdatedExportedInvitation(invitation) +// } else { +// return current +// } +// }) +// return invitation +// } else { +// return nil +// } +// } +// } +// } +// } else { +// return .complete() +// } +// } else { +// return .complete() +// } +// } |> switchToLatest +//} public func revokePersistentPeerExportedInvitation(account: Account, peerId: PeerId) -> Signal { diff --git a/submodules/TgVoipWebrtc/tgcalls b/submodules/TgVoipWebrtc/tgcalls index 1c6747b73f..ff6c6f97a6 160000 --- a/submodules/TgVoipWebrtc/tgcalls +++ b/submodules/TgVoipWebrtc/tgcalls @@ -1 +1 @@ -Subproject commit 1c6747b73fd19043d7bd382ea208ba78314fed00 +Subproject commit ff6c6f97a6546049f0543bb5322789348e119b9d