From b6e2e462641f50d2494f1bfd827f86158863b87f Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Tue, 5 Feb 2019 22:59:05 +0400 Subject: [PATCH] Fixed wallpaper representations upgrade --- TelegramUI/UpgradedAccounts.swift | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/TelegramUI/UpgradedAccounts.swift b/TelegramUI/UpgradedAccounts.swift index 1a2755715a..393d263ddf 100644 --- a/TelegramUI/UpgradedAccounts.swift +++ b/TelegramUI/UpgradedAccounts.swift @@ -139,7 +139,15 @@ public func upgradedAccounts(accountManager: AccountManager, rootPath: String) - if let path = mediaBox.completedResourcePath(file.file.resource), let data = try? Data(contentsOf: URL(fileURLWithPath: path), options: .mappedRead) { accountManager.mediaBox.storeResourceData(file.file.resource.id, data: data) let _ = accountManager.mediaBox.cachedResourceRepresentation(file.file.resource, representation: CachedScaledImageRepresentation(size: CGSize(width: 720.0, height: 720.0), mode: .aspectFit), complete: true, fetch: true).start() - let _ = accountManager.mediaBox.cachedResourceRepresentation(file.file.resource, representation: CachedBlurredWallpaperRepresentation(), complete: true, fetch: true).start() + if file.isPattern { + if let color = file.settings.color, let intensity = file.settings.intensity { + let _ = accountManager.mediaBox.cachedResourceRepresentation(file.file.resource, representation: CachedPatternWallpaperRepresentation(color: color, intensity: intensity), complete: true, fetch: true).start() + } + } else { + if file.settings.blur { + let _ = accountManager.mediaBox.cachedResourceRepresentation(file.file.resource, representation: CachedBlurredWallpaperRepresentation(), complete: true, fetch: true).start() + } + } } case let .image(representations, _): for representation in representations {