diff --git a/submodules/TelegramCore/Sources/ApiUtils/ExportedInvitation.swift b/submodules/TelegramCore/Sources/ApiUtils/ExportedInvitation.swift index 2d5d0b3ed3..6b21611f72 100644 --- a/submodules/TelegramCore/Sources/ApiUtils/ExportedInvitation.swift +++ b/submodules/TelegramCore/Sources/ApiUtils/ExportedInvitation.swift @@ -7,7 +7,7 @@ extension ExportedInvitation { init(apiExportedInvite: Api.ExportedChatInvite) { switch apiExportedInvite { case let .chatInviteExported(flags, link, adminId, date, startDate, expireDate, usageLimit, usage, approved): - self = ExportedInvitation(link: link, isPermanent: (flags & (1 << 5)) != 0, requestApproval: (flags & (1 << 6)) != 0, isRevoked: (flags & (1 << 0)) != 0, adminId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(adminId)), date: date, startDate: startDate, expireDate: expireDate, usageLimit: usageLimit, count: usage, approvedDate: approved) + self = ExportedInvitation(link: link, isPermanent: (flags & (1 << 5)) != 0, requestApproval: (flags & (1 << 6)) != 0, isRevoked: (flags & (1 << 0)) != 0, adminId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(adminId)), date: date, startDate: startDate, expireDate: expireDate, usageLimit: usageLimit, count: usage, approvedCount: approved) } } } diff --git a/submodules/TelegramCore/Sources/SyncCore/SyncCore_ExportedInvitation.swift b/submodules/TelegramCore/Sources/SyncCore/SyncCore_ExportedInvitation.swift index 10f45a0b04..671aa984d8 100644 --- a/submodules/TelegramCore/Sources/SyncCore/SyncCore_ExportedInvitation.swift +++ b/submodules/TelegramCore/Sources/SyncCore/SyncCore_ExportedInvitation.swift @@ -11,9 +11,9 @@ public struct ExportedInvitation: Codable, Equatable { public let expireDate: Int32? public let usageLimit: Int32? public let count: Int32? - public let approvedDate: Int32? + public let approvedCount: Int32? - public init(link: String, isPermanent: Bool, requestApproval: Bool, isRevoked: Bool, adminId: PeerId, date: Int32, startDate: Int32?, expireDate: Int32?, usageLimit: Int32?, count: Int32?, approvedDate: Int32?) { + public init(link: String, isPermanent: Bool, requestApproval: Bool, isRevoked: Bool, adminId: PeerId, date: Int32, startDate: Int32?, expireDate: Int32?, usageLimit: Int32?, count: Int32?, approvedCount: Int32?) { self.link = link self.isPermanent = isPermanent self.requestApproval = requestApproval @@ -24,7 +24,7 @@ public struct ExportedInvitation: Codable, Equatable { self.expireDate = expireDate self.usageLimit = usageLimit self.count = count - self.approvedDate = approvedDate + self.approvedCount = approvedCount } public init(from decoder: Decoder) throws { @@ -40,7 +40,7 @@ public struct ExportedInvitation: Codable, Equatable { self.expireDate = try container.decodeIfPresent(Int32.self, forKey: "expireDate") self.usageLimit = try container.decodeIfPresent(Int32.self, forKey: "usageLimit") self.count = try container.decodeIfPresent(Int32.self, forKey: "count") - self.approvedDate = try? container.decodeIfPresent(Int32.self, forKey: "approvedDate") + self.approvedCount = try? container.decodeIfPresent(Int32.self, forKey: "approvedDate") } public func encode(to encoder: Encoder) throws { @@ -56,14 +56,14 @@ public struct ExportedInvitation: Codable, Equatable { try container.encodeIfPresent(self.expireDate, forKey: "expireDate") try container.encodeIfPresent(self.usageLimit, forKey: "usageLimit") try container.encodeIfPresent(self.count, forKey: "count") - try container.encodeIfPresent(self.approvedDate, forKey: "approvedDate") + try container.encodeIfPresent(self.approvedCount, forKey: "approvedDate") } public static func ==(lhs: ExportedInvitation, rhs: ExportedInvitation) -> Bool { - return lhs.link == rhs.link && lhs.isPermanent == rhs.isPermanent && lhs.requestApproval == rhs.requestApproval && lhs.isRevoked == rhs.isRevoked && lhs.adminId == rhs.adminId && lhs.date == rhs.date && lhs.startDate == rhs.startDate && lhs.expireDate == rhs.expireDate && lhs.usageLimit == rhs.usageLimit && lhs.count == rhs.count && lhs.approvedDate == rhs.approvedDate + return lhs.link == rhs.link && lhs.isPermanent == rhs.isPermanent && lhs.requestApproval == rhs.requestApproval && lhs.isRevoked == rhs.isRevoked && lhs.adminId == rhs.adminId && lhs.date == rhs.date && lhs.startDate == rhs.startDate && lhs.expireDate == rhs.expireDate && lhs.usageLimit == rhs.usageLimit && lhs.count == rhs.count && lhs.approvedCount == rhs.approvedCount } public func withUpdated(isRevoked: Bool) -> ExportedInvitation { - return ExportedInvitation(link: self.link, isPermanent: self.isPermanent, requestApproval: self.requestApproval, isRevoked: isRevoked, adminId: self.adminId, date: self.date, startDate: self.startDate, expireDate: self.expireDate, usageLimit: self.usageLimit, count: self.count, approvedDate: self.approvedDate) + return ExportedInvitation(link: self.link, isPermanent: self.isPermanent, requestApproval: self.requestApproval, isRevoked: isRevoked, adminId: self.adminId, date: self.date, startDate: self.startDate, expireDate: self.expireDate, usageLimit: self.usageLimit, count: self.count, approvedCount: self.approvedCount) } }