From 9f66ca657e83ca8db6483fe9f74e4043a2c4cac1 Mon Sep 17 00:00:00 2001 From: overtake <> Date: Thu, 26 Dec 2019 22:56:28 +0400 Subject: [PATCH] - bug fixes [skip ci] --- submodules/TelegramCore/Sources/Themes.swift | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/submodules/TelegramCore/Sources/Themes.swift b/submodules/TelegramCore/Sources/Themes.swift index 6b90106919..83032f6c96 100644 --- a/submodules/TelegramCore/Sources/Themes.swift +++ b/submodules/TelegramCore/Sources/Themes.swift @@ -116,10 +116,12 @@ public enum ThemeUpdatedResult { } private func checkThemeUpdated(network: Network, theme: TelegramTheme) -> Signal { - guard let file = theme.file, let fileId = file.id?.id else { + + let id = theme.settings != nil ? 0 : theme.file?.id?.id + guard let documentId = id else { return .fail(.generic) } - return network.request(Api.functions.account.getTheme(format: telegramThemeFormat, theme: .inputTheme(id: theme.id, accessHash: theme.accessHash), documentId: fileId)) + return network.request(Api.functions.account.getTheme(format: telegramThemeFormat, theme: .inputTheme(id: theme.id, accessHash: theme.accessHash), documentId: documentId)) |> mapError { _ -> GetThemeError in return .generic } |> map { theme -> ThemeUpdatedResult in if let theme = TelegramTheme(apiTheme: theme) { @@ -549,6 +551,9 @@ private func areThemesEqual(_ lhs: TelegramTheme, _ rhs: TelegramTheme) -> Bool if lhs.file?.id != rhs.file?.id { return false } + if lhs.settings != rhs.settings { + return false + } return true }