mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Fix pattern wallpaper preview & setup interface
This commit is contained in:
@@ -42,7 +42,9 @@ final class WallpaperPatternPanelNode: ASDisplayNode {
|
||||
|
||||
var backgroundColors: (UIColor, UIColor?)? = nil {
|
||||
didSet {
|
||||
self.updateWallpapers()
|
||||
if oldValue?.0.rgb != self.backgroundColors?.0.rgb || oldValue?.1?.rgb != self.backgroundColors?.1?.rgb {
|
||||
self.updateWallpapers()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,7 +138,11 @@ final class WallpaperPatternPanelNode: ASDisplayNode {
|
||||
|
||||
let backgroundColors = self.backgroundColors ?? (UIColor(rgb: 0xd6e2ee), nil)
|
||||
|
||||
var selected = true
|
||||
var selectedFileId: Int64?
|
||||
if let currentWallpaper = self.currentWallpaper, case let .file(file) = currentWallpaper {
|
||||
selectedFileId = file.id
|
||||
}
|
||||
|
||||
for wallpaper in wallpapers {
|
||||
let node = SettingsThemeWallpaperNode(overlayBackgroundColor: self.serviceBackgroundColor.withAlphaComponent(0.4))
|
||||
node.clipsToBounds = true
|
||||
@@ -148,6 +154,11 @@ final class WallpaperPatternPanelNode: ASDisplayNode {
|
||||
updatedWallpaper = .file(id: file.id, accessHash: file.accessHash, isCreator: file.isCreator, isDefault: file.isDefault, isPattern: file.isPattern, isDark: file.isDark, slug: file.slug, file: file.file, settings: settings)
|
||||
}
|
||||
|
||||
var selected = false
|
||||
if case let .file(file) = wallpaper, file.id == selectedFileId {
|
||||
selected = true
|
||||
}
|
||||
|
||||
node.setWallpaper(context: self.context, wallpaper: updatedWallpaper, selected: selected, size: itemSize)
|
||||
node.pressed = { [weak self, weak node] in
|
||||
if let strongSelf = self {
|
||||
@@ -163,8 +174,6 @@ final class WallpaperPatternPanelNode: ASDisplayNode {
|
||||
}
|
||||
}
|
||||
self.scrollNode.addSubnode(node)
|
||||
|
||||
selected = false
|
||||
}
|
||||
|
||||
self.scrollNode.view.contentSize = CGSize(width: (itemSize.width + inset) * CGFloat(wallpapers.count) + inset, height: 112.0)
|
||||
|
||||
@@ -480,7 +480,6 @@ public func patternWallpaperImageInternal(thumbnailData: Data?, fullSizeData: Da
|
||||
|
||||
if colors.count == 1 {
|
||||
c.setFillColor(patternColor(for: color, intensity: intensity, prominent: prominent).cgColor)
|
||||
c.fill(arguments.drawingRect)
|
||||
c.fill(arguments.drawingRect)
|
||||
} else {
|
||||
let gradientColors = colors.map { patternColor(for: $0, intensity: intensity, prominent: prominent).cgColor } as CFArray
|
||||
|
||||
Reference in New Issue
Block a user