mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-15 18:59:54 +00:00
API update [skip ci]
This commit is contained in:
parent
85c1b270ff
commit
e4a472f246
@ -721,7 +721,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
dict[-104284986] = { return Api.WebDocument.parse_webDocumentNoProxy($0) }
|
||||
dict[475467473] = { return Api.WebDocument.parse_webDocument($0) }
|
||||
dict[1211967244] = { return Api.Theme.parse_themeDocumentNotModified($0) }
|
||||
dict[975846885] = { return Api.Theme.parse_theme($0) }
|
||||
dict[-136770336] = { return Api.Theme.parse_theme($0) }
|
||||
dict[-1290580579] = { return Api.contacts.Found.parse_found($0) }
|
||||
dict[-368018716] = { return Api.ChannelAdminLogEventsFilter.parse_channelAdminLogEventsFilter($0) }
|
||||
dict[1889961234] = { return Api.PeerNotifySettings.parse_peerNotifySettingsEmpty($0) }
|
||||
|
||||
@ -18231,7 +18231,7 @@ public extension Api {
|
||||
}
|
||||
public enum Theme: TypeConstructorDescription {
|
||||
case themeDocumentNotModified
|
||||
case theme(flags: Int32, id: Int64, accessHash: Int64, slug: String, title: String, document: Api.Document?)
|
||||
case theme(flags: Int32, id: Int64, accessHash: Int64, slug: String, title: String, document: Api.Document?, installsCount: Int32)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
@ -18241,9 +18241,9 @@ public extension Api {
|
||||
}
|
||||
|
||||
break
|
||||
case .theme(let flags, let id, let accessHash, let slug, let title, let document):
|
||||
case .theme(let flags, let id, let accessHash, let slug, let title, let document, let installsCount):
|
||||
if boxed {
|
||||
buffer.appendInt32(975846885)
|
||||
buffer.appendInt32(-136770336)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
serializeInt64(id, buffer: buffer, boxed: false)
|
||||
@ -18251,6 +18251,7 @@ public extension Api {
|
||||
serializeString(slug, buffer: buffer, boxed: false)
|
||||
serializeString(title, buffer: buffer, boxed: false)
|
||||
if Int(flags) & Int(1 << 2) != 0 {document!.serialize(buffer, true)}
|
||||
serializeInt32(installsCount, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -18259,8 +18260,8 @@ public extension Api {
|
||||
switch self {
|
||||
case .themeDocumentNotModified:
|
||||
return ("themeDocumentNotModified", [])
|
||||
case .theme(let flags, let id, let accessHash, let slug, let title, let document):
|
||||
return ("theme", [("flags", flags), ("id", id), ("accessHash", accessHash), ("slug", slug), ("title", title), ("document", document)])
|
||||
case .theme(let flags, let id, let accessHash, let slug, let title, let document, let installsCount):
|
||||
return ("theme", [("flags", flags), ("id", id), ("accessHash", accessHash), ("slug", slug), ("title", title), ("document", document), ("installsCount", installsCount)])
|
||||
}
|
||||
}
|
||||
|
||||
@ -18282,14 +18283,17 @@ public extension Api {
|
||||
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
|
||||
_6 = Api.parse(reader, signature: signature) as? Api.Document
|
||||
} }
|
||||
var _7: Int32?
|
||||
_7 = reader.readInt32()
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
let _c5 = _5 != nil
|
||||
let _c6 = (Int(_1!) & Int(1 << 2) == 0) || _6 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
|
||||
return Api.Theme.theme(flags: _1!, id: _2!, accessHash: _3!, slug: _4!, title: _5!, document: _6)
|
||||
let _c7 = _7 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
|
||||
return Api.Theme.theme(flags: _1!, id: _2!, accessHash: _3!, slug: _4!, title: _5!, document: _6, installsCount: _7!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
|
||||
@ -17,8 +17,9 @@ public final class TelegramTheme: OrderedItemListEntryContents, Equatable {
|
||||
public let file: TelegramMediaFile?
|
||||
public let isCreator: Bool
|
||||
public let isDefault: Bool
|
||||
public let installCount: Int32
|
||||
|
||||
public init(id: Int64, accessHash: Int64, slug: String, title: String, file: TelegramMediaFile?, isCreator: Bool, isDefault: Bool) {
|
||||
public init(id: Int64, accessHash: Int64, slug: String, title: String, file: TelegramMediaFile?, isCreator: Bool, isDefault: Bool, installCount: Int32) {
|
||||
self.id = id
|
||||
self.accessHash = accessHash
|
||||
self.slug = slug
|
||||
@ -26,6 +27,7 @@ public final class TelegramTheme: OrderedItemListEntryContents, Equatable {
|
||||
self.file = file
|
||||
self.isCreator = isCreator
|
||||
self.isDefault = isDefault
|
||||
self.installCount = installCount
|
||||
}
|
||||
|
||||
public init(decoder: PostboxDecoder) {
|
||||
@ -36,6 +38,7 @@ public final class TelegramTheme: OrderedItemListEntryContents, Equatable {
|
||||
self.file = decoder.decodeObjectForKey("file", decoder: { TelegramMediaFile(decoder: $0) }) as? TelegramMediaFile
|
||||
self.isCreator = decoder.decodeInt32ForKey("isCreator", orElse: 0) != 0
|
||||
self.isDefault = decoder.decodeInt32ForKey("isDefault", orElse: 0) != 0
|
||||
self.installCount = decoder.decodeInt32ForKey("installCount", orElse: 0)
|
||||
}
|
||||
|
||||
public func encode(_ encoder: PostboxEncoder) {
|
||||
@ -50,6 +53,7 @@ public final class TelegramTheme: OrderedItemListEntryContents, Equatable {
|
||||
}
|
||||
encoder.encodeInt32(self.isCreator ? 1 : 0, forKey: "isCreator")
|
||||
encoder.encodeInt32(self.isDefault ? 1 : 0, forKey: "isDefault")
|
||||
encoder.encodeInt32(self.installCount, forKey: "installCount")
|
||||
}
|
||||
|
||||
public static func ==(lhs: TelegramTheme, rhs: TelegramTheme) -> Bool {
|
||||
@ -74,6 +78,9 @@ public final class TelegramTheme: OrderedItemListEntryContents, Equatable {
|
||||
if lhs.isDefault != rhs.isDefault {
|
||||
return false
|
||||
}
|
||||
if lhs.installCount != rhs.installCount {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
@ -81,8 +88,8 @@ public final class TelegramTheme: OrderedItemListEntryContents, Equatable {
|
||||
extension TelegramTheme {
|
||||
convenience init?(apiTheme: Api.Theme) {
|
||||
switch apiTheme {
|
||||
case let .theme(flags, id, accessHash, slug, title, document):
|
||||
self.init(id: id, accessHash: accessHash, slug: slug, title: title, file: document.flatMap(telegramMediaFileFromApiDocument), isCreator: (flags & 1 << 0) != 0, isDefault: (flags & 1 << 1) != 0)
|
||||
case let .theme(flags, id, accessHash, slug, title, document, installCount):
|
||||
self.init(id: id, accessHash: accessHash, slug: slug, title: title, file: document.flatMap(telegramMediaFileFromApiDocument), isCreator: (flags & 1 << 0) != 0, isDefault: (flags & 1 << 1) != 0, installCount: installCount)
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -278,6 +278,7 @@ private func uploadTheme(account: Account, resource: MediaResource, thumbnailDat
|
||||
public enum CreateThemeError {
|
||||
case generic
|
||||
case slugInvalid
|
||||
case slugOccupied
|
||||
}
|
||||
|
||||
public enum CreateThemeResult {
|
||||
@ -296,6 +297,8 @@ public func createTheme(account: Account, title: String, resource: MediaResource
|
||||
|> mapError { error in
|
||||
if error.errorDescription == "THEME_SLUG_INVALID" {
|
||||
return .slugInvalid
|
||||
} else if error.errorDescription == "THEME_SLUG_OCCUPIED" {
|
||||
return .slugOccupied
|
||||
}
|
||||
return .generic
|
||||
}
|
||||
@ -375,6 +378,8 @@ public func updateTheme(account: Account, accountManager: AccountManager, theme:
|
||||
|> mapError { error in
|
||||
if error.errorDescription == "THEME_SLUG_INVALID" {
|
||||
return .slugInvalid
|
||||
} else if error.errorDescription == "THEME_SLUG_OCCUPIED" {
|
||||
return .slugOccupied
|
||||
}
|
||||
return .generic
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user