diff --git a/submodules/TelegramCore/Sources/SyncCore/SyncCore_ExportedInvitation.swift b/submodules/TelegramCore/Sources/SyncCore/SyncCore_ExportedInvitation.swift index f73ebf5d47..10f45a0b04 100644 --- a/submodules/TelegramCore/Sources/SyncCore/SyncCore_ExportedInvitation.swift +++ b/submodules/TelegramCore/Sources/SyncCore/SyncCore_ExportedInvitation.swift @@ -32,7 +32,7 @@ public struct ExportedInvitation: Codable, Equatable { self.link = try container.decode(String.self, forKey: "l") self.isPermanent = try container.decode(Bool.self, forKey: "permanent") - self.requestApproval = (try? container.decode(Bool.self, forKey: "requestApproval")) ?? false + self.requestApproval = try container.decodeIfPresent(Bool.self, forKey: "requestApproval") ?? false self.isRevoked = try container.decode(Bool.self, forKey: "revoked") self.adminId = PeerId(try container.decode(Int64.self, forKey: "adminId")) self.date = try container.decode(Int32.self, forKey: "date") diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/InvitationLinks.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/InvitationLinks.swift index 1f909313f0..d702b6ad2a 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/InvitationLinks.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/InvitationLinks.swift @@ -81,6 +81,9 @@ func _internal_createPeerExportedInvitation(account: Account, peerId: PeerId, ex if let _ = usageLimit { flags |= (1 << 1) } + if let _ = requestNeeded { + flags |= (1 << 3) + } return account.network.request(Api.functions.messages.exportChatInvite(flags: flags, peer: inputPeer, expireDate: expireDate, usageLimit: usageLimit)) |> mapError { _ in return CreatePeerExportedInvitationError.generic } |> map { result -> ExportedInvitation? in diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/JoinLink.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/JoinLink.swift index f5b31d4a67..af6e8f51a3 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/JoinLink.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/JoinLink.swift @@ -22,8 +22,16 @@ func apiUpdatesGroups(_ updates: Api.Updates) -> [Api.Chat] { } public enum ExternalJoiningChatState { - case invite(title: String, photoRepresentation: TelegramMediaImageRepresentation?, participantsCount: Int32, participants: [Peer]?) - case request(title: String, about: String?, photoRepresentation: TelegramMediaImageRepresentation?, participantsCount: Int32, isGroup: Bool) + public struct InviteFlags { + public let isChannel: Bool + public let isBroadcast: Bool + public let isPublic: Bool + public let isMegagroup: Bool + public let requestNeeded: Bool + } + + case invite(flags: InviteFlags, title: String, about: String?, photoRepresentation: TelegramMediaImageRepresentation?, participantsCount: Int32, participants: [Peer]?) + case alreadyJoined(PeerId) case invalidHash case peek(PeerId, Int32) @@ -70,11 +78,8 @@ func _internal_joinLinkInformation(_ hash: String, account: Account) -> Signal ExternalJoiningChatState in