From ff6b90f4f4c688b40d94efc40e5536f123d4bb84 Mon Sep 17 00:00:00 2001 From: Peter <> Date: Wed, 29 May 2019 21:30:03 +0200 Subject: [PATCH] Update API --- .../ManageChannelDiscussionGroup.swift | 23 +++---------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/TelegramCore/ManageChannelDiscussionGroup.swift b/TelegramCore/ManageChannelDiscussionGroup.swift index 489775f513..46a41cab32 100644 --- a/TelegramCore/ManageChannelDiscussionGroup.swift +++ b/TelegramCore/ManageChannelDiscussionGroup.swift @@ -35,28 +35,9 @@ public func availableGroupsForChannelDiscussion(postbox: Postbox, network: Netwo } } -public func availableChannelsForGroupDiscussion(network: Network) -> Signal<[Peer], AvailableChannelDiscussionGroupError> { - return network.request(Api.functions.channels.getBroadcastsForDiscussion()) |> mapError { _ in - return .generic - } |> map { result in - let chats:[Api.Chat] - switch result { - case let .chats(c): - chats = c - case let .chatsSlice(_, c): - chats = c - } - - let peers = chats.compactMap { - return parseTelegramGroupOrChannel(chat: $0) - } - - return peers - } -} - public enum ChannelDiscussionGroupError { case generic + case groupHistoryIsCurrentlyPrivate } public func updateGroupDiscussionForChannel(network: Network, postbox: Postbox, channelId: PeerId, groupId: PeerId?) -> Signal { @@ -88,6 +69,8 @@ public func updateGroupDiscussionForChannel(network: Network, postbox: Postbox, |> `catch` { error -> Signal in if error.errorDescription == "LINK_NOT_MODIFIED" { return .single(true) + } else if error.errorDescription == "MEGAGROUP_PREHISTORY_HIDDEN" { + return .fail(.groupHistoryIsCurrentlyPrivate) } return .fail(.generic) }