diff --git a/submodules/SettingsUI/Sources/Themes/ThemeAccentColorControllerNode.swift b/submodules/SettingsUI/Sources/Themes/ThemeAccentColorControllerNode.swift index b2ece20ad4..8c6c9b02a2 100644 --- a/submodules/SettingsUI/Sources/Themes/ThemeAccentColorControllerNode.swift +++ b/submodules/SettingsUI/Sources/Themes/ThemeAccentColorControllerNode.swift @@ -193,7 +193,7 @@ final class ThemeAccentColorControllerNode: ASDisplayNode, UIScrollViewDelegate private let serviceBackgroundColorPromise = Promise() private var wallpaperDisposable = MetaDisposable() - private var currentBackgroundColors: (UIColor, UIColor?)? + private var currentBackgroundColors: (UIColor, UIColor?, Int32?)? private var currentBackgroundPromise = Promise<(UIColor, UIColor?)?>() private var patternWallpaper: TelegramWallpaper? @@ -569,8 +569,12 @@ final class ThemeAccentColorControllerNode: ASDisplayNode, UIScrollViewDelegate strongSelf.patternArguments = patternArguments if !preview { - strongSelf.currentBackgroundColors = backgroundColors - strongSelf.patternPanelNode.backgroundColors = backgroundColors + if let backgroundColors = backgroundColors { + strongSelf.currentBackgroundColors = (backgroundColors.0, backgroundColors.1, strongSelf.state.rotation) + } else { + strongSelf.currentBackgroundColors = nil + } + strongSelf.patternPanelNode.backgroundColors = strongSelf.currentBackgroundColors } if let _ = theme, let (layout, navigationBarHeight, messagesBottomInset) = strongSelf.validLayout { @@ -1089,7 +1093,11 @@ final class ThemeAccentColorControllerNode: ASDisplayNode, UIScrollViewDelegate if current.patternWallpaper == nil, let wallpaper = wallpaper { updated.patternWallpaper = wallpaper if updated.backgroundColors == nil { - updated.backgroundColors = backgroundColors + if let backgroundColors = backgroundColors { + updated.backgroundColors = (backgroundColors.0, backgroundColors.1) + } else { + updated.backgroundColors = nil + } } appeared = true } diff --git a/submodules/SettingsUI/Sources/Themes/ThemeSettingsChatPreviewItem.swift b/submodules/SettingsUI/Sources/Themes/ThemeSettingsChatPreviewItem.swift index 613408098a..32d7ed98da 100644 --- a/submodules/SettingsUI/Sources/Themes/ThemeSettingsChatPreviewItem.swift +++ b/submodules/SettingsUI/Sources/Themes/ThemeSettingsChatPreviewItem.swift @@ -238,6 +238,7 @@ class ThemeSettingsChatPreviewItemNode: ListViewItemNode { }) } strongSelf.backgroundNode.image = image + strongSelf.finalImage = final } })) } diff --git a/submodules/SettingsUI/Sources/Themes/WallpaperGalleryController.swift b/submodules/SettingsUI/Sources/Themes/WallpaperGalleryController.swift index 5252ddd3f7..de7ea72d05 100644 --- a/submodules/SettingsUI/Sources/Themes/WallpaperGalleryController.swift +++ b/submodules/SettingsUI/Sources/Themes/WallpaperGalleryController.swift @@ -282,7 +282,7 @@ public class WallpaperGalleryController: ViewController { self.navigationBar?.updatePresentationData(NavigationBarPresentationData(presentationData: self.presentationData)) self.toolbarNode?.updateThemeAndStrings(theme: self.presentationData.theme, strings: self.presentationData.strings) self.patternPanelNode?.updateTheme(self.presentationData.theme) - self.patternPanelNode?.backgroundColors = self.presentationData.theme.overallDarkAppearance ? (self.presentationData.theme.list.blocksBackgroundColor, nil) : nil + self.patternPanelNode?.backgroundColors = self.presentationData.theme.overallDarkAppearance ? (self.presentationData.theme.list.blocksBackgroundColor, nil, nil) : nil } func dismiss(forceAway: Bool) { @@ -636,7 +636,7 @@ public class WallpaperGalleryController: ViewController { strongSelf.updateEntries(pattern: pattern, intensity: intensity, preview: preview) } } - patternPanelNode.backgroundColors = self.presentationData.theme.overallDarkAppearance ? (self.presentationData.theme.list.blocksBackgroundColor, nil) : nil + patternPanelNode.backgroundColors = self.presentationData.theme.overallDarkAppearance ? (self.presentationData.theme.list.blocksBackgroundColor, nil, nil) : nil self.patternPanelNode = patternPanelNode currentPatternPanelNode = patternPanelNode self.overlayNode?.insertSubnode(patternPanelNode, belowSubnode: self.toolbarNode!) diff --git a/submodules/SettingsUI/Sources/Themes/WallpaperPatternPanelNode.swift b/submodules/SettingsUI/Sources/Themes/WallpaperPatternPanelNode.swift index 33c296d843..7f5118e53e 100644 --- a/submodules/SettingsUI/Sources/Themes/WallpaperPatternPanelNode.swift +++ b/submodules/SettingsUI/Sources/Themes/WallpaperPatternPanelNode.swift @@ -40,9 +40,10 @@ final class WallpaperPatternPanelNode: ASDisplayNode { } } - var backgroundColors: (UIColor, UIColor?)? = nil { + var backgroundColors: (UIColor, UIColor?, Int32?)? = nil { didSet { - if oldValue?.0.rgb != self.backgroundColors?.0.rgb || oldValue?.1?.rgb != self.backgroundColors?.1?.rgb { + if oldValue?.0.rgb != self.backgroundColors?.0.rgb || oldValue?.1?.rgb != self.backgroundColors?.1?.rgb + || oldValue?.2 != self.backgroundColors?.2 { self.updateWallpapers() } } @@ -136,7 +137,7 @@ final class WallpaperPatternPanelNode: ASDisplayNode { node.removeFromSupernode() } - let backgroundColors = self.backgroundColors ?? (UIColor(rgb: 0xd6e2ee), nil) + let backgroundColors = self.backgroundColors ?? (UIColor(rgb: 0xd6e2ee), nil, nil) var selectedFileId: Int64? if let currentWallpaper = self.currentWallpaper, case let .file(file) = currentWallpaper { @@ -150,7 +151,7 @@ final class WallpaperPatternPanelNode: ASDisplayNode { var updatedWallpaper = wallpaper if case let .file(file) = updatedWallpaper { - let settings = WallpaperSettings(color: backgroundColors.0.rgb, bottomColor: backgroundColors.1.flatMap { $0.rgb }, intensity: 100) + let settings = WallpaperSettings(color: backgroundColors.0.rgb, bottomColor: backgroundColors.1.flatMap { $0.rgb }, intensity: 100, rotation: backgroundColors.2) updatedWallpaper = .file(id: file.id, accessHash: file.accessHash, isCreator: file.isCreator, isDefault: file.isDefault, isPattern: updatedWallpaper.isPattern, isDark: file.isDark, slug: file.slug, file: file.file, settings: settings) }