Various fixes

This commit is contained in:
Ilya Laktyushin
2023-04-13 20:40:29 +04:00
parent bd782b0402
commit 4d51f5fcb3
8 changed files with 135 additions and 26 deletions

View File

@@ -860,12 +860,15 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
let wallpaperPreviewController = WallpaperGalleryController(context: strongSelf.context, source: .wallpaper(wallpaper, nil, [], nil, nil, nil), mode: .peer(EnginePeer(peer), true))
wallpaperPreviewController.apply = { [weak wallpaperPreviewController] entry, options, _, _, brightness in
var settings: WallpaperSettings?
if case let .wallpaper(wallpaper, _) = entry, case let .file(file) = wallpaper, !file.isPattern {
var intensity: Int32?
if let brightness {
intensity = max(0, min(100, Int32(brightness * 100.0)))
if case let .wallpaper(wallpaper, _) = entry {
let baseSettings = wallpaper.settings
var intensity: Int32? = baseSettings?.intensity
if case let .file(file) = wallpaper, !file.isPattern {
if let brightness {
intensity = max(0, min(100, Int32(brightness * 100.0)))
}
}
settings = WallpaperSettings(blur: options.contains(.blur), motion: options.contains(.motion), intensity: intensity)
settings = WallpaperSettings(blur: options.contains(.blur), motion: options.contains(.motion), colors: baseSettings?.colors ?? [], intensity: intensity, rotation: baseSettings?.rotation)
}
let _ = (strongSelf.context.engine.themes.setExistingChatWallpaper(messageId: message.id, settings: settings)
|> deliverOnMainQueue).start()