From 25d54d7bb94f4fcbc39aabf1cff78734b2eec783 Mon Sep 17 00:00:00 2001 From: overtake Date: Tue, 5 Oct 2021 16:56:28 +0300 Subject: [PATCH 1/2] equatable for InviteFlags --- .../TelegramCore/Sources/TelegramEngine/Peers/JoinLink.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/JoinLink.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/JoinLink.swift index 62aee7aebe..1e2c594e3a 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/JoinLink.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/JoinLink.swift @@ -23,7 +23,7 @@ func apiUpdatesGroups(_ updates: Api.Updates) -> [Api.Chat] { public enum ExternalJoiningChatState { - public struct InviteFlags { + public struct InviteFlags : Equatable { public let isChannel: Bool public let isBroadcast: Bool public let isPublic: Bool From 7db07fa95779ca445430ae722521140bb6805a22 Mon Sep 17 00:00:00 2001 From: overtake Date: Tue, 5 Oct 2021 20:27:07 +0300 Subject: [PATCH 2/2] small request changes --- .../Sources/TelegramEngine/Peers/InvitationLinks.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/InvitationLinks.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/InvitationLinks.swift index d702b6ad2a..5e52392195 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/InvitationLinks.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/InvitationLinks.swift @@ -650,6 +650,10 @@ public struct PeerInvitationImportersState: Equatable { public var hasLoadedOnce: Bool public var canLoadMore: Bool public var count: Int32 + + public var waitingCount: Int { + return importers.filter { $0.approvedBy == nil }.count + } } final class CachedPeerInvitationImporters: Codable { @@ -891,7 +895,8 @@ private final class PeerInvitationImportersContextImpl { self.actionDisposables.add(_internal_updateInvitationRequest(account: self.account, peerId: self.peerId, userId: peerId, approve: action == .approve).start()) var results = self.results - results.removeAll(where: { $0.peer.peerId == peerId}) + results.removeAll(where: { $0.peer.peerId == peerId }) + count -= 1 self.results = results self.updateState() self.updateCache()