From cdd24aff037abcd6c6e5f29423bc3b5ebda9a8e7 Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Mon, 28 Jan 2019 00:05:19 +0300 Subject: [PATCH] Added wallpapers reset method --- TelegramCore/Api3.swift | 14 ++++++++++++++ TelegramCore/Wallpapers.swift | 20 +++++++++++++++----- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/TelegramCore/Api3.swift b/TelegramCore/Api3.swift index 101761549d..3aa6c8c146 100644 --- a/TelegramCore/Api3.swift +++ b/TelegramCore/Api3.swift @@ -5153,6 +5153,20 @@ extension Api { return result }) } + + static func resetWallPapers() -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + let buffer = Buffer() + buffer.appendInt32(-1153722364) + + return (FunctionDescription(name: "account.resetWallPapers", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in + let reader = BufferReader(buffer) + var result: Api.Bool? + if let signature = reader.readInt32() { + result = Api.parse(reader, signature: signature) as? Api.Bool + } + return result + }) + } } struct langpack { static func getLangPack(langPack: String, langCode: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { diff --git a/TelegramCore/Wallpapers.swift b/TelegramCore/Wallpapers.swift index 637089e872..22abd09d54 100644 --- a/TelegramCore/Wallpapers.swift +++ b/TelegramCore/Wallpapers.swift @@ -196,10 +196,20 @@ public func installWallpaper(account: Account, wallpaper: TelegramWallpaper) -> return .complete() } return account.network.request(Api.functions.account.installWallPaper(wallpaper: Api.InputWallPaper.inputWallPaperSlug(slug: slug), settings: apiWallpaperSettings(settings))) - |> `catch` { _ -> Signal in - return .complete() - } - |> mapToSignal { _ -> Signal in - return .complete() + |> `catch` { _ -> Signal in + return .complete() + } + |> mapToSignal { _ -> Signal in + return .complete() + } +} + +public func resetWallpapers(account: Account) -> Signal { + return account.network.request(Api.functions.account.resetWallPapers()) + |> `catch` { _ -> Signal in + return .complete() + } + |> mapToSignal { _ -> Signal in + return .complete() } }