mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-17 11:50:56 +00:00
no message
This commit is contained in:
parent
94cf46514d
commit
0acc1c2c89
@ -145,6 +145,8 @@
|
|||||||
D0223A9C1EA5654D00211D94 /* TelegramMediaResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0223A9A1EA5654D00211D94 /* TelegramMediaResource.swift */; };
|
D0223A9C1EA5654D00211D94 /* TelegramMediaResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0223A9A1EA5654D00211D94 /* TelegramMediaResource.swift */; };
|
||||||
D02395D61F8D09A50070F5C2 /* ChannelHistoryAvailabilitySettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = D02395D51F8D09A50070F5C2 /* ChannelHistoryAvailabilitySettings.swift */; };
|
D02395D61F8D09A50070F5C2 /* ChannelHistoryAvailabilitySettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = D02395D51F8D09A50070F5C2 /* ChannelHistoryAvailabilitySettings.swift */; };
|
||||||
D02395D71F8D09A50070F5C2 /* ChannelHistoryAvailabilitySettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = D02395D51F8D09A50070F5C2 /* ChannelHistoryAvailabilitySettings.swift */; };
|
D02395D71F8D09A50070F5C2 /* ChannelHistoryAvailabilitySettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = D02395D51F8D09A50070F5C2 /* ChannelHistoryAvailabilitySettings.swift */; };
|
||||||
|
D026099E20C695AF006C34AC /* Wallpapers.swift in Sources */ = {isa = PBXBuildFile; fileRef = D026099D20C695AF006C34AC /* Wallpapers.swift */; };
|
||||||
|
D026099F20C695AF006C34AC /* Wallpapers.swift in Sources */ = {isa = PBXBuildFile; fileRef = D026099D20C695AF006C34AC /* Wallpapers.swift */; };
|
||||||
D02ABC7B1E30058F00CAE539 /* DeleteMessagesInteractively.swift in Sources */ = {isa = PBXBuildFile; fileRef = D02ABC7A1E30058F00CAE539 /* DeleteMessagesInteractively.swift */; };
|
D02ABC7B1E30058F00CAE539 /* DeleteMessagesInteractively.swift in Sources */ = {isa = PBXBuildFile; fileRef = D02ABC7A1E30058F00CAE539 /* DeleteMessagesInteractively.swift */; };
|
||||||
D02ABC7C1E30058F00CAE539 /* DeleteMessagesInteractively.swift in Sources */ = {isa = PBXBuildFile; fileRef = D02ABC7A1E30058F00CAE539 /* DeleteMessagesInteractively.swift */; };
|
D02ABC7C1E30058F00CAE539 /* DeleteMessagesInteractively.swift in Sources */ = {isa = PBXBuildFile; fileRef = D02ABC7A1E30058F00CAE539 /* DeleteMessagesInteractively.swift */; };
|
||||||
D02ABC7E1E3109F000CAE539 /* CloudChatRemoveMessagesOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = D02ABC7D1E3109F000CAE539 /* CloudChatRemoveMessagesOperation.swift */; };
|
D02ABC7E1E3109F000CAE539 /* CloudChatRemoveMessagesOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = D02ABC7D1E3109F000CAE539 /* CloudChatRemoveMessagesOperation.swift */; };
|
||||||
@ -785,6 +787,7 @@
|
|||||||
D0223A971EA564BD00211D94 /* MediaResourceNetworkStatsTag.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MediaResourceNetworkStatsTag.swift; sourceTree = "<group>"; };
|
D0223A971EA564BD00211D94 /* MediaResourceNetworkStatsTag.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MediaResourceNetworkStatsTag.swift; sourceTree = "<group>"; };
|
||||||
D0223A9A1EA5654D00211D94 /* TelegramMediaResource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TelegramMediaResource.swift; sourceTree = "<group>"; };
|
D0223A9A1EA5654D00211D94 /* TelegramMediaResource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TelegramMediaResource.swift; sourceTree = "<group>"; };
|
||||||
D02395D51F8D09A50070F5C2 /* ChannelHistoryAvailabilitySettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChannelHistoryAvailabilitySettings.swift; sourceTree = "<group>"; };
|
D02395D51F8D09A50070F5C2 /* ChannelHistoryAvailabilitySettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChannelHistoryAvailabilitySettings.swift; sourceTree = "<group>"; };
|
||||||
|
D026099D20C695AF006C34AC /* Wallpapers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Wallpapers.swift; sourceTree = "<group>"; };
|
||||||
D02ABC7A1E30058F00CAE539 /* DeleteMessagesInteractively.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DeleteMessagesInteractively.swift; sourceTree = "<group>"; };
|
D02ABC7A1E30058F00CAE539 /* DeleteMessagesInteractively.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DeleteMessagesInteractively.swift; sourceTree = "<group>"; };
|
||||||
D02ABC7D1E3109F000CAE539 /* CloudChatRemoveMessagesOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CloudChatRemoveMessagesOperation.swift; sourceTree = "<group>"; };
|
D02ABC7D1E3109F000CAE539 /* CloudChatRemoveMessagesOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CloudChatRemoveMessagesOperation.swift; sourceTree = "<group>"; };
|
||||||
D02ABC801E310E5D00CAE539 /* ManagedCloudChatRemoveMessagesOperations.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ManagedCloudChatRemoveMessagesOperations.swift; sourceTree = "<group>"; };
|
D02ABC801E310E5D00CAE539 /* ManagedCloudChatRemoveMessagesOperations.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ManagedCloudChatRemoveMessagesOperations.swift; sourceTree = "<group>"; };
|
||||||
@ -1154,6 +1157,7 @@
|
|||||||
D0B167221F9F972E00976B40 /* LoggingSettings.swift */,
|
D0B167221F9F972E00976B40 /* LoggingSettings.swift */,
|
||||||
D0AF32301FACEDEC0097362B /* CoreSettings.swift */,
|
D0AF32301FACEDEC0097362B /* CoreSettings.swift */,
|
||||||
D0FA08BA2046B37900DD23FC /* ContentPrivacySettings.swift */,
|
D0FA08BA2046B37900DD23FC /* ContentPrivacySettings.swift */,
|
||||||
|
D026099D20C695AF006C34AC /* Wallpapers.swift */,
|
||||||
);
|
);
|
||||||
name = Settings;
|
name = Settings;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -2049,6 +2053,7 @@
|
|||||||
D0546494207386D7002ECC1E /* SecureIdUtilityBillValue.swift in Sources */,
|
D0546494207386D7002ECC1E /* SecureIdUtilityBillValue.swift in Sources */,
|
||||||
D0BC386E1E3FDAB70044D6FE /* CreateGroup.swift in Sources */,
|
D0BC386E1E3FDAB70044D6FE /* CreateGroup.swift in Sources */,
|
||||||
D0FA8BB31E201B02001E855B /* ProcessSecretChatIncomingEncryptedOperations.swift in Sources */,
|
D0FA8BB31E201B02001E855B /* ProcessSecretChatIncomingEncryptedOperations.swift in Sources */,
|
||||||
|
D026099E20C695AF006C34AC /* Wallpapers.swift in Sources */,
|
||||||
D0FC19582020CC4B00FEDBB2 /* TelegramPeerGroupState.swift in Sources */,
|
D0FC19582020CC4B00FEDBB2 /* TelegramPeerGroupState.swift in Sources */,
|
||||||
C205FEA81EB3B75900455808 /* ExportMessageLink.swift in Sources */,
|
C205FEA81EB3B75900455808 /* ExportMessageLink.swift in Sources */,
|
||||||
D06AFE8920BF66BF00EA5124 /* DeserializeFunctionResponse.swift in Sources */,
|
D06AFE8920BF66BF00EA5124 /* DeserializeFunctionResponse.swift in Sources */,
|
||||||
@ -2472,6 +2477,7 @@
|
|||||||
D00BDA1A1EE593D600C64C5E /* TelegramChannelAdminRights.swift in Sources */,
|
D00BDA1A1EE593D600C64C5E /* TelegramChannelAdminRights.swift in Sources */,
|
||||||
D00D34431E6EDD2E0057B307 /* ManagedSynchronizeConsumeMessageContentsOperations.swift in Sources */,
|
D00D34431E6EDD2E0057B307 /* ManagedSynchronizeConsumeMessageContentsOperations.swift in Sources */,
|
||||||
D049EAE91E44B67100A2CD3A /* RecentPeerItem.swift in Sources */,
|
D049EAE91E44B67100A2CD3A /* RecentPeerItem.swift in Sources */,
|
||||||
|
D026099F20C695AF006C34AC /* Wallpapers.swift in Sources */,
|
||||||
D0FA35091EA632E400E56FFA /* CollectCacheUsageStats.swift in Sources */,
|
D0FA35091EA632E400E56FFA /* CollectCacheUsageStats.swift in Sources */,
|
||||||
D0E412EB206AD18E00BEE4A2 /* DecryptedResourceData.swift in Sources */,
|
D0E412EB206AD18E00BEE4A2 /* DecryptedResourceData.swift in Sources */,
|
||||||
D001F3F31E128A1C007A8C60 /* UpdateMessageService.swift in Sources */,
|
D001F3F31E128A1C007A8C60 /* UpdateMessageService.swift in Sources */,
|
||||||
|
|||||||
@ -10,7 +10,9 @@ import Foundation
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
import TelegramCorePrivateModule
|
import TelegramCorePrivateModule
|
||||||
|
#if swift(>=4.0)
|
||||||
import CommonCrypto
|
import CommonCrypto
|
||||||
|
#endif
|
||||||
|
|
||||||
private enum GenerateSecureSecretError {
|
private enum GenerateSecureSecretError {
|
||||||
case generic
|
case generic
|
||||||
|
|||||||
@ -9,7 +9,9 @@ import Foundation
|
|||||||
import MtProtoKitDynamic
|
import MtProtoKitDynamic
|
||||||
#endif
|
#endif
|
||||||
import TelegramCorePrivateModule
|
import TelegramCorePrivateModule
|
||||||
|
#if swift(>=4.0)
|
||||||
import CommonCrypto
|
import CommonCrypto
|
||||||
|
#endif
|
||||||
|
|
||||||
public protocol AccountState: PostboxCoding {
|
public protocol AccountState: PostboxCoding {
|
||||||
func equalsTo(_ other: AccountState) -> Bool
|
func equalsTo(_ other: AccountState) -> Bool
|
||||||
@ -259,6 +261,7 @@ private var declaredEncodables: Void = {
|
|||||||
declareEncodable(TelegramDeviceContactImportInfo.self, f: { TelegramDeviceContactImportInfo(decoder: $0) })
|
declareEncodable(TelegramDeviceContactImportInfo.self, f: { TelegramDeviceContactImportInfo(decoder: $0) })
|
||||||
declareEncodable(SecureFileMediaResource.self, f: { SecureFileMediaResource(decoder: $0) })
|
declareEncodable(SecureFileMediaResource.self, f: { SecureFileMediaResource(decoder: $0) })
|
||||||
declareEncodable(CachedStickerQueryResult.self, f: { CachedStickerQueryResult(decoder: $0) })
|
declareEncodable(CachedStickerQueryResult.self, f: { CachedStickerQueryResult(decoder: $0) })
|
||||||
|
declareEncodable(TelegramWallpaper.self, f: { TelegramWallpaper(decoder: $0) })
|
||||||
|
|
||||||
return
|
return
|
||||||
}()
|
}()
|
||||||
@ -431,7 +434,7 @@ func sha512Digest(_ data : Data) -> Data {
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
public func verifyPassword(_ account: UnauthorizedAccount, password: String) -> Signal<Api.auth.Authorization, MTRpcError> {
|
func verifyPassword(_ account: UnauthorizedAccount, password: String) -> Signal<Api.auth.Authorization, MTRpcError> {
|
||||||
return twoStepAuthData(account.network)
|
return twoStepAuthData(account.network)
|
||||||
|> mapToSignal { authData -> Signal<Api.auth.Authorization, MTRpcError> in
|
|> mapToSignal { authData -> Signal<Api.auth.Authorization, MTRpcError> in
|
||||||
var data = Data()
|
var data = Data()
|
||||||
|
|||||||
@ -349,7 +349,7 @@ public final class UnauthorizedAccountState: AccountState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public extension SentAuthorizationCodeType {
|
extension SentAuthorizationCodeType {
|
||||||
init(apiType: Api.auth.SentCodeType) {
|
init(apiType: Api.auth.SentCodeType) {
|
||||||
switch apiType {
|
switch apiType {
|
||||||
case let .sentCodeTypeApp(length):
|
case let .sentCodeTypeApp(length):
|
||||||
@ -364,7 +364,7 @@ public extension SentAuthorizationCodeType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public extension AuthorizationCodeNextType {
|
extension AuthorizationCodeNextType {
|
||||||
init(apiType: Api.auth.CodeType) {
|
init(apiType: Api.auth.CodeType) {
|
||||||
switch apiType {
|
switch apiType {
|
||||||
case .codeTypeSms:
|
case .codeTypeSms:
|
||||||
|
|||||||
@ -621,8 +621,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
return dict
|
return dict
|
||||||
}()
|
}()
|
||||||
|
|
||||||
public struct Api {
|
struct Api {
|
||||||
public static func parse(_ buffer: Buffer) -> Any? {
|
static func parse(_ buffer: Buffer) -> Any? {
|
||||||
let reader = BufferReader(buffer)
|
let reader = BufferReader(buffer)
|
||||||
if let signature = reader.readInt32() {
|
if let signature = reader.readInt32() {
|
||||||
return parse(reader, signature: signature)
|
return parse(reader, signature: signature)
|
||||||
@ -675,7 +675,7 @@ public struct Api {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func serializeObject(_ object: Any, buffer: Buffer, boxed: Swift.Bool) {
|
static func serializeObject(_ object: Any, buffer: Buffer, boxed: Swift.Bool) {
|
||||||
switch object {
|
switch object {
|
||||||
case let _1 as Api.messages.StickerSet:
|
case let _1 as Api.messages.StickerSet:
|
||||||
_1.serialize(buffer, boxed)
|
_1.serialize(buffer, boxed)
|
||||||
@ -1101,12 +1101,12 @@ public struct Api {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public extension Api {
|
extension Api {
|
||||||
public struct messages {
|
struct messages {
|
||||||
public enum StickerSet {
|
enum StickerSet {
|
||||||
case stickerSet(set: Api.StickerSet, packs: [Api.StickerPack], documents: [Api.Document])
|
case stickerSet(set: Api.StickerSet, packs: [Api.StickerPack], documents: [Api.Document])
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .stickerSet(let set, let packs, let documents):
|
case .stickerSet(let set, let packs, let documents):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -1152,10 +1152,10 @@ public struct messages {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum ArchivedStickers {
|
enum ArchivedStickers {
|
||||||
case archivedStickers(count: Int32, sets: [Api.StickerSetCovered])
|
case archivedStickers(count: Int32, sets: [Api.StickerSetCovered])
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .archivedStickers(let count, let sets):
|
case .archivedStickers(let count, let sets):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -1189,11 +1189,11 @@ public struct messages {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum SentEncryptedMessage {
|
enum SentEncryptedMessage {
|
||||||
case sentEncryptedMessage(date: Int32)
|
case sentEncryptedMessage(date: Int32)
|
||||||
case sentEncryptedFile(date: Int32, file: Api.EncryptedFile)
|
case sentEncryptedFile(date: Int32, file: Api.EncryptedFile)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .sentEncryptedMessage(let date):
|
case .sentEncryptedMessage(let date):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -1240,11 +1240,11 @@ public struct messages {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum Stickers {
|
enum Stickers {
|
||||||
case stickersNotModified
|
case stickersNotModified
|
||||||
case stickers(hash: Int32, stickers: [Api.Document])
|
case stickers(hash: Int32, stickers: [Api.Document])
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .stickersNotModified:
|
case .stickersNotModified:
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -1287,11 +1287,11 @@ public struct messages {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum FoundStickerSets {
|
enum FoundStickerSets {
|
||||||
case foundStickerSetsNotModified
|
case foundStickerSetsNotModified
|
||||||
case foundStickerSets(hash: Int32, sets: [Api.StickerSetCovered])
|
case foundStickerSets(hash: Int32, sets: [Api.StickerSetCovered])
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .foundStickerSetsNotModified:
|
case .foundStickerSetsNotModified:
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -1334,10 +1334,10 @@ public struct messages {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum FoundGifs {
|
enum FoundGifs {
|
||||||
case foundGifs(nextOffset: Int32, results: [Api.FoundGif])
|
case foundGifs(nextOffset: Int32, results: [Api.FoundGif])
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .foundGifs(let nextOffset, let results):
|
case .foundGifs(let nextOffset, let results):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -1371,10 +1371,10 @@ public struct messages {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum BotResults {
|
enum BotResults {
|
||||||
case botResults(flags: Int32, queryId: Int64, nextOffset: String?, switchPm: Api.InlineBotSwitchPM?, results: [Api.BotInlineResult], cacheTime: Int32, users: [Api.User])
|
case botResults(flags: Int32, queryId: Int64, nextOffset: String?, switchPm: Api.InlineBotSwitchPM?, results: [Api.BotInlineResult], cacheTime: Int32, users: [Api.User])
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .botResults(let flags, let queryId, let nextOffset, let switchPm, let results, let cacheTime, let users):
|
case .botResults(let flags, let queryId, let nextOffset, let switchPm, let results, let cacheTime, let users):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -1436,10 +1436,10 @@ public struct messages {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum BotCallbackAnswer {
|
enum BotCallbackAnswer {
|
||||||
case botCallbackAnswer(flags: Int32, message: String?, url: String?, cacheTime: Int32)
|
case botCallbackAnswer(flags: Int32, message: String?, url: String?, cacheTime: Int32)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .botCallbackAnswer(let flags, let message, let url, let cacheTime):
|
case .botCallbackAnswer(let flags, let message, let url, let cacheTime):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -1475,11 +1475,11 @@ public struct messages {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum Chats {
|
enum Chats {
|
||||||
case chats(chats: [Api.Chat])
|
case chats(chats: [Api.Chat])
|
||||||
case chatsSlice(count: Int32, chats: [Api.Chat])
|
case chatsSlice(count: Int32, chats: [Api.Chat])
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .chats(let chats):
|
case .chats(let chats):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -1536,11 +1536,11 @@ public struct messages {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum DhConfig {
|
enum DhConfig {
|
||||||
case dhConfigNotModified(random: Buffer)
|
case dhConfigNotModified(random: Buffer)
|
||||||
case dhConfig(g: Int32, p: Buffer, version: Int32, random: Buffer)
|
case dhConfig(g: Int32, p: Buffer, version: Int32, random: Buffer)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .dhConfigNotModified(let random):
|
case .dhConfigNotModified(let random):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -1593,10 +1593,10 @@ public struct messages {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum AffectedHistory {
|
enum AffectedHistory {
|
||||||
case affectedHistory(pts: Int32, ptsCount: Int32, offset: Int32)
|
case affectedHistory(pts: Int32, ptsCount: Int32, offset: Int32)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .affectedHistory(let pts, let ptsCount, let offset):
|
case .affectedHistory(let pts, let ptsCount, let offset):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -1628,10 +1628,10 @@ public struct messages {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum MessageEditData {
|
enum MessageEditData {
|
||||||
case messageEditData(flags: Int32)
|
case messageEditData(flags: Int32)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .messageEditData(let flags):
|
case .messageEditData(let flags):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -1655,10 +1655,10 @@ public struct messages {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum ChatFull {
|
enum ChatFull {
|
||||||
case chatFull(fullChat: Api.ChatFull, chats: [Api.Chat], users: [Api.User])
|
case chatFull(fullChat: Api.ChatFull, chats: [Api.Chat], users: [Api.User])
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .chatFull(let fullChat, let chats, let users):
|
case .chatFull(let fullChat, let chats, let users):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -1704,11 +1704,11 @@ public struct messages {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum StickerSetInstallResult {
|
enum StickerSetInstallResult {
|
||||||
case stickerSetInstallResultSuccess
|
case stickerSetInstallResultSuccess
|
||||||
case stickerSetInstallResultArchive(sets: [Api.StickerSetCovered])
|
case stickerSetInstallResultArchive(sets: [Api.StickerSetCovered])
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .stickerSetInstallResultSuccess:
|
case .stickerSetInstallResultSuccess:
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -1747,10 +1747,10 @@ public struct messages {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum AffectedMessages {
|
enum AffectedMessages {
|
||||||
case affectedMessages(pts: Int32, ptsCount: Int32)
|
case affectedMessages(pts: Int32, ptsCount: Int32)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .affectedMessages(let pts, let ptsCount):
|
case .affectedMessages(let pts, let ptsCount):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -1778,11 +1778,11 @@ public struct messages {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum SavedGifs {
|
enum SavedGifs {
|
||||||
case savedGifsNotModified
|
case savedGifsNotModified
|
||||||
case savedGifs(hash: Int32, gifs: [Api.Document])
|
case savedGifs(hash: Int32, gifs: [Api.Document])
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .savedGifsNotModified:
|
case .savedGifsNotModified:
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -1825,13 +1825,13 @@ public struct messages {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum Messages {
|
enum Messages {
|
||||||
case messages(messages: [Api.Message], chats: [Api.Chat], users: [Api.User])
|
case messages(messages: [Api.Message], chats: [Api.Chat], users: [Api.User])
|
||||||
case messagesSlice(count: Int32, messages: [Api.Message], chats: [Api.Chat], users: [Api.User])
|
case messagesSlice(count: Int32, messages: [Api.Message], chats: [Api.Chat], users: [Api.User])
|
||||||
case channelMessages(flags: Int32, pts: Int32, count: Int32, messages: [Api.Message], chats: [Api.Chat], users: [Api.User])
|
case channelMessages(flags: Int32, pts: Int32, count: Int32, messages: [Api.Message], chats: [Api.Chat], users: [Api.User])
|
||||||
case messagesNotModified(count: Int32)
|
case messagesNotModified(count: Int32)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .messages(let messages, let chats, let users):
|
case .messages(let messages, let chats, let users):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -2000,10 +2000,10 @@ public struct messages {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum PeerDialogs {
|
enum PeerDialogs {
|
||||||
case peerDialogs(dialogs: [Api.Dialog], messages: [Api.Message], chats: [Api.Chat], users: [Api.User], state: Api.updates.State)
|
case peerDialogs(dialogs: [Api.Dialog], messages: [Api.Message], chats: [Api.Chat], users: [Api.User], state: Api.updates.State)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .peerDialogs(let dialogs, let messages, let chats, let users, let state):
|
case .peerDialogs(let dialogs, let messages, let chats, let users, let state):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -2069,11 +2069,11 @@ public struct messages {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum RecentStickers {
|
enum RecentStickers {
|
||||||
case recentStickersNotModified
|
case recentStickersNotModified
|
||||||
case recentStickers(hash: Int32, packs: [Api.StickerPack], stickers: [Api.Document], dates: [Int32])
|
case recentStickers(hash: Int32, packs: [Api.StickerPack], stickers: [Api.Document], dates: [Int32])
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .recentStickersNotModified:
|
case .recentStickersNotModified:
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -2136,11 +2136,11 @@ public struct messages {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum FeaturedStickers {
|
enum FeaturedStickers {
|
||||||
case featuredStickersNotModified
|
case featuredStickersNotModified
|
||||||
case featuredStickers(hash: Int32, sets: [Api.StickerSetCovered], unread: [Int64])
|
case featuredStickers(hash: Int32, sets: [Api.StickerSetCovered], unread: [Int64])
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .featuredStickersNotModified:
|
case .featuredStickersNotModified:
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -2193,11 +2193,11 @@ public struct messages {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum Dialogs {
|
enum Dialogs {
|
||||||
case dialogs(dialogs: [Api.Dialog], messages: [Api.Message], chats: [Api.Chat], users: [Api.User])
|
case dialogs(dialogs: [Api.Dialog], messages: [Api.Message], chats: [Api.Chat], users: [Api.User])
|
||||||
case dialogsSlice(count: Int32, dialogs: [Api.Dialog], messages: [Api.Message], chats: [Api.Chat], users: [Api.User])
|
case dialogsSlice(count: Int32, dialogs: [Api.Dialog], messages: [Api.Message], chats: [Api.Chat], users: [Api.User])
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .dialogs(let dialogs, let messages, let chats, let users):
|
case .dialogs(let dialogs, let messages, let chats, let users):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -2314,11 +2314,11 @@ public struct messages {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum FavedStickers {
|
enum FavedStickers {
|
||||||
case favedStickersNotModified
|
case favedStickersNotModified
|
||||||
case favedStickers(hash: Int32, packs: [Api.StickerPack], stickers: [Api.Document])
|
case favedStickers(hash: Int32, packs: [Api.StickerPack], stickers: [Api.Document])
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .favedStickersNotModified:
|
case .favedStickersNotModified:
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -2371,11 +2371,11 @@ public struct messages {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum AllStickers {
|
enum AllStickers {
|
||||||
case allStickersNotModified
|
case allStickersNotModified
|
||||||
case allStickers(hash: Int32, sets: [Api.StickerSet])
|
case allStickers(hash: Int32, sets: [Api.StickerSet])
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .allStickersNotModified:
|
case .allStickersNotModified:
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -2418,10 +2418,10 @@ public struct messages {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum HighScores {
|
enum HighScores {
|
||||||
case highScores(scores: [Api.HighScore], users: [Api.User])
|
case highScores(scores: [Api.HighScore], users: [Api.User])
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .highScores(let scores, let users):
|
case .highScores(let scores, let users):
|
||||||
if boxed {
|
if boxed {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,10 @@
|
|||||||
public extension Api {
|
extension Api {
|
||||||
public struct channels {
|
struct channels {
|
||||||
public enum ChannelParticipants {
|
enum ChannelParticipants {
|
||||||
case channelParticipants(count: Int32, participants: [Api.ChannelParticipant], users: [Api.User])
|
case channelParticipants(count: Int32, participants: [Api.ChannelParticipant], users: [Api.User])
|
||||||
case channelParticipantsNotModified
|
case channelParticipantsNotModified
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .channelParticipants(let count, let participants, let users):
|
case .channelParticipants(let count, let participants, let users):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -57,10 +57,10 @@ public struct channels {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum ChannelParticipant {
|
enum ChannelParticipant {
|
||||||
case channelParticipant(participant: Api.ChannelParticipant, users: [Api.User])
|
case channelParticipant(participant: Api.ChannelParticipant, users: [Api.User])
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .channelParticipant(let participant, let users):
|
case .channelParticipant(let participant, let users):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -96,10 +96,10 @@ public struct channels {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum AdminLogResults {
|
enum AdminLogResults {
|
||||||
case adminLogResults(events: [Api.ChannelAdminLogEvent], chats: [Api.Chat], users: [Api.User])
|
case adminLogResults(events: [Api.ChannelAdminLogEvent], chats: [Api.Chat], users: [Api.User])
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .adminLogResults(let events, let chats, let users):
|
case .adminLogResults(let events, let chats, let users):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -151,12 +151,12 @@ public struct channels {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public extension Api {
|
extension Api {
|
||||||
public struct payments {
|
struct payments {
|
||||||
public enum ValidatedRequestedInfo {
|
enum ValidatedRequestedInfo {
|
||||||
case validatedRequestedInfo(flags: Int32, id: String?, shippingOptions: [Api.ShippingOption]?)
|
case validatedRequestedInfo(flags: Int32, id: String?, shippingOptions: [Api.ShippingOption]?)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .validatedRequestedInfo(let flags, let id, let shippingOptions):
|
case .validatedRequestedInfo(let flags, let id, let shippingOptions):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -194,11 +194,11 @@ public struct payments {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum PaymentResult {
|
enum PaymentResult {
|
||||||
case paymentResult(updates: Api.Updates)
|
case paymentResult(updates: Api.Updates)
|
||||||
case paymentVerficationNeeded(url: String)
|
case paymentVerficationNeeded(url: String)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .paymentResult(let updates):
|
case .paymentResult(let updates):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -241,10 +241,10 @@ public struct payments {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum PaymentForm {
|
enum PaymentForm {
|
||||||
case paymentForm(flags: Int32, botId: Int32, invoice: Api.Invoice, providerId: Int32, url: String, nativeProvider: String?, nativeParams: Api.DataJSON?, savedInfo: Api.PaymentRequestedInfo?, savedCredentials: Api.PaymentSavedCredentials?, users: [Api.User])
|
case paymentForm(flags: Int32, botId: Int32, invoice: Api.Invoice, providerId: Int32, url: String, nativeProvider: String?, nativeParams: Api.DataJSON?, savedInfo: Api.PaymentRequestedInfo?, savedCredentials: Api.PaymentSavedCredentials?, users: [Api.User])
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .paymentForm(let flags, let botId, let invoice, let providerId, let url, let nativeProvider, let nativeParams, let savedInfo, let savedCredentials, let users):
|
case .paymentForm(let flags, let botId, let invoice, let providerId, let url, let nativeProvider, let nativeParams, let savedInfo, let savedCredentials, let users):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -318,10 +318,10 @@ public struct payments {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum PaymentReceipt {
|
enum PaymentReceipt {
|
||||||
case paymentReceipt(flags: Int32, date: Int32, botId: Int32, invoice: Api.Invoice, providerId: Int32, info: Api.PaymentRequestedInfo?, shipping: Api.ShippingOption?, currency: String, totalAmount: Int64, credentialsTitle: String, users: [Api.User])
|
case paymentReceipt(flags: Int32, date: Int32, botId: Int32, invoice: Api.Invoice, providerId: Int32, info: Api.PaymentRequestedInfo?, shipping: Api.ShippingOption?, currency: String, totalAmount: Int64, credentialsTitle: String, users: [Api.User])
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .paymentReceipt(let flags, let date, let botId, let invoice, let providerId, let info, let shipping, let currency, let totalAmount, let credentialsTitle, let users):
|
case .paymentReceipt(let flags, let date, let botId, let invoice, let providerId, let info, let shipping, let currency, let totalAmount, let credentialsTitle, let users):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -397,10 +397,10 @@ public struct payments {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum SavedInfo {
|
enum SavedInfo {
|
||||||
case savedInfo(flags: Int32, savedInfo: Api.PaymentRequestedInfo?)
|
case savedInfo(flags: Int32, savedInfo: Api.PaymentRequestedInfo?)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .savedInfo(let flags, let savedInfo):
|
case .savedInfo(let flags, let savedInfo):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -432,12 +432,12 @@ public struct payments {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public extension Api {
|
extension Api {
|
||||||
public struct auth {
|
struct auth {
|
||||||
public enum Authorization {
|
enum Authorization {
|
||||||
case authorization(flags: Int32, tmpSessions: Int32?, user: Api.User)
|
case authorization(flags: Int32, tmpSessions: Int32?, user: Api.User)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .authorization(let flags, let tmpSessions, let user):
|
case .authorization(let flags, let tmpSessions, let user):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -471,10 +471,10 @@ public struct auth {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum PasswordRecovery {
|
enum PasswordRecovery {
|
||||||
case passwordRecovery(emailPattern: String)
|
case passwordRecovery(emailPattern: String)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .passwordRecovery(let emailPattern):
|
case .passwordRecovery(let emailPattern):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -498,10 +498,10 @@ public struct auth {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum ExportedAuthorization {
|
enum ExportedAuthorization {
|
||||||
case exportedAuthorization(id: Int32, bytes: Buffer)
|
case exportedAuthorization(id: Int32, bytes: Buffer)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .exportedAuthorization(let id, let bytes):
|
case .exportedAuthorization(let id, let bytes):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -529,10 +529,10 @@ public struct auth {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum CheckedPhone {
|
enum CheckedPhone {
|
||||||
case checkedPhone(phoneRegistered: Api.Bool)
|
case checkedPhone(phoneRegistered: Api.Bool)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .checkedPhone(let phoneRegistered):
|
case .checkedPhone(let phoneRegistered):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -558,10 +558,10 @@ public struct auth {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum SentCode {
|
enum SentCode {
|
||||||
case sentCode(flags: Int32, type: Api.auth.SentCodeType, phoneCodeHash: String, nextType: Api.auth.CodeType?, timeout: Int32?, termsOfService: Api.help.TermsOfService?)
|
case sentCode(flags: Int32, type: Api.auth.SentCodeType, phoneCodeHash: String, nextType: Api.auth.CodeType?, timeout: Int32?, termsOfService: Api.help.TermsOfService?)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .sentCode(let flags, let type, let phoneCodeHash, let nextType, let timeout, let termsOfService):
|
case .sentCode(let flags, let type, let phoneCodeHash, let nextType, let timeout, let termsOfService):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -611,12 +611,12 @@ public struct auth {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum CodeType {
|
enum CodeType {
|
||||||
case codeTypeSms
|
case codeTypeSms
|
||||||
case codeTypeCall
|
case codeTypeCall
|
||||||
case codeTypeFlashCall
|
case codeTypeFlashCall
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .codeTypeSms:
|
case .codeTypeSms:
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -650,13 +650,13 @@ public struct auth {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum SentCodeType {
|
enum SentCodeType {
|
||||||
case sentCodeTypeApp(length: Int32)
|
case sentCodeTypeApp(length: Int32)
|
||||||
case sentCodeTypeSms(length: Int32)
|
case sentCodeTypeSms(length: Int32)
|
||||||
case sentCodeTypeCall(length: Int32)
|
case sentCodeTypeCall(length: Int32)
|
||||||
case sentCodeTypeFlashCall(pattern: String)
|
case sentCodeTypeFlashCall(pattern: String)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .sentCodeTypeApp(let length):
|
case .sentCodeTypeApp(let length):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -733,13 +733,13 @@ public struct auth {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public extension Api {
|
extension Api {
|
||||||
public struct contacts {
|
struct contacts {
|
||||||
public enum Blocked {
|
enum Blocked {
|
||||||
case blocked(blocked: [Api.ContactBlocked], users: [Api.User])
|
case blocked(blocked: [Api.ContactBlocked], users: [Api.User])
|
||||||
case blockedSlice(count: Int32, blocked: [Api.ContactBlocked], users: [Api.User])
|
case blockedSlice(count: Int32, blocked: [Api.ContactBlocked], users: [Api.User])
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .blocked(let blocked, let users):
|
case .blocked(let blocked, let users):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -816,11 +816,11 @@ public struct contacts {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum Contacts {
|
enum Contacts {
|
||||||
case contactsNotModified
|
case contactsNotModified
|
||||||
case contacts(contacts: [Api.Contact], savedCount: Int32, users: [Api.User])
|
case contacts(contacts: [Api.Contact], savedCount: Int32, users: [Api.User])
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .contactsNotModified:
|
case .contactsNotModified:
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -873,10 +873,10 @@ public struct contacts {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum ResolvedPeer {
|
enum ResolvedPeer {
|
||||||
case resolvedPeer(peer: Api.Peer, chats: [Api.Chat], users: [Api.User])
|
case resolvedPeer(peer: Api.Peer, chats: [Api.Chat], users: [Api.User])
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .resolvedPeer(let peer, let chats, let users):
|
case .resolvedPeer(let peer, let chats, let users):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -922,10 +922,10 @@ public struct contacts {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum Link {
|
enum Link {
|
||||||
case link(myLink: Api.ContactLink, foreignLink: Api.ContactLink, user: Api.User)
|
case link(myLink: Api.ContactLink, foreignLink: Api.ContactLink, user: Api.User)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .link(let myLink, let foreignLink, let user):
|
case .link(let myLink, let foreignLink, let user):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -963,10 +963,10 @@ public struct contacts {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum ImportedContacts {
|
enum ImportedContacts {
|
||||||
case importedContacts(imported: [Api.ImportedContact], popularInvites: [Api.PopularContact], retryContacts: [Int64], users: [Api.User])
|
case importedContacts(imported: [Api.ImportedContact], popularInvites: [Api.PopularContact], retryContacts: [Int64], users: [Api.User])
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .importedContacts(let imported, let popularInvites, let retryContacts, let users):
|
case .importedContacts(let imported, let popularInvites, let retryContacts, let users):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -1026,10 +1026,10 @@ public struct contacts {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum Found {
|
enum Found {
|
||||||
case found(myResults: [Api.Peer], results: [Api.Peer], chats: [Api.Chat], users: [Api.User])
|
case found(myResults: [Api.Peer], results: [Api.Peer], chats: [Api.Chat], users: [Api.User])
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .found(let myResults, let results, let chats, let users):
|
case .found(let myResults, let results, let chats, let users):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -1089,11 +1089,11 @@ public struct contacts {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum TopPeers {
|
enum TopPeers {
|
||||||
case topPeersNotModified
|
case topPeersNotModified
|
||||||
case topPeers(categories: [Api.TopPeerCategoryPeers], chats: [Api.Chat], users: [Api.User])
|
case topPeers(categories: [Api.TopPeerCategoryPeers], chats: [Api.Chat], users: [Api.User])
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .topPeersNotModified:
|
case .topPeersNotModified:
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -1154,13 +1154,13 @@ public struct contacts {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public extension Api {
|
extension Api {
|
||||||
public struct help {
|
struct help {
|
||||||
public enum AppUpdate {
|
enum AppUpdate {
|
||||||
case appUpdate(id: Int32, critical: Api.Bool, url: String, text: String)
|
case appUpdate(id: Int32, critical: Api.Bool, url: String, text: String)
|
||||||
case noAppUpdate
|
case noAppUpdate
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .appUpdate(let id, let critical, let url, let text):
|
case .appUpdate(let id, let critical, let url, let text):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -1207,11 +1207,11 @@ public struct help {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum ProxyData {
|
enum ProxyData {
|
||||||
case proxyDataEmpty(expires: Int32)
|
case proxyDataEmpty(expires: Int32)
|
||||||
case proxyDataPromo(expires: Int32, peer: Api.Peer, chats: [Api.Chat], users: [Api.User])
|
case proxyDataPromo(expires: Int32, peer: Api.Peer, chats: [Api.Chat], users: [Api.User])
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .proxyDataEmpty(let expires):
|
case .proxyDataEmpty(let expires):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -1278,10 +1278,10 @@ public struct help {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum TermsOfService {
|
enum TermsOfService {
|
||||||
case termsOfService(flags: Int32, id: Api.DataJSON, text: String, entities: [Api.MessageEntity], minAgeConfirm: Int32?)
|
case termsOfService(flags: Int32, id: Api.DataJSON, text: String, entities: [Api.MessageEntity], minAgeConfirm: Int32?)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .termsOfService(let flags, let id, let text, let entities, let minAgeConfirm):
|
case .termsOfService(let flags, let id, let text, let entities, let minAgeConfirm):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -1329,10 +1329,10 @@ public struct help {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum RecentMeUrls {
|
enum RecentMeUrls {
|
||||||
case recentMeUrls(urls: [Api.RecentMeUrl], chats: [Api.Chat], users: [Api.User])
|
case recentMeUrls(urls: [Api.RecentMeUrl], chats: [Api.Chat], users: [Api.User])
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .recentMeUrls(let urls, let chats, let users):
|
case .recentMeUrls(let urls, let chats, let users):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -1382,10 +1382,10 @@ public struct help {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum Support {
|
enum Support {
|
||||||
case support(phoneNumber: String, user: Api.User)
|
case support(phoneNumber: String, user: Api.User)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .support(let phoneNumber, let user):
|
case .support(let phoneNumber, let user):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -1415,10 +1415,10 @@ public struct help {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum InviteText {
|
enum InviteText {
|
||||||
case inviteText(message: String)
|
case inviteText(message: String)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .inviteText(let message):
|
case .inviteText(let message):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -1442,11 +1442,11 @@ public struct help {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum TermsOfServiceUpdate {
|
enum TermsOfServiceUpdate {
|
||||||
case termsOfServiceUpdateEmpty(expires: Int32)
|
case termsOfServiceUpdateEmpty(expires: Int32)
|
||||||
case termsOfServiceUpdate(expires: Int32, termsOfService: Api.help.TermsOfService)
|
case termsOfServiceUpdate(expires: Int32, termsOfService: Api.help.TermsOfService)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .termsOfServiceUpdateEmpty(let expires):
|
case .termsOfServiceUpdateEmpty(let expires):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -1495,15 +1495,15 @@ public struct help {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public extension Api {
|
extension Api {
|
||||||
public struct updates {
|
struct updates {
|
||||||
public enum Difference {
|
enum Difference {
|
||||||
case differenceEmpty(date: Int32, seq: Int32)
|
case differenceEmpty(date: Int32, seq: Int32)
|
||||||
case difference(newMessages: [Api.Message], newEncryptedMessages: [Api.EncryptedMessage], otherUpdates: [Api.Update], chats: [Api.Chat], users: [Api.User], state: Api.updates.State)
|
case difference(newMessages: [Api.Message], newEncryptedMessages: [Api.EncryptedMessage], otherUpdates: [Api.Update], chats: [Api.Chat], users: [Api.User], state: Api.updates.State)
|
||||||
case differenceSlice(newMessages: [Api.Message], newEncryptedMessages: [Api.EncryptedMessage], otherUpdates: [Api.Update], chats: [Api.Chat], users: [Api.User], intermediateState: Api.updates.State)
|
case differenceSlice(newMessages: [Api.Message], newEncryptedMessages: [Api.EncryptedMessage], otherUpdates: [Api.Update], chats: [Api.Chat], users: [Api.User], intermediateState: Api.updates.State)
|
||||||
case differenceTooLong(pts: Int32)
|
case differenceTooLong(pts: Int32)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .differenceEmpty(let date, let seq):
|
case .differenceEmpty(let date, let seq):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -1686,10 +1686,10 @@ public struct updates {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum State {
|
enum State {
|
||||||
case state(pts: Int32, qts: Int32, date: Int32, seq: Int32, unreadCount: Int32)
|
case state(pts: Int32, qts: Int32, date: Int32, seq: Int32, unreadCount: Int32)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .state(let pts, let qts, let date, let seq, let unreadCount):
|
case .state(let pts, let qts, let date, let seq, let unreadCount):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -1729,12 +1729,12 @@ public struct updates {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum ChannelDifference {
|
enum ChannelDifference {
|
||||||
case channelDifferenceEmpty(flags: Int32, pts: Int32, timeout: Int32?)
|
case channelDifferenceEmpty(flags: Int32, pts: Int32, timeout: Int32?)
|
||||||
case channelDifferenceTooLong(flags: Int32, pts: Int32, timeout: Int32?, topMessage: Int32, readInboxMaxId: Int32, readOutboxMaxId: Int32, unreadCount: Int32, unreadMentionsCount: Int32, messages: [Api.Message], chats: [Api.Chat], users: [Api.User])
|
case channelDifferenceTooLong(flags: Int32, pts: Int32, timeout: Int32?, topMessage: Int32, readInboxMaxId: Int32, readOutboxMaxId: Int32, unreadCount: Int32, unreadMentionsCount: Int32, messages: [Api.Message], chats: [Api.Chat], users: [Api.User])
|
||||||
case channelDifference(flags: Int32, pts: Int32, timeout: Int32?, newMessages: [Api.Message], otherUpdates: [Api.Update], chats: [Api.Chat], users: [Api.User])
|
case channelDifference(flags: Int32, pts: Int32, timeout: Int32?, newMessages: [Api.Message], otherUpdates: [Api.Update], chats: [Api.Chat], users: [Api.User])
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .channelDifferenceEmpty(let flags, let pts, let timeout):
|
case .channelDifferenceEmpty(let flags, let pts, let timeout):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -1908,12 +1908,12 @@ public struct updates {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public extension Api {
|
extension Api {
|
||||||
public struct upload {
|
struct upload {
|
||||||
public enum WebFile {
|
enum WebFile {
|
||||||
case webFile(size: Int32, mimeType: String, fileType: Api.storage.FileType, mtime: Int32, bytes: Buffer)
|
case webFile(size: Int32, mimeType: String, fileType: Api.storage.FileType, mtime: Int32, bytes: Buffer)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .webFile(let size, let mimeType, let fileType, let mtime, let bytes):
|
case .webFile(let size, let mimeType, let fileType, let mtime, let bytes):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -1955,11 +1955,11 @@ public struct upload {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum File {
|
enum File {
|
||||||
case file(type: Api.storage.FileType, mtime: Int32, bytes: Buffer)
|
case file(type: Api.storage.FileType, mtime: Int32, bytes: Buffer)
|
||||||
case fileCdnRedirect(dcId: Int32, fileToken: Buffer, encryptionKey: Buffer, encryptionIv: Buffer, fileHashes: [Api.FileHash])
|
case fileCdnRedirect(dcId: Int32, fileToken: Buffer, encryptionKey: Buffer, encryptionIv: Buffer, fileHashes: [Api.FileHash])
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .file(let type, let mtime, let bytes):
|
case .file(let type, let mtime, let bytes):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -2032,11 +2032,11 @@ public struct upload {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum CdnFile {
|
enum CdnFile {
|
||||||
case cdnFileReuploadNeeded(requestToken: Buffer)
|
case cdnFileReuploadNeeded(requestToken: Buffer)
|
||||||
case cdnFile(bytes: Buffer)
|
case cdnFile(bytes: Buffer)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .cdnFileReuploadNeeded(let requestToken):
|
case .cdnFileReuploadNeeded(let requestToken):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -2079,9 +2079,9 @@ public struct upload {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public extension Api {
|
extension Api {
|
||||||
public struct storage {
|
struct storage {
|
||||||
public enum FileType {
|
enum FileType {
|
||||||
case fileUnknown
|
case fileUnknown
|
||||||
case filePartial
|
case filePartial
|
||||||
case fileJpeg
|
case fileJpeg
|
||||||
@ -2093,7 +2093,7 @@ public struct storage {
|
|||||||
case fileMp4
|
case fileMp4
|
||||||
case fileWebp
|
case fileWebp
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .fileUnknown:
|
case .fileUnknown:
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -2192,12 +2192,12 @@ public struct storage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public extension Api {
|
extension Api {
|
||||||
public struct account {
|
struct account {
|
||||||
public enum TmpPassword {
|
enum TmpPassword {
|
||||||
case tmpPassword(tmpPassword: Buffer, validUntil: Int32)
|
case tmpPassword(tmpPassword: Buffer, validUntil: Int32)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .tmpPassword(let tmpPassword, let validUntil):
|
case .tmpPassword(let tmpPassword, let validUntil):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -2225,10 +2225,10 @@ public struct account {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum PasswordSettings {
|
enum PasswordSettings {
|
||||||
case passwordSettings(email: String)
|
case passwordSettings(email: String)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .passwordSettings(let email):
|
case .passwordSettings(let email):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -2252,10 +2252,10 @@ public struct account {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum PasswordInputSettings {
|
enum PasswordInputSettings {
|
||||||
case passwordInputSettings(flags: Int32, newSalt: Buffer?, newPasswordHash: Buffer?, hint: String?, email: String?)
|
case passwordInputSettings(flags: Int32, newSalt: Buffer?, newPasswordHash: Buffer?, hint: String?, email: String?)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .passwordInputSettings(let flags, let newSalt, let newPasswordHash, let hint, let email):
|
case .passwordInputSettings(let flags, let newSalt, let newPasswordHash, let hint, let email):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -2295,10 +2295,10 @@ public struct account {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum WebAuthorizations {
|
enum WebAuthorizations {
|
||||||
case webAuthorizations(authorizations: [Api.WebAuthorization], users: [Api.User])
|
case webAuthorizations(authorizations: [Api.WebAuthorization], users: [Api.User])
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .webAuthorizations(let authorizations, let users):
|
case .webAuthorizations(let authorizations, let users):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -2338,10 +2338,10 @@ public struct account {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum Authorizations {
|
enum Authorizations {
|
||||||
case authorizations(authorizations: [Api.Authorization])
|
case authorizations(authorizations: [Api.Authorization])
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .authorizations(let authorizations):
|
case .authorizations(let authorizations):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -2371,11 +2371,11 @@ public struct account {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum Password {
|
enum Password {
|
||||||
case noPassword(newSalt: Buffer, emailUnconfirmedPattern: String)
|
case noPassword(newSalt: Buffer, emailUnconfirmedPattern: String)
|
||||||
case password(currentSalt: Buffer, newSalt: Buffer, hint: String, hasRecovery: Api.Bool, emailUnconfirmedPattern: String)
|
case password(currentSalt: Buffer, newSalt: Buffer, hint: String, hasRecovery: Api.Bool, emailUnconfirmedPattern: String)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .noPassword(let newSalt, let emailUnconfirmedPattern):
|
case .noPassword(let newSalt, let emailUnconfirmedPattern):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -2438,10 +2438,10 @@ public struct account {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum PrivacyRules {
|
enum PrivacyRules {
|
||||||
case privacyRules(rules: [Api.PrivacyRule], users: [Api.User])
|
case privacyRules(rules: [Api.PrivacyRule], users: [Api.User])
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .privacyRules(let rules, let users):
|
case .privacyRules(let rules, let users):
|
||||||
if boxed {
|
if boxed {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -19,7 +19,7 @@ func imageRepresentationsForApiChatPhoto(_ photo: Api.ChatPhoto) -> [TelegramMed
|
|||||||
return telegramPhoto
|
return telegramPhoto
|
||||||
}
|
}
|
||||||
|
|
||||||
public func parseTelegramGroupOrChannel(chat: Api.Chat) -> Peer? {
|
func parseTelegramGroupOrChannel(chat: Api.Chat) -> Peer? {
|
||||||
switch chat {
|
switch chat {
|
||||||
case let .chat(flags, id, title, photo, participantsCount, date, version, migratedTo):
|
case let .chat(flags, id, title, photo, participantsCount, date, version, migratedTo):
|
||||||
let left = (flags & ((1 << 1) | (1 << 2))) != 0
|
let left = (flags & ((1 << 1) | (1 << 2))) != 0
|
||||||
|
|||||||
@ -7,7 +7,9 @@ import Foundation
|
|||||||
import SwiftSignalKit
|
import SwiftSignalKit
|
||||||
#endif
|
#endif
|
||||||
import TelegramCorePrivateModule
|
import TelegramCorePrivateModule
|
||||||
|
#if swift(>=4.0)
|
||||||
import CommonCrypto
|
import CommonCrypto
|
||||||
|
#endif
|
||||||
|
|
||||||
private func md5(_ data : Data) -> Data {
|
private func md5(_ data : Data) -> Data {
|
||||||
var res = Data()
|
var res = Data()
|
||||||
|
|||||||
@ -1,14 +1,12 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public final class FunctionDescription: CustomStringConvertible {
|
public final class FunctionDescription {
|
||||||
private let generator: () -> String
|
let name: String
|
||||||
|
let parameters: [(String, Any)]
|
||||||
|
|
||||||
init(_ generator: @escaping () -> String) {
|
init(name: String, parameters: [(String, Any)]) {
|
||||||
self.generator = generator
|
self.name = name
|
||||||
}
|
self.parameters = parameters
|
||||||
|
|
||||||
public var description: String {
|
|
||||||
return self.generator()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -88,7 +88,7 @@ class Download: NSObject, MTRequestMessageServiceDelegate {
|
|||||||
return Signal<Void, MTRpcError> { subscriber in
|
return Signal<Void, MTRpcError> { subscriber in
|
||||||
let request = MTRequest()
|
let request = MTRequest()
|
||||||
|
|
||||||
let saveFilePart: (CustomStringConvertible, Buffer, DeserializeFunctionResponse<Api.Bool>)
|
let saveFilePart: (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>)
|
||||||
if asBigPart {
|
if asBigPart {
|
||||||
let totalParts: Int32
|
let totalParts: Int32
|
||||||
if let bigTotalParts = bigTotalParts {
|
if let bigTotalParts = bigTotalParts {
|
||||||
@ -101,7 +101,7 @@ class Download: NSObject, MTRequestMessageServiceDelegate {
|
|||||||
saveFilePart = Api.functions.upload.saveFilePart(fileId: fileId, filePart: Int32(index), bytes: Buffer(data: data))
|
saveFilePart = Api.functions.upload.saveFilePart(fileId: fileId, filePart: Int32(index), bytes: Buffer(data: data))
|
||||||
}
|
}
|
||||||
|
|
||||||
request.setPayload(saveFilePart.1.makeData() as Data, metadata: WrappedRequestMetadata(metadata: saveFilePart.0, tag: nil), responseParser: { response in
|
request.setPayload(saveFilePart.1.makeData() as Data, metadata: WrappedRequestMetadata(metadata: WrappedFunctionDescription(saveFilePart.0), tag: nil), responseParser: { response in
|
||||||
if let result = saveFilePart.2.parse(Buffer(data: response)) {
|
if let result = saveFilePart.2.parse(Buffer(data: response)) {
|
||||||
return BoxedMessage(result)
|
return BoxedMessage(result)
|
||||||
}
|
}
|
||||||
@ -145,7 +145,7 @@ class Download: NSObject, MTRequestMessageServiceDelegate {
|
|||||||
|
|
||||||
let data = Api.functions.upload.getWebFile(location: location, offset: Int32(offset), limit: Int32(updatedLength))
|
let data = Api.functions.upload.getWebFile(location: location, offset: Int32(offset), limit: Int32(updatedLength))
|
||||||
|
|
||||||
request.setPayload(data.1.makeData() as Data, metadata: WrappedRequestMetadata(metadata: data.0, tag: nil), responseParser: { response in
|
request.setPayload(data.1.makeData() as Data, metadata: WrappedRequestMetadata(metadata: WrappedFunctionDescription(data.0), tag: nil), responseParser: { response in
|
||||||
if let result = data.2.parse(Buffer(data: response)) {
|
if let result = data.2.parse(Buffer(data: response)) {
|
||||||
return BoxedMessage(result)
|
return BoxedMessage(result)
|
||||||
}
|
}
|
||||||
@ -192,7 +192,7 @@ class Download: NSObject, MTRequestMessageServiceDelegate {
|
|||||||
|
|
||||||
let data = Api.functions.upload.getFile(location: location, offset: Int32(offset), limit: Int32(updatedLength))
|
let data = Api.functions.upload.getFile(location: location, offset: Int32(offset), limit: Int32(updatedLength))
|
||||||
|
|
||||||
request.setPayload(data.1.makeData() as Data, metadata: WrappedRequestMetadata(metadata: data.0, tag: nil), responseParser: { response in
|
request.setPayload(data.1.makeData() as Data, metadata: WrappedRequestMetadata(metadata: WrappedFunctionDescription(data.0), tag: nil), responseParser: { response in
|
||||||
if let result = data.2.parse(Buffer(data: response)) {
|
if let result = data.2.parse(Buffer(data: response)) {
|
||||||
return BoxedMessage(result)
|
return BoxedMessage(result)
|
||||||
}
|
}
|
||||||
@ -230,12 +230,12 @@ class Download: NSObject, MTRequestMessageServiceDelegate {
|
|||||||
} |> retryRequest
|
} |> retryRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
func request<T>(_ data: (CustomStringConvertible, Buffer, DeserializeFunctionResponse<T>)) -> Signal<T, MTRpcError> {
|
func request<T>(_ data: (FunctionDescription, Buffer, DeserializeFunctionResponse<T>)) -> Signal<T, MTRpcError> {
|
||||||
let requestService = self.requestService
|
let requestService = self.requestService
|
||||||
return Signal { subscriber in
|
return Signal { subscriber in
|
||||||
let request = MTRequest()
|
let request = MTRequest()
|
||||||
|
|
||||||
request.setPayload(data.1.makeData() as Data, metadata: WrappedRequestMetadata(metadata: data.0, tag: nil), responseParser: { response in
|
request.setPayload(data.1.makeData() as Data, metadata: WrappedRequestMetadata(metadata: WrappedFunctionDescription(data.0), tag: nil), responseParser: { response in
|
||||||
if let result = data.2.parse(Buffer(data: response)) {
|
if let result = data.2.parse(Buffer(data: response)) {
|
||||||
return BoxedMessage(result)
|
return BoxedMessage(result)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,7 +29,7 @@ enum FetchMessageHistoryHoleSource {
|
|||||||
case network(Network)
|
case network(Network)
|
||||||
case download(Download)
|
case download(Download)
|
||||||
|
|
||||||
func request<T>(_ data: (CustomStringConvertible, Buffer, DeserializeFunctionResponse<T>)) -> Signal<T, MTRpcError> {
|
func request<T>(_ data: (FunctionDescription, Buffer, DeserializeFunctionResponse<T>)) -> Signal<T, MTRpcError> {
|
||||||
switch self {
|
switch self {
|
||||||
case let .network(network):
|
case let .network(network):
|
||||||
return network.request(data)
|
return network.request(data)
|
||||||
|
|||||||
@ -6,7 +6,9 @@ import TelegramCorePrivateModule
|
|||||||
import Postbox
|
import Postbox
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if swift(>=4.0)
|
||||||
import CommonCrypto
|
import CommonCrypto
|
||||||
|
#endif
|
||||||
|
|
||||||
public extension MemoryBuffer {
|
public extension MemoryBuffer {
|
||||||
public func md5Digest() -> Data {
|
public func md5Digest() -> Data {
|
||||||
|
|||||||
@ -9,7 +9,9 @@ import Foundation
|
|||||||
import MtProtoKitDynamic
|
import MtProtoKitDynamic
|
||||||
#endif
|
#endif
|
||||||
import TelegramCorePrivateModule
|
import TelegramCorePrivateModule
|
||||||
|
#if swift(>=4.0)
|
||||||
import CommonCrypto
|
import CommonCrypto
|
||||||
|
#endif
|
||||||
|
|
||||||
#if os(macOS)
|
#if os(macOS)
|
||||||
private typealias SignalKitTimer = SwiftSignalKitMac.Timer
|
private typealias SignalKitTimer = SwiftSignalKitMac.Timer
|
||||||
|
|||||||
@ -31,6 +31,18 @@ private struct MTProtoConnectionInfo: Equatable {
|
|||||||
var proxyAddress: String?
|
var proxyAddress: String?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final class WrappedFunctionDescription: CustomStringConvertible {
|
||||||
|
private let desc: FunctionDescription
|
||||||
|
|
||||||
|
init(_ desc: FunctionDescription) {
|
||||||
|
self.desc = desc
|
||||||
|
}
|
||||||
|
|
||||||
|
var description: String {
|
||||||
|
return apiFunctionDescription(of: self.desc)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class WrappedRequestMetadata: NSObject {
|
class WrappedRequestMetadata: NSObject {
|
||||||
let metadata: CustomStringConvertible
|
let metadata: CustomStringConvertible
|
||||||
let tag: NetworkRequestDependencyTag?
|
let tag: NetworkRequestDependencyTag?
|
||||||
@ -643,12 +655,12 @@ public final class Network: NSObject, MTRequestMessageServiceDelegate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func request<T>(_ data: (CustomStringConvertible, Buffer, DeserializeFunctionResponse<T>), tag: NetworkRequestDependencyTag? = nil, automaticFloodWait: Bool = true) -> Signal<T, MTRpcError> {
|
public func request<T>(_ data: (FunctionDescription, Buffer, DeserializeFunctionResponse<T>), tag: NetworkRequestDependencyTag? = nil, automaticFloodWait: Bool = true) -> Signal<T, MTRpcError> {
|
||||||
let requestService = self.requestService
|
let requestService = self.requestService
|
||||||
return Signal { subscriber in
|
return Signal { subscriber in
|
||||||
let request = MTRequest()
|
let request = MTRequest()
|
||||||
|
|
||||||
request.setPayload(data.1.makeData() as Data, metadata: WrappedRequestMetadata(metadata: data.0, tag: tag), responseParser: { response in
|
request.setPayload(data.1.makeData() as Data, metadata: WrappedRequestMetadata(metadata: WrappedFunctionDescription(data.0), tag: tag), responseParser: { response in
|
||||||
if let result = data.2.parse(Buffer(data: response)) {
|
if let result = data.2.parse(Buffer(data: response)) {
|
||||||
return BoxedMessage(result)
|
return BoxedMessage(result)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,9 @@ import Foundation
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
import TelegramCorePrivateModule
|
import TelegramCorePrivateModule
|
||||||
|
#if swift(>=4.0)
|
||||||
import CommonCrypto
|
import CommonCrypto
|
||||||
|
#endif
|
||||||
|
|
||||||
enum PendingMessageUploadedContent {
|
enum PendingMessageUploadedContent {
|
||||||
case text(String)
|
case text(String)
|
||||||
|
|||||||
@ -21,8 +21,35 @@ private let redactChildrenOfType: [String: Set<String>] = [
|
|||||||
"DraftMessage.draftMessage": Set(["message"])
|
"DraftMessage.draftMessage": Set(["message"])
|
||||||
]
|
]
|
||||||
|
|
||||||
|
private let redactFunctionParameters: [String: Set<String>] = [
|
||||||
|
"messages.sendMessage": Set(["message"])
|
||||||
|
]
|
||||||
|
|
||||||
|
func apiFunctionDescription(of desc: FunctionDescription) -> String {
|
||||||
|
var result = desc.name
|
||||||
|
if !desc.parameters.isEmpty {
|
||||||
|
result.append("(")
|
||||||
|
for param in desc.parameters {
|
||||||
|
result.append(param.0)
|
||||||
|
result.append(": ")
|
||||||
|
|
||||||
|
var redactParam = false
|
||||||
|
if let redactParams = redactFunctionParameters[desc.name] {
|
||||||
|
redactParam = redactParams.contains(param.0)
|
||||||
|
}
|
||||||
|
|
||||||
|
if redactParam {
|
||||||
|
result.append("[[redacted]]")
|
||||||
|
} else {
|
||||||
|
result.append(recursiveDescription(redact: true, of: param.1))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result.append(")")
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
private func recursiveDescription(redact: Bool, of value: Any) -> String {
|
private func recursiveDescription(redact: Bool, of value: Any) -> String {
|
||||||
//if value is
|
|
||||||
let mirror = Mirror(reflecting: value)
|
let mirror = Mirror(reflecting: value)
|
||||||
var result = ""
|
var result = ""
|
||||||
if let displayStyle = mirror.displayStyle {
|
if let displayStyle = mirror.displayStyle {
|
||||||
|
|||||||
@ -99,7 +99,7 @@ public func preloadedFeaturedStickerSet(network: Network, postbox: Postbox, id:
|
|||||||
} |> switchToLatest
|
} |> switchToLatest
|
||||||
}
|
}
|
||||||
|
|
||||||
public func parsePreviewStickerSet(_ set: Api.StickerSetCovered) -> (StickerPackCollectionInfo, [StickerPackItem]) {
|
func parsePreviewStickerSet(_ set: Api.StickerSetCovered) -> (StickerPackCollectionInfo, [StickerPackItem]) {
|
||||||
switch set {
|
switch set {
|
||||||
case let .stickerSetCovered(set, cover):
|
case let .stickerSetCovered(set, cover):
|
||||||
let info = StickerPackCollectionInfo(apiSet: set, namespace: Namespaces.ItemCollection.CloudStickerPacks)
|
let info = StickerPackCollectionInfo(apiSet: set, namespace: Namespaces.ItemCollection.CloudStickerPacks)
|
||||||
|
|||||||
@ -411,7 +411,7 @@ extension StickerMaskCoords {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func telegramMediaFileAttributesFromApiAttributes(_ attributes: [Api.DocumentAttribute]) -> [TelegramMediaFileAttribute] {
|
func telegramMediaFileAttributesFromApiAttributes(_ attributes: [Api.DocumentAttribute]) -> [TelegramMediaFileAttribute] {
|
||||||
var result: [TelegramMediaFileAttribute] = []
|
var result: [TelegramMediaFileAttribute] = []
|
||||||
for attribute in attributes {
|
for attribute in attributes {
|
||||||
switch attribute {
|
switch attribute {
|
||||||
@ -445,7 +445,7 @@ public func telegramMediaFileAttributesFromApiAttributes(_ attributes: [Api.Docu
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
public func telegramMediaFileFromApiDocument(_ document: Api.Document) -> TelegramMediaFile? {
|
func telegramMediaFileFromApiDocument(_ document: Api.Document) -> TelegramMediaFile? {
|
||||||
switch document {
|
switch document {
|
||||||
case let .document(id, accessHash, _, mimeType, size, thumb, dcId, _, attributes):
|
case let .document(id, accessHash, _, mimeType, size, thumb, dcId, _, attributes):
|
||||||
return TelegramMediaFile(fileId: MediaId(namespace: Namespaces.Media.CloudFile, id: id), resource: CloudDocumentMediaResource(datacenterId: Int(dcId), fileId: id, accessHash: accessHash, size: Int(size)), previewRepresentations: telegramMediaImageRepresentationsFromApiSizes([thumb]), mimeType: mimeType, size: Int(size), attributes: telegramMediaFileAttributesFromApiAttributes(attributes))
|
return TelegramMediaFile(fileId: MediaId(namespace: Namespaces.Media.CloudFile, id: id), resource: CloudDocumentMediaResource(datacenterId: Int(dcId), fileId: id, accessHash: accessHash, size: Int(size)), previewRepresentations: telegramMediaImageRepresentationsFromApiSizes([thumb]), mimeType: mimeType, size: Int(size), attributes: telegramMediaFileAttributesFromApiAttributes(attributes))
|
||||||
|
|||||||
@ -153,7 +153,7 @@ public func ==(lhs: TelegramMediaImageRepresentation, rhs: TelegramMediaImageRep
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
public func telegramMediaImageRepresentationsFromApiSizes(_ sizes: [Api.PhotoSize]) -> [TelegramMediaImageRepresentation] {
|
func telegramMediaImageRepresentationsFromApiSizes(_ sizes: [Api.PhotoSize]) -> [TelegramMediaImageRepresentation] {
|
||||||
var representations: [TelegramMediaImageRepresentation] = []
|
var representations: [TelegramMediaImageRepresentation] = []
|
||||||
for size in sizes {
|
for size in sizes {
|
||||||
switch size {
|
switch size {
|
||||||
@ -172,7 +172,7 @@ public func telegramMediaImageRepresentationsFromApiSizes(_ sizes: [Api.PhotoSiz
|
|||||||
return representations
|
return representations
|
||||||
}
|
}
|
||||||
|
|
||||||
public func telegramMediaImageFromApiPhoto(_ photo: Api.Photo) -> TelegramMediaImage? {
|
func telegramMediaImageFromApiPhoto(_ photo: Api.Photo) -> TelegramMediaImage? {
|
||||||
switch photo {
|
switch photo {
|
||||||
case let .photo(_, id, accessHash, _, sizes):
|
case let .photo(_, id, accessHash, _, sizes):
|
||||||
return TelegramMediaImage(imageId: MediaId(namespace: Namespaces.Media.CloudImage, id: id), representations: telegramMediaImageRepresentationsFromApiSizes(sizes), reference: .cloud(imageId: id, accessHash: accessHash))
|
return TelegramMediaImage(imageId: MediaId(namespace: Namespaces.Media.CloudImage, id: id), representations: telegramMediaImageRepresentationsFromApiSizes(sizes), reference: .cloud(imageId: id, accessHash: accessHash))
|
||||||
|
|||||||
@ -201,7 +201,7 @@ public final class TelegramMediaMap: Media {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func telegramMediaMapFromApiGeoPoint(_ geo: Api.GeoPoint, title: String?, address: String?, provider: String?, venueId: String?, venueType: String?, liveBroadcastingTimeout: Int32?) -> TelegramMediaMap {
|
func telegramMediaMapFromApiGeoPoint(_ geo: Api.GeoPoint, title: String?, address: String?, provider: String?, venueId: String?, venueType: String?, liveBroadcastingTimeout: Int32?) -> TelegramMediaMap {
|
||||||
var venue: MapVenue?
|
var venue: MapVenue?
|
||||||
if let title = title {
|
if let title = title {
|
||||||
venue = MapVenue(title: title, address: address, provider: provider, id: venueId, type: venueType)
|
venue = MapVenue(title: title, address: address, provider: provider, id: venueId, type: venueType)
|
||||||
|
|||||||
@ -251,8 +251,8 @@ func parsedTelegramProfilePhoto(_ photo: Api.UserProfilePhoto?) -> [TelegramMedi
|
|||||||
return telegramPhoto
|
return telegramPhoto
|
||||||
}
|
}
|
||||||
|
|
||||||
public extension TelegramUser {
|
extension TelegramUser {
|
||||||
public convenience init(user: Api.User) {
|
convenience init(user: Api.User) {
|
||||||
switch user {
|
switch user {
|
||||||
case let .user(flags, id, accessHash, firstName, lastName, username, phone, photo, _, _, restrictionReason, botInlinePlaceholder, _):
|
case let .user(flags, id, accessHash, firstName, lastName, username, phone, photo, _, _, restrictionReason, botInlinePlaceholder, _):
|
||||||
var telegramPhoto: [TelegramMediaImageRepresentation] = []
|
var telegramPhoto: [TelegramMediaImageRepresentation] = []
|
||||||
@ -296,7 +296,7 @@ public extension TelegramUser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func merge(_ lhs: TelegramUser?, rhs: Api.User) -> TelegramUser? {
|
static func merge(_ lhs: TelegramUser?, rhs: Api.User) -> TelegramUser? {
|
||||||
switch rhs {
|
switch rhs {
|
||||||
case let .user(flags, _, accessHash, _, _, username, _, photo, _, _, restrictionReason, botInlinePlaceholder, _):
|
case let .user(flags, _, accessHash, _, _, username, _, photo, _, _, restrictionReason, botInlinePlaceholder, _):
|
||||||
if let _ = accessHash {
|
if let _ = accessHash {
|
||||||
@ -335,6 +335,4 @@ public extension TelegramUser {
|
|||||||
return TelegramUser(user: rhs)
|
return TelegramUser(user: rhs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
81
TelegramCore/Wallpapers.swift
Normal file
81
TelegramCore/Wallpapers.swift
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
import Foundation
|
||||||
|
import Postbox
|
||||||
|
import SwiftSignalKit
|
||||||
|
|
||||||
|
public enum TelegramWallpaper: OrderedItemListEntryContents, Equatable {
|
||||||
|
case builtin
|
||||||
|
case color(Int32)
|
||||||
|
case image([TelegramMediaImageRepresentation])
|
||||||
|
|
||||||
|
public init(decoder: PostboxDecoder) {
|
||||||
|
switch decoder.decodeInt32ForKey("v", orElse: 0) {
|
||||||
|
case 0:
|
||||||
|
self = .builtin
|
||||||
|
case 1:
|
||||||
|
self = .color(decoder.decodeInt32ForKey("c", orElse: 0))
|
||||||
|
case 2:
|
||||||
|
self = .image(decoder.decodeObjectArrayWithDecoderForKey("i"))
|
||||||
|
default:
|
||||||
|
assertionFailure()
|
||||||
|
self = .builtin
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func encode(_ encoder: PostboxEncoder) {
|
||||||
|
switch self {
|
||||||
|
case .builtin:
|
||||||
|
encoder.encodeInt32(0, forKey: "v")
|
||||||
|
case let .color(color):
|
||||||
|
encoder.encodeInt32(1, forKey: "v")
|
||||||
|
encoder.encodeInt32(color, forKey: "c")
|
||||||
|
case let .image(representations):
|
||||||
|
encoder.encodeInt32(2, forKey: "v")
|
||||||
|
encoder.encodeObjectArray(representations, forKey: "i")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func telegramWallpapers(account: Account) -> Signal<[TelegramWallpaper], NoError> {
|
||||||
|
return account.postbox.modify { modifier -> [TelegramWallpaper] in
|
||||||
|
let items = modifier.getOrderedListItems(collectionId: Namespaces.OrderedItemList.CloudWallpapers)
|
||||||
|
if items.count == 0 {
|
||||||
|
return [.color(0x000000), .builtin]
|
||||||
|
} else {
|
||||||
|
return items.map { $0.contents as! TelegramWallpaper }
|
||||||
|
}
|
||||||
|
} |> mapToSignal { list -> Signal<[TelegramWallpaper], NoError> in
|
||||||
|
let remote = account.network.request(Api.functions.account.getWallPapers())
|
||||||
|
|> retryRequest
|
||||||
|
|> mapToSignal { result -> Signal<[TelegramWallpaper], NoError> in
|
||||||
|
var items: [TelegramWallpaper] = []
|
||||||
|
for item in result {
|
||||||
|
switch item {
|
||||||
|
case let .wallPaper(_, _, sizes, color):
|
||||||
|
items.append(.image(telegramMediaImageRepresentationsFromApiSizes(sizes)))
|
||||||
|
case let .wallPaperSolid(_, _, bgColor, color):
|
||||||
|
items.append(.color(bgColor))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
items.removeFirst()
|
||||||
|
items.insert(.color(0x000000), at: 0)
|
||||||
|
items.insert(.builtin, at: 1)
|
||||||
|
|
||||||
|
if items == list {
|
||||||
|
return .complete()
|
||||||
|
} else {
|
||||||
|
return account.postbox.modify { modifier -> [TelegramWallpaper] in
|
||||||
|
var entries: [OrderedItemListEntry] = []
|
||||||
|
for item in items {
|
||||||
|
var intValue = Int32(entries.count)
|
||||||
|
let id = MemoryBuffer(data: Data(bytes: &intValue, count: 4))
|
||||||
|
entries.append(OrderedItemListEntry(id: id, contents: item))
|
||||||
|
}
|
||||||
|
modifier.replaceOrderedItemListItems(collectionId: Namespaces.OrderedItemList.CloudWallpapers, items: entries)
|
||||||
|
|
||||||
|
return items
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return .single(list) |> then(remote)
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user