mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Stars subscriptions API [skip ci]
This commit is contained in:
@@ -6,8 +6,8 @@ import TelegramApi
|
||||
extension ExportedInvitation {
|
||||
init(apiExportedInvite: Api.ExportedChatInvite) {
|
||||
switch apiExportedInvite {
|
||||
case let .chatInviteExported(flags, link, adminId, date, startDate, expireDate, usageLimit, usage, requested, title):
|
||||
self = .link(link: link, title: title, 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, requestedCount: requested)
|
||||
case let .chatInviteExported(flags, link, adminId, date, startDate, expireDate, usageLimit, usage, requested, title, pricing):
|
||||
self = .link(link: link, title: title, 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, requestedCount: requested, pricing: pricing.flatMap { StarsSubscriptionPricing(apiStarsSubscriptionPricing: $0) })
|
||||
case .chatInvitePublicJoinRequests:
|
||||
self = .publicJoinRequest
|
||||
}
|
||||
@@ -17,7 +17,7 @@ extension ExportedInvitation {
|
||||
public extension ExportedInvitation {
|
||||
var link: String? {
|
||||
switch self {
|
||||
case let .link(link, _, _, _, _, _, _, _, _, _, _, _):
|
||||
case let .link(link, _, _, _, _, _, _, _, _, _, _, _, _):
|
||||
return link
|
||||
case .publicJoinRequest:
|
||||
return nil
|
||||
@@ -26,7 +26,7 @@ public extension ExportedInvitation {
|
||||
|
||||
var date: Int32? {
|
||||
switch self {
|
||||
case let .link(_, _, _, _, _, _, date, _, _, _, _, _):
|
||||
case let .link(_, _, _, _, _, _, date, _, _, _, _, _, _):
|
||||
return date
|
||||
case .publicJoinRequest:
|
||||
return nil
|
||||
@@ -35,7 +35,7 @@ public extension ExportedInvitation {
|
||||
|
||||
var isPermanent: Bool {
|
||||
switch self {
|
||||
case let .link(_, _, isPermanent, _, _, _, _, _, _, _, _, _):
|
||||
case let .link(_, _, isPermanent, _, _, _, _, _, _, _, _, _, _):
|
||||
return isPermanent
|
||||
case .publicJoinRequest:
|
||||
return false
|
||||
@@ -44,10 +44,19 @@ public extension ExportedInvitation {
|
||||
|
||||
var isRevoked: Bool {
|
||||
switch self {
|
||||
case let .link(_, _, _, _, isRevoked, _, _, _, _, _, _, _):
|
||||
case let .link(_, _, _, _, isRevoked, _, _, _, _, _, _, _, _):
|
||||
return isRevoked
|
||||
case .publicJoinRequest:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
var pricing: StarsSubscriptionPricing? {
|
||||
switch self {
|
||||
case let .link(_, _, _, _, _, _, _, _, _, _, _, _, pricing):
|
||||
return pricing
|
||||
case .publicJoinRequest:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user