From ace2fc600ea159d82664cc75acd24fcbf2ed7341 Mon Sep 17 00:00:00 2001 From: Ali <> Date: Fri, 18 Jun 2021 02:12:26 +0400 Subject: [PATCH] Address wallpapers using id if available --- submodules/TelegramCore/Sources/Wallpapers.swift | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/submodules/TelegramCore/Sources/Wallpapers.swift b/submodules/TelegramCore/Sources/Wallpapers.swift index 4557a74894..77c9ec5d6e 100644 --- a/submodules/TelegramCore/Sources/Wallpapers.swift +++ b/submodules/TelegramCore/Sources/Wallpapers.swift @@ -162,10 +162,16 @@ private func saveUnsaveWallpaper(account: Account, wallpaper: TelegramWallpaper, } public func installWallpaper(account: Account, wallpaper: TelegramWallpaper) -> Signal { - guard case let .file(_, _, _, _, _, _, slug, _, settings) = wallpaper else { + guard case let .file(id, accessHash, _, _, _, _, slug, _, settings) = wallpaper else { return .complete() } - return account.network.request(Api.functions.account.installWallPaper(wallpaper: Api.InputWallPaper.inputWallPaperSlug(slug: slug), settings: apiWallpaperSettings(settings))) + let inputWallpaper: Api.InputWallPaper + if id != 0 && accessHash != 0 { + inputWallpaper = .inputWallPaper(id: id, accessHash: accessHash) + } else { + inputWallpaper = .inputWallPaperSlug(slug: slug) + } + return account.network.request(Api.functions.account.installWallPaper(wallpaper: inputWallpaper, settings: apiWallpaperSettings(settings))) |> `catch` { _ -> Signal in return .complete() }