mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-05 04:10:16 +00:00
temp
This commit is contained in:
parent
90650e71c7
commit
2eed3b9be4
@ -7,7 +7,7 @@ extension ExportedInvitation {
|
|||||||
init(apiExportedInvite: Api.ExportedChatInvite) {
|
init(apiExportedInvite: Api.ExportedChatInvite) {
|
||||||
switch apiExportedInvite {
|
switch apiExportedInvite {
|
||||||
case let .chatInviteExported(flags, link, adminId, date, startDate, expireDate, usageLimit, usage, approved):
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,9 +11,9 @@ public struct ExportedInvitation: Codable, Equatable {
|
|||||||
public let expireDate: Int32?
|
public let expireDate: Int32?
|
||||||
public let usageLimit: Int32?
|
public let usageLimit: Int32?
|
||||||
public let count: 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.link = link
|
||||||
self.isPermanent = isPermanent
|
self.isPermanent = isPermanent
|
||||||
self.requestApproval = requestApproval
|
self.requestApproval = requestApproval
|
||||||
@ -24,7 +24,7 @@ public struct ExportedInvitation: Codable, Equatable {
|
|||||||
self.expireDate = expireDate
|
self.expireDate = expireDate
|
||||||
self.usageLimit = usageLimit
|
self.usageLimit = usageLimit
|
||||||
self.count = count
|
self.count = count
|
||||||
self.approvedDate = approvedDate
|
self.approvedCount = approvedCount
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(from decoder: Decoder) throws {
|
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.expireDate = try container.decodeIfPresent(Int32.self, forKey: "expireDate")
|
||||||
self.usageLimit = try container.decodeIfPresent(Int32.self, forKey: "usageLimit")
|
self.usageLimit = try container.decodeIfPresent(Int32.self, forKey: "usageLimit")
|
||||||
self.count = try container.decodeIfPresent(Int32.self, forKey: "count")
|
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 {
|
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.expireDate, forKey: "expireDate")
|
||||||
try container.encodeIfPresent(self.usageLimit, forKey: "usageLimit")
|
try container.encodeIfPresent(self.usageLimit, forKey: "usageLimit")
|
||||||
try container.encodeIfPresent(self.count, forKey: "count")
|
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 {
|
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 {
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user