mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Fix gradient rotation in pattern picker
This commit is contained in:
@@ -193,7 +193,7 @@ final class ThemeAccentColorControllerNode: ASDisplayNode, UIScrollViewDelegate
|
|||||||
private let serviceBackgroundColorPromise = Promise<UIColor>()
|
private let serviceBackgroundColorPromise = Promise<UIColor>()
|
||||||
private var wallpaperDisposable = MetaDisposable()
|
private var wallpaperDisposable = MetaDisposable()
|
||||||
|
|
||||||
private var currentBackgroundColors: (UIColor, UIColor?)?
|
private var currentBackgroundColors: (UIColor, UIColor?, Int32?)?
|
||||||
private var currentBackgroundPromise = Promise<(UIColor, UIColor?)?>()
|
private var currentBackgroundPromise = Promise<(UIColor, UIColor?)?>()
|
||||||
|
|
||||||
private var patternWallpaper: TelegramWallpaper?
|
private var patternWallpaper: TelegramWallpaper?
|
||||||
@@ -569,8 +569,12 @@ final class ThemeAccentColorControllerNode: ASDisplayNode, UIScrollViewDelegate
|
|||||||
strongSelf.patternArguments = patternArguments
|
strongSelf.patternArguments = patternArguments
|
||||||
|
|
||||||
if !preview {
|
if !preview {
|
||||||
strongSelf.currentBackgroundColors = backgroundColors
|
if let backgroundColors = backgroundColors {
|
||||||
strongSelf.patternPanelNode.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 {
|
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 {
|
if current.patternWallpaper == nil, let wallpaper = wallpaper {
|
||||||
updated.patternWallpaper = wallpaper
|
updated.patternWallpaper = wallpaper
|
||||||
if updated.backgroundColors == nil {
|
if updated.backgroundColors == nil {
|
||||||
updated.backgroundColors = backgroundColors
|
if let backgroundColors = backgroundColors {
|
||||||
|
updated.backgroundColors = (backgroundColors.0, backgroundColors.1)
|
||||||
|
} else {
|
||||||
|
updated.backgroundColors = nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
appeared = true
|
appeared = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -238,6 +238,7 @@ class ThemeSettingsChatPreviewItemNode: ListViewItemNode {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
strongSelf.backgroundNode.image = image
|
strongSelf.backgroundNode.image = image
|
||||||
|
strongSelf.finalImage = final
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -282,7 +282,7 @@ public class WallpaperGalleryController: ViewController {
|
|||||||
self.navigationBar?.updatePresentationData(NavigationBarPresentationData(presentationData: self.presentationData))
|
self.navigationBar?.updatePresentationData(NavigationBarPresentationData(presentationData: self.presentationData))
|
||||||
self.toolbarNode?.updateThemeAndStrings(theme: self.presentationData.theme, strings: self.presentationData.strings)
|
self.toolbarNode?.updateThemeAndStrings(theme: self.presentationData.theme, strings: self.presentationData.strings)
|
||||||
self.patternPanelNode?.updateTheme(self.presentationData.theme)
|
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) {
|
func dismiss(forceAway: Bool) {
|
||||||
@@ -636,7 +636,7 @@ public class WallpaperGalleryController: ViewController {
|
|||||||
strongSelf.updateEntries(pattern: pattern, intensity: intensity, preview: preview)
|
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
|
self.patternPanelNode = patternPanelNode
|
||||||
currentPatternPanelNode = patternPanelNode
|
currentPatternPanelNode = patternPanelNode
|
||||||
self.overlayNode?.insertSubnode(patternPanelNode, belowSubnode: self.toolbarNode!)
|
self.overlayNode?.insertSubnode(patternPanelNode, belowSubnode: self.toolbarNode!)
|
||||||
|
|||||||
@@ -40,9 +40,10 @@ final class WallpaperPatternPanelNode: ASDisplayNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var backgroundColors: (UIColor, UIColor?)? = nil {
|
var backgroundColors: (UIColor, UIColor?, Int32?)? = nil {
|
||||||
didSet {
|
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()
|
self.updateWallpapers()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -136,7 +137,7 @@ final class WallpaperPatternPanelNode: ASDisplayNode {
|
|||||||
node.removeFromSupernode()
|
node.removeFromSupernode()
|
||||||
}
|
}
|
||||||
|
|
||||||
let backgroundColors = self.backgroundColors ?? (UIColor(rgb: 0xd6e2ee), nil)
|
let backgroundColors = self.backgroundColors ?? (UIColor(rgb: 0xd6e2ee), nil, nil)
|
||||||
|
|
||||||
var selectedFileId: Int64?
|
var selectedFileId: Int64?
|
||||||
if let currentWallpaper = self.currentWallpaper, case let .file(file) = currentWallpaper {
|
if let currentWallpaper = self.currentWallpaper, case let .file(file) = currentWallpaper {
|
||||||
@@ -150,7 +151,7 @@ final class WallpaperPatternPanelNode: ASDisplayNode {
|
|||||||
|
|
||||||
var updatedWallpaper = wallpaper
|
var updatedWallpaper = wallpaper
|
||||||
if case let .file(file) = updatedWallpaper {
|
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)
|
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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user