mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-07 14:53:35 +00:00
Merge branch 'quickfix-01-06' of https://github.com/peter-iakovlev/TelegramCoreDev into quickfix-01-06
This commit is contained in:
commit
d4f6fbdca8
@ -145,6 +145,8 @@
|
||||
D0223A9C1EA5654D00211D94 /* TelegramMediaResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0223A9A1EA5654D00211D94 /* TelegramMediaResource.swift */; };
|
||||
D02395D61F8D09A50070F5C2 /* 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 */; };
|
||||
D02ABC7C1E30058F00CAE539 /* DeleteMessagesInteractively.swift in Sources */ = {isa = PBXBuildFile; fileRef = D02ABC7A1E30058F00CAE539 /* DeleteMessagesInteractively.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>"; };
|
||||
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>"; };
|
||||
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>"; };
|
||||
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>"; };
|
||||
@ -1154,6 +1157,7 @@
|
||||
D0B167221F9F972E00976B40 /* LoggingSettings.swift */,
|
||||
D0AF32301FACEDEC0097362B /* CoreSettings.swift */,
|
||||
D0FA08BA2046B37900DD23FC /* ContentPrivacySettings.swift */,
|
||||
D026099D20C695AF006C34AC /* Wallpapers.swift */,
|
||||
);
|
||||
name = Settings;
|
||||
sourceTree = "<group>";
|
||||
@ -2049,6 +2053,7 @@
|
||||
D0546494207386D7002ECC1E /* SecureIdUtilityBillValue.swift in Sources */,
|
||||
D0BC386E1E3FDAB70044D6FE /* CreateGroup.swift in Sources */,
|
||||
D0FA8BB31E201B02001E855B /* ProcessSecretChatIncomingEncryptedOperations.swift in Sources */,
|
||||
D026099E20C695AF006C34AC /* Wallpapers.swift in Sources */,
|
||||
D0FC19582020CC4B00FEDBB2 /* TelegramPeerGroupState.swift in Sources */,
|
||||
C205FEA81EB3B75900455808 /* ExportMessageLink.swift in Sources */,
|
||||
D06AFE8920BF66BF00EA5124 /* DeserializeFunctionResponse.swift in Sources */,
|
||||
@ -2472,6 +2477,7 @@
|
||||
D00BDA1A1EE593D600C64C5E /* TelegramChannelAdminRights.swift in Sources */,
|
||||
D00D34431E6EDD2E0057B307 /* ManagedSynchronizeConsumeMessageContentsOperations.swift in Sources */,
|
||||
D049EAE91E44B67100A2CD3A /* RecentPeerItem.swift in Sources */,
|
||||
D026099F20C695AF006C34AC /* Wallpapers.swift in Sources */,
|
||||
D0FA35091EA632E400E56FFA /* CollectCacheUsageStats.swift in Sources */,
|
||||
D0E412EB206AD18E00BEE4A2 /* DecryptedResourceData.swift in Sources */,
|
||||
D001F3F31E128A1C007A8C60 /* UpdateMessageService.swift in Sources */,
|
||||
|
||||
@ -10,6 +10,9 @@ import Foundation
|
||||
#endif
|
||||
|
||||
import TelegramCorePrivateModule
|
||||
#if swift(>=4.0)
|
||||
import CommonCrypto
|
||||
#endif
|
||||
|
||||
private enum GenerateSecureSecretError {
|
||||
case generic
|
||||
|
||||
@ -9,6 +9,9 @@ import Foundation
|
||||
import MtProtoKitDynamic
|
||||
#endif
|
||||
import TelegramCorePrivateModule
|
||||
#if swift(>=4.0)
|
||||
import CommonCrypto
|
||||
#endif
|
||||
|
||||
public protocol AccountState: PostboxCoding {
|
||||
func equalsTo(_ other: AccountState) -> Bool
|
||||
@ -258,6 +261,7 @@ private var declaredEncodables: Void = {
|
||||
declareEncodable(TelegramDeviceContactImportInfo.self, f: { TelegramDeviceContactImportInfo(decoder: $0) })
|
||||
declareEncodable(SecureFileMediaResource.self, f: { SecureFileMediaResource(decoder: $0) })
|
||||
declareEncodable(CachedStickerQueryResult.self, f: { CachedStickerQueryResult(decoder: $0) })
|
||||
declareEncodable(TelegramWallpaper.self, f: { TelegramWallpaper(decoder: $0) })
|
||||
|
||||
return
|
||||
}()
|
||||
@ -430,7 +434,7 @@ func sha512Digest(_ data : Data) -> Data {
|
||||
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)
|
||||
|> mapToSignal { authData -> Signal<Api.auth.Authorization, MTRpcError> in
|
||||
var data = Data()
|
||||
|
||||
@ -349,7 +349,7 @@ public final class UnauthorizedAccountState: AccountState {
|
||||
}
|
||||
}
|
||||
|
||||
public extension SentAuthorizationCodeType {
|
||||
extension SentAuthorizationCodeType {
|
||||
init(apiType: Api.auth.SentCodeType) {
|
||||
switch apiType {
|
||||
case let .sentCodeTypeApp(length):
|
||||
@ -364,7 +364,7 @@ public extension SentAuthorizationCodeType {
|
||||
}
|
||||
}
|
||||
|
||||
public extension AuthorizationCodeNextType {
|
||||
extension AuthorizationCodeNextType {
|
||||
init(apiType: Api.auth.CodeType) {
|
||||
switch apiType {
|
||||
case .codeTypeSms:
|
||||
|
||||
@ -621,8 +621,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
return dict
|
||||
}()
|
||||
|
||||
public struct Api {
|
||||
public static func parse(_ buffer: Buffer) -> Any? {
|
||||
struct Api {
|
||||
static func parse(_ buffer: Buffer) -> Any? {
|
||||
let reader = BufferReader(buffer)
|
||||
if let signature = reader.readInt32() {
|
||||
return parse(reader, signature: signature)
|
||||
@ -675,7 +675,7 @@ public struct Api {
|
||||
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 {
|
||||
case let _1 as Api.messages.StickerSet:
|
||||
_1.serialize(buffer, boxed)
|
||||
@ -1101,12 +1101,12 @@ public struct Api {
|
||||
}
|
||||
|
||||
}
|
||||
public extension Api {
|
||||
public struct messages {
|
||||
public enum StickerSet {
|
||||
extension Api {
|
||||
struct messages {
|
||||
enum StickerSet {
|
||||
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 {
|
||||
case .stickerSet(let set, let packs, let documents):
|
||||
if boxed {
|
||||
@ -1152,10 +1152,10 @@ public struct messages {
|
||||
}
|
||||
|
||||
}
|
||||
public enum ArchivedStickers {
|
||||
enum ArchivedStickers {
|
||||
case archivedStickers(count: Int32, sets: [Api.StickerSetCovered])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .archivedStickers(let count, let sets):
|
||||
if boxed {
|
||||
@ -1189,11 +1189,11 @@ public struct messages {
|
||||
}
|
||||
|
||||
}
|
||||
public enum SentEncryptedMessage {
|
||||
enum SentEncryptedMessage {
|
||||
case sentEncryptedMessage(date: Int32)
|
||||
case sentEncryptedFile(date: Int32, file: Api.EncryptedFile)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .sentEncryptedMessage(let date):
|
||||
if boxed {
|
||||
@ -1240,11 +1240,11 @@ public struct messages {
|
||||
}
|
||||
|
||||
}
|
||||
public enum Stickers {
|
||||
enum Stickers {
|
||||
case stickersNotModified
|
||||
case stickers(hash: Int32, stickers: [Api.Document])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .stickersNotModified:
|
||||
if boxed {
|
||||
@ -1287,11 +1287,11 @@ public struct messages {
|
||||
}
|
||||
|
||||
}
|
||||
public enum FoundStickerSets {
|
||||
enum FoundStickerSets {
|
||||
case foundStickerSetsNotModified
|
||||
case foundStickerSets(hash: Int32, sets: [Api.StickerSetCovered])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .foundStickerSetsNotModified:
|
||||
if boxed {
|
||||
@ -1334,10 +1334,10 @@ public struct messages {
|
||||
}
|
||||
|
||||
}
|
||||
public enum FoundGifs {
|
||||
enum FoundGifs {
|
||||
case foundGifs(nextOffset: Int32, results: [Api.FoundGif])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .foundGifs(let nextOffset, let results):
|
||||
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])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .botResults(let flags, let queryId, let nextOffset, let switchPm, let results, let cacheTime, let users):
|
||||
if boxed {
|
||||
@ -1436,10 +1436,10 @@ public struct messages {
|
||||
}
|
||||
|
||||
}
|
||||
public enum BotCallbackAnswer {
|
||||
enum BotCallbackAnswer {
|
||||
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 {
|
||||
case .botCallbackAnswer(let flags, let message, let url, let cacheTime):
|
||||
if boxed {
|
||||
@ -1475,11 +1475,11 @@ public struct messages {
|
||||
}
|
||||
|
||||
}
|
||||
public enum Chats {
|
||||
enum Chats {
|
||||
case chats(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 {
|
||||
case .chats(let chats):
|
||||
if boxed {
|
||||
@ -1536,11 +1536,11 @@ public struct messages {
|
||||
}
|
||||
|
||||
}
|
||||
public enum DhConfig {
|
||||
enum DhConfig {
|
||||
case dhConfigNotModified(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 {
|
||||
case .dhConfigNotModified(let random):
|
||||
if boxed {
|
||||
@ -1593,10 +1593,10 @@ public struct messages {
|
||||
}
|
||||
|
||||
}
|
||||
public enum AffectedHistory {
|
||||
enum AffectedHistory {
|
||||
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 {
|
||||
case .affectedHistory(let pts, let ptsCount, let offset):
|
||||
if boxed {
|
||||
@ -1628,10 +1628,10 @@ public struct messages {
|
||||
}
|
||||
|
||||
}
|
||||
public enum MessageEditData {
|
||||
enum MessageEditData {
|
||||
case messageEditData(flags: Int32)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .messageEditData(let flags):
|
||||
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])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .chatFull(let fullChat, let chats, let users):
|
||||
if boxed {
|
||||
@ -1704,11 +1704,11 @@ public struct messages {
|
||||
}
|
||||
|
||||
}
|
||||
public enum StickerSetInstallResult {
|
||||
enum StickerSetInstallResult {
|
||||
case stickerSetInstallResultSuccess
|
||||
case stickerSetInstallResultArchive(sets: [Api.StickerSetCovered])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .stickerSetInstallResultSuccess:
|
||||
if boxed {
|
||||
@ -1747,10 +1747,10 @@ public struct messages {
|
||||
}
|
||||
|
||||
}
|
||||
public enum AffectedMessages {
|
||||
enum AffectedMessages {
|
||||
case affectedMessages(pts: Int32, ptsCount: Int32)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .affectedMessages(let pts, let ptsCount):
|
||||
if boxed {
|
||||
@ -1778,11 +1778,11 @@ public struct messages {
|
||||
}
|
||||
|
||||
}
|
||||
public enum SavedGifs {
|
||||
enum SavedGifs {
|
||||
case savedGifsNotModified
|
||||
case savedGifs(hash: Int32, gifs: [Api.Document])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .savedGifsNotModified:
|
||||
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 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 messagesNotModified(count: Int32)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .messages(let messages, let chats, let users):
|
||||
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)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .peerDialogs(let dialogs, let messages, let chats, let users, let state):
|
||||
if boxed {
|
||||
@ -2069,11 +2069,11 @@ public struct messages {
|
||||
}
|
||||
|
||||
}
|
||||
public enum RecentStickers {
|
||||
enum RecentStickers {
|
||||
case recentStickersNotModified
|
||||
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 {
|
||||
case .recentStickersNotModified:
|
||||
if boxed {
|
||||
@ -2136,11 +2136,11 @@ public struct messages {
|
||||
}
|
||||
|
||||
}
|
||||
public enum FeaturedStickers {
|
||||
enum FeaturedStickers {
|
||||
case featuredStickersNotModified
|
||||
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 {
|
||||
case .featuredStickersNotModified:
|
||||
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 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 {
|
||||
case .dialogs(let dialogs, let messages, let chats, let users):
|
||||
if boxed {
|
||||
@ -2314,11 +2314,11 @@ public struct messages {
|
||||
}
|
||||
|
||||
}
|
||||
public enum FavedStickers {
|
||||
enum FavedStickers {
|
||||
case favedStickersNotModified
|
||||
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 {
|
||||
case .favedStickersNotModified:
|
||||
if boxed {
|
||||
@ -2371,11 +2371,11 @@ public struct messages {
|
||||
}
|
||||
|
||||
}
|
||||
public enum AllStickers {
|
||||
enum AllStickers {
|
||||
case allStickersNotModified
|
||||
case allStickers(hash: Int32, sets: [Api.StickerSet])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .allStickersNotModified:
|
||||
if boxed {
|
||||
@ -2418,10 +2418,10 @@ public struct messages {
|
||||
}
|
||||
|
||||
}
|
||||
public enum HighScores {
|
||||
enum HighScores {
|
||||
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 {
|
||||
case .highScores(let scores, let users):
|
||||
if boxed {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,10 @@
|
||||
public extension Api {
|
||||
public struct channels {
|
||||
public enum ChannelParticipants {
|
||||
extension Api {
|
||||
struct channels {
|
||||
enum ChannelParticipants {
|
||||
case channelParticipants(count: Int32, participants: [Api.ChannelParticipant], users: [Api.User])
|
||||
case channelParticipantsNotModified
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .channelParticipants(let count, let participants, let users):
|
||||
if boxed {
|
||||
@ -57,10 +57,10 @@ public struct channels {
|
||||
}
|
||||
|
||||
}
|
||||
public enum ChannelParticipant {
|
||||
enum ChannelParticipant {
|
||||
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 {
|
||||
case .channelParticipant(let participant, let users):
|
||||
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])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .adminLogResults(let events, let chats, let users):
|
||||
if boxed {
|
||||
@ -151,12 +151,12 @@ public struct channels {
|
||||
}
|
||||
}
|
||||
}
|
||||
public extension Api {
|
||||
public struct payments {
|
||||
public enum ValidatedRequestedInfo {
|
||||
extension Api {
|
||||
struct payments {
|
||||
enum ValidatedRequestedInfo {
|
||||
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 {
|
||||
case .validatedRequestedInfo(let flags, let id, let shippingOptions):
|
||||
if boxed {
|
||||
@ -194,11 +194,11 @@ public struct payments {
|
||||
}
|
||||
|
||||
}
|
||||
public enum PaymentResult {
|
||||
enum PaymentResult {
|
||||
case paymentResult(updates: Api.Updates)
|
||||
case paymentVerficationNeeded(url: String)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .paymentResult(let updates):
|
||||
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])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .paymentForm(let flags, let botId, let invoice, let providerId, let url, let nativeProvider, let nativeParams, let savedInfo, let savedCredentials, let users):
|
||||
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])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
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):
|
||||
if boxed {
|
||||
@ -397,10 +397,10 @@ public struct payments {
|
||||
}
|
||||
|
||||
}
|
||||
public enum SavedInfo {
|
||||
enum SavedInfo {
|
||||
case savedInfo(flags: Int32, savedInfo: Api.PaymentRequestedInfo?)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .savedInfo(let flags, let savedInfo):
|
||||
if boxed {
|
||||
@ -432,12 +432,12 @@ public struct payments {
|
||||
}
|
||||
}
|
||||
}
|
||||
public extension Api {
|
||||
public struct auth {
|
||||
public enum Authorization {
|
||||
extension Api {
|
||||
struct auth {
|
||||
enum Authorization {
|
||||
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 {
|
||||
case .authorization(let flags, let tmpSessions, let user):
|
||||
if boxed {
|
||||
@ -471,10 +471,10 @@ public struct auth {
|
||||
}
|
||||
|
||||
}
|
||||
public enum PasswordRecovery {
|
||||
enum PasswordRecovery {
|
||||
case passwordRecovery(emailPattern: String)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .passwordRecovery(let emailPattern):
|
||||
if boxed {
|
||||
@ -498,10 +498,10 @@ public struct auth {
|
||||
}
|
||||
|
||||
}
|
||||
public enum ExportedAuthorization {
|
||||
enum ExportedAuthorization {
|
||||
case exportedAuthorization(id: Int32, bytes: Buffer)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .exportedAuthorization(let id, let bytes):
|
||||
if boxed {
|
||||
@ -529,10 +529,10 @@ public struct auth {
|
||||
}
|
||||
|
||||
}
|
||||
public enum CheckedPhone {
|
||||
enum CheckedPhone {
|
||||
case checkedPhone(phoneRegistered: Api.Bool)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .checkedPhone(let phoneRegistered):
|
||||
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?)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .sentCode(let flags, let type, let phoneCodeHash, let nextType, let timeout, let termsOfService):
|
||||
if boxed {
|
||||
@ -611,12 +611,12 @@ public struct auth {
|
||||
}
|
||||
|
||||
}
|
||||
public enum CodeType {
|
||||
enum CodeType {
|
||||
case codeTypeSms
|
||||
case codeTypeCall
|
||||
case codeTypeFlashCall
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .codeTypeSms:
|
||||
if boxed {
|
||||
@ -650,13 +650,13 @@ public struct auth {
|
||||
}
|
||||
|
||||
}
|
||||
public enum SentCodeType {
|
||||
enum SentCodeType {
|
||||
case sentCodeTypeApp(length: Int32)
|
||||
case sentCodeTypeSms(length: Int32)
|
||||
case sentCodeTypeCall(length: Int32)
|
||||
case sentCodeTypeFlashCall(pattern: String)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .sentCodeTypeApp(let length):
|
||||
if boxed {
|
||||
@ -733,13 +733,13 @@ public struct auth {
|
||||
}
|
||||
}
|
||||
}
|
||||
public extension Api {
|
||||
public struct contacts {
|
||||
public enum Blocked {
|
||||
extension Api {
|
||||
struct contacts {
|
||||
enum Blocked {
|
||||
case blocked(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 {
|
||||
case .blocked(let blocked, let users):
|
||||
if boxed {
|
||||
@ -816,11 +816,11 @@ public struct contacts {
|
||||
}
|
||||
|
||||
}
|
||||
public enum Contacts {
|
||||
enum Contacts {
|
||||
case contactsNotModified
|
||||
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 {
|
||||
case .contactsNotModified:
|
||||
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])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .resolvedPeer(let peer, let chats, let users):
|
||||
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)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .link(let myLink, let foreignLink, let user):
|
||||
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])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .importedContacts(let imported, let popularInvites, let retryContacts, let users):
|
||||
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])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .found(let myResults, let results, let chats, let users):
|
||||
if boxed {
|
||||
@ -1089,11 +1089,11 @@ public struct contacts {
|
||||
}
|
||||
|
||||
}
|
||||
public enum TopPeers {
|
||||
enum TopPeers {
|
||||
case topPeersNotModified
|
||||
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 {
|
||||
case .topPeersNotModified:
|
||||
if boxed {
|
||||
@ -1154,13 +1154,13 @@ public struct contacts {
|
||||
}
|
||||
}
|
||||
}
|
||||
public extension Api {
|
||||
public struct help {
|
||||
public enum AppUpdate {
|
||||
extension Api {
|
||||
struct help {
|
||||
enum AppUpdate {
|
||||
case appUpdate(id: Int32, critical: Api.Bool, url: String, text: String)
|
||||
case noAppUpdate
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .appUpdate(let id, let critical, let url, let text):
|
||||
if boxed {
|
||||
@ -1207,11 +1207,11 @@ public struct help {
|
||||
}
|
||||
|
||||
}
|
||||
public enum ProxyData {
|
||||
enum ProxyData {
|
||||
case proxyDataEmpty(expires: Int32)
|
||||
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 {
|
||||
case .proxyDataEmpty(let expires):
|
||||
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?)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .termsOfService(let flags, let id, let text, let entities, let minAgeConfirm):
|
||||
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])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .recentMeUrls(let urls, let chats, let users):
|
||||
if boxed {
|
||||
@ -1382,10 +1382,10 @@ public struct help {
|
||||
}
|
||||
|
||||
}
|
||||
public enum Support {
|
||||
enum Support {
|
||||
case support(phoneNumber: String, user: Api.User)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .support(let phoneNumber, let user):
|
||||
if boxed {
|
||||
@ -1415,10 +1415,10 @@ public struct help {
|
||||
}
|
||||
|
||||
}
|
||||
public enum InviteText {
|
||||
enum InviteText {
|
||||
case inviteText(message: String)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .inviteText(let message):
|
||||
if boxed {
|
||||
@ -1442,11 +1442,11 @@ public struct help {
|
||||
}
|
||||
|
||||
}
|
||||
public enum TermsOfServiceUpdate {
|
||||
enum TermsOfServiceUpdate {
|
||||
case termsOfServiceUpdateEmpty(expires: Int32)
|
||||
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 {
|
||||
case .termsOfServiceUpdateEmpty(let expires):
|
||||
if boxed {
|
||||
@ -1495,15 +1495,15 @@ public struct help {
|
||||
}
|
||||
}
|
||||
}
|
||||
public extension Api {
|
||||
public struct updates {
|
||||
public enum Difference {
|
||||
extension Api {
|
||||
struct updates {
|
||||
enum Difference {
|
||||
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 differenceSlice(newMessages: [Api.Message], newEncryptedMessages: [Api.EncryptedMessage], otherUpdates: [Api.Update], chats: [Api.Chat], users: [Api.User], intermediateState: Api.updates.State)
|
||||
case differenceTooLong(pts: Int32)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .differenceEmpty(let date, let seq):
|
||||
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)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .state(let pts, let qts, let date, let seq, let unreadCount):
|
||||
if boxed {
|
||||
@ -1729,12 +1729,12 @@ public struct updates {
|
||||
}
|
||||
|
||||
}
|
||||
public enum ChannelDifference {
|
||||
enum ChannelDifference {
|
||||
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 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 {
|
||||
case .channelDifferenceEmpty(let flags, let pts, let timeout):
|
||||
if boxed {
|
||||
@ -1908,12 +1908,12 @@ public struct updates {
|
||||
}
|
||||
}
|
||||
}
|
||||
public extension Api {
|
||||
public struct upload {
|
||||
public enum WebFile {
|
||||
extension Api {
|
||||
struct upload {
|
||||
enum WebFile {
|
||||
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 {
|
||||
case .webFile(let size, let mimeType, let fileType, let mtime, let bytes):
|
||||
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 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 {
|
||||
case .file(let type, let mtime, let bytes):
|
||||
if boxed {
|
||||
@ -2032,11 +2032,11 @@ public struct upload {
|
||||
}
|
||||
|
||||
}
|
||||
public enum CdnFile {
|
||||
enum CdnFile {
|
||||
case cdnFileReuploadNeeded(requestToken: Buffer)
|
||||
case cdnFile(bytes: Buffer)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .cdnFileReuploadNeeded(let requestToken):
|
||||
if boxed {
|
||||
@ -2079,9 +2079,9 @@ public struct upload {
|
||||
}
|
||||
}
|
||||
}
|
||||
public extension Api {
|
||||
public struct storage {
|
||||
public enum FileType {
|
||||
extension Api {
|
||||
struct storage {
|
||||
enum FileType {
|
||||
case fileUnknown
|
||||
case filePartial
|
||||
case fileJpeg
|
||||
@ -2093,7 +2093,7 @@ public struct storage {
|
||||
case fileMp4
|
||||
case fileWebp
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .fileUnknown:
|
||||
if boxed {
|
||||
@ -2192,12 +2192,12 @@ public struct storage {
|
||||
}
|
||||
}
|
||||
}
|
||||
public extension Api {
|
||||
public struct account {
|
||||
public enum TmpPassword {
|
||||
extension Api {
|
||||
struct account {
|
||||
enum TmpPassword {
|
||||
case tmpPassword(tmpPassword: Buffer, validUntil: Int32)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .tmpPassword(let tmpPassword, let validUntil):
|
||||
if boxed {
|
||||
@ -2225,10 +2225,10 @@ public struct account {
|
||||
}
|
||||
|
||||
}
|
||||
public enum PasswordSettings {
|
||||
enum PasswordSettings {
|
||||
case passwordSettings(email: String)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .passwordSettings(let email):
|
||||
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?)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .passwordInputSettings(let flags, let newSalt, let newPasswordHash, let hint, let email):
|
||||
if boxed {
|
||||
@ -2295,10 +2295,10 @@ public struct account {
|
||||
}
|
||||
|
||||
}
|
||||
public enum WebAuthorizations {
|
||||
enum WebAuthorizations {
|
||||
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 {
|
||||
case .webAuthorizations(let authorizations, let users):
|
||||
if boxed {
|
||||
@ -2338,10 +2338,10 @@ public struct account {
|
||||
}
|
||||
|
||||
}
|
||||
public enum Authorizations {
|
||||
enum Authorizations {
|
||||
case authorizations(authorizations: [Api.Authorization])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .authorizations(let authorizations):
|
||||
if boxed {
|
||||
@ -2371,11 +2371,11 @@ public struct account {
|
||||
}
|
||||
|
||||
}
|
||||
public enum Password {
|
||||
enum Password {
|
||||
case noPassword(newSalt: Buffer, 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 {
|
||||
case .noPassword(let newSalt, let emailUnconfirmedPattern):
|
||||
if boxed {
|
||||
@ -2438,10 +2438,10 @@ public struct account {
|
||||
}
|
||||
|
||||
}
|
||||
public enum PrivacyRules {
|
||||
enum PrivacyRules {
|
||||
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 {
|
||||
case .privacyRules(let rules, let users):
|
||||
if boxed {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -19,7 +19,7 @@ func imageRepresentationsForApiChatPhoto(_ photo: Api.ChatPhoto) -> [TelegramMed
|
||||
return telegramPhoto
|
||||
}
|
||||
|
||||
public func parseTelegramGroupOrChannel(chat: Api.Chat) -> Peer? {
|
||||
func parseTelegramGroupOrChannel(chat: Api.Chat) -> Peer? {
|
||||
switch chat {
|
||||
case let .chat(flags, id, title, photo, participantsCount, date, version, migratedTo):
|
||||
let left = (flags & ((1 << 1) | (1 << 2))) != 0
|
||||
|
||||
@ -7,6 +7,9 @@ import Foundation
|
||||
import SwiftSignalKit
|
||||
#endif
|
||||
import TelegramCorePrivateModule
|
||||
#if swift(>=4.0)
|
||||
import CommonCrypto
|
||||
#endif
|
||||
|
||||
private func md5(_ data : Data) -> Data {
|
||||
var res = Data()
|
||||
|
||||
@ -1,14 +1,12 @@
|
||||
import Foundation
|
||||
|
||||
public final class FunctionDescription: CustomStringConvertible {
|
||||
private let generator: () -> String
|
||||
public final class FunctionDescription {
|
||||
let name: String
|
||||
let parameters: [(String, Any)]
|
||||
|
||||
init(_ generator: @escaping () -> String) {
|
||||
self.generator = generator
|
||||
}
|
||||
|
||||
public var description: String {
|
||||
return self.generator()
|
||||
init(name: String, parameters: [(String, Any)]) {
|
||||
self.name = name
|
||||
self.parameters = parameters
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -88,7 +88,7 @@ class Download: NSObject, MTRequestMessageServiceDelegate {
|
||||
return Signal<Void, MTRpcError> { subscriber in
|
||||
let request = MTRequest()
|
||||
|
||||
let saveFilePart: (CustomStringConvertible, Buffer, DeserializeFunctionResponse<Api.Bool>)
|
||||
let saveFilePart: (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>)
|
||||
if asBigPart {
|
||||
let totalParts: Int32
|
||||
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))
|
||||
}
|
||||
|
||||
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)) {
|
||||
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))
|
||||
|
||||
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)) {
|
||||
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))
|
||||
|
||||
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)) {
|
||||
return BoxedMessage(result)
|
||||
}
|
||||
@ -230,12 +230,12 @@ class Download: NSObject, MTRequestMessageServiceDelegate {
|
||||
} |> 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
|
||||
return Signal { subscriber in
|
||||
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)) {
|
||||
return BoxedMessage(result)
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ enum FetchMessageHistoryHoleSource {
|
||||
case network(Network)
|
||||
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 {
|
||||
case let .network(network):
|
||||
return network.request(data)
|
||||
|
||||
@ -6,6 +6,10 @@ import TelegramCorePrivateModule
|
||||
import Postbox
|
||||
#endif
|
||||
|
||||
#if swift(>=4.0)
|
||||
import CommonCrypto
|
||||
#endif
|
||||
|
||||
public extension MemoryBuffer {
|
||||
public func md5Digest() -> Data {
|
||||
var res = Data()
|
||||
|
||||
@ -9,6 +9,9 @@ import Foundation
|
||||
import MtProtoKitDynamic
|
||||
#endif
|
||||
import TelegramCorePrivateModule
|
||||
#if swift(>=4.0)
|
||||
import CommonCrypto
|
||||
#endif
|
||||
|
||||
#if os(macOS)
|
||||
private typealias SignalKitTimer = SwiftSignalKitMac.Timer
|
||||
|
||||
@ -31,6 +31,18 @@ private struct MTProtoConnectionInfo: Equatable {
|
||||
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 {
|
||||
let metadata: CustomStringConvertible
|
||||
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
|
||||
return Signal { subscriber in
|
||||
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)) {
|
||||
return BoxedMessage(result)
|
||||
}
|
||||
|
||||
@ -8,6 +8,9 @@ import Foundation
|
||||
#endif
|
||||
|
||||
import TelegramCorePrivateModule
|
||||
#if swift(>=4.0)
|
||||
import CommonCrypto
|
||||
#endif
|
||||
|
||||
enum PendingMessageUploadedContent {
|
||||
case text(String)
|
||||
|
||||
@ -21,8 +21,35 @@ private let redactChildrenOfType: [String: Set<String>] = [
|
||||
"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 {
|
||||
//if value is
|
||||
let mirror = Mirror(reflecting: value)
|
||||
var result = ""
|
||||
if let displayStyle = mirror.displayStyle {
|
||||
|
||||
@ -99,7 +99,7 @@ public func preloadedFeaturedStickerSet(network: Network, postbox: Postbox, id:
|
||||
} |> switchToLatest
|
||||
}
|
||||
|
||||
public func parsePreviewStickerSet(_ set: Api.StickerSetCovered) -> (StickerPackCollectionInfo, [StickerPackItem]) {
|
||||
func parsePreviewStickerSet(_ set: Api.StickerSetCovered) -> (StickerPackCollectionInfo, [StickerPackItem]) {
|
||||
switch set {
|
||||
case let .stickerSetCovered(set, cover):
|
||||
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] = []
|
||||
for attribute in attributes {
|
||||
switch attribute {
|
||||
@ -445,7 +445,7 @@ public func telegramMediaFileAttributesFromApiAttributes(_ attributes: [Api.Docu
|
||||
return result
|
||||
}
|
||||
|
||||
public func telegramMediaFileFromApiDocument(_ document: Api.Document) -> TelegramMediaFile? {
|
||||
func telegramMediaFileFromApiDocument(_ document: Api.Document) -> TelegramMediaFile? {
|
||||
switch document {
|
||||
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))
|
||||
|
||||
@ -153,7 +153,7 @@ public func ==(lhs: TelegramMediaImageRepresentation, rhs: TelegramMediaImageRep
|
||||
return true
|
||||
}
|
||||
|
||||
public func telegramMediaImageRepresentationsFromApiSizes(_ sizes: [Api.PhotoSize]) -> [TelegramMediaImageRepresentation] {
|
||||
func telegramMediaImageRepresentationsFromApiSizes(_ sizes: [Api.PhotoSize]) -> [TelegramMediaImageRepresentation] {
|
||||
var representations: [TelegramMediaImageRepresentation] = []
|
||||
for size in sizes {
|
||||
switch size {
|
||||
@ -172,7 +172,7 @@ public func telegramMediaImageRepresentationsFromApiSizes(_ sizes: [Api.PhotoSiz
|
||||
return representations
|
||||
}
|
||||
|
||||
public func telegramMediaImageFromApiPhoto(_ photo: Api.Photo) -> TelegramMediaImage? {
|
||||
func telegramMediaImageFromApiPhoto(_ photo: Api.Photo) -> TelegramMediaImage? {
|
||||
switch photo {
|
||||
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))
|
||||
|
||||
@ -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?
|
||||
if let title = title {
|
||||
venue = MapVenue(title: title, address: address, provider: provider, id: venueId, type: venueType)
|
||||
|
||||
@ -251,8 +251,8 @@ func parsedTelegramProfilePhoto(_ photo: Api.UserProfilePhoto?) -> [TelegramMedi
|
||||
return telegramPhoto
|
||||
}
|
||||
|
||||
public extension TelegramUser {
|
||||
public convenience init(user: Api.User) {
|
||||
extension TelegramUser {
|
||||
convenience init(user: Api.User) {
|
||||
switch user {
|
||||
case let .user(flags, id, accessHash, firstName, lastName, username, phone, photo, _, _, restrictionReason, botInlinePlaceholder, _):
|
||||
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 {
|
||||
case let .user(flags, _, accessHash, _, _, username, _, photo, _, _, restrictionReason, botInlinePlaceholder, _):
|
||||
if let _ = accessHash {
|
||||
@ -335,6 +335,4 @@ public extension TelegramUser {
|
||||
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