mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Theming fixes
This commit is contained in:
@@ -40,6 +40,12 @@ final class WallpaperPatternPanelNode: ASDisplayNode {
|
||||
}
|
||||
}
|
||||
|
||||
var backgroundColors: (UIColor, UIColor?)? = nil {
|
||||
didSet {
|
||||
self.updateWallpapers()
|
||||
}
|
||||
}
|
||||
|
||||
private var validLayout: CGSize?
|
||||
|
||||
var patternChanged: ((TelegramWallpaper?, Int32?, Bool) -> Void)?
|
||||
@@ -128,15 +134,17 @@ final class WallpaperPatternPanelNode: ASDisplayNode {
|
||||
node.removeFromSupernode()
|
||||
}
|
||||
|
||||
let backgroundColors = self.backgroundColors ?? (UIColor(rgb: 0xd6e2ee), nil)
|
||||
|
||||
var selected = true
|
||||
for wallpaper in wallpapers {
|
||||
let node = SettingsThemeWallpaperNode(overlayBackgroundColor: UIColor(rgb: 0x748698, alpha: 0.4))
|
||||
let node = SettingsThemeWallpaperNode(overlayBackgroundColor: self.serviceBackgroundColor.withAlphaComponent(0.4))
|
||||
node.clipsToBounds = true
|
||||
node.cornerRadius = 5.0
|
||||
|
||||
var updatedWallpaper = wallpaper
|
||||
if case let .file(file) = updatedWallpaper {
|
||||
let settings = WallpaperSettings(blur: false, motion: false, color: 0xd6e2ee, intensity: 100)
|
||||
let settings = WallpaperSettings(blur: false, motion: false, color: Int32(bitPattern: backgroundColors.0.rgb), bottomColor: backgroundColors.1.flatMap { Int32(bitPattern: $0.rgb) }, intensity: 100)
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -193,6 +201,11 @@ final class WallpaperPatternPanelNode: ASDisplayNode {
|
||||
var wallpaper = initialWallpaper ?? self.wallpapers.first
|
||||
|
||||
if let wallpaper = wallpaper {
|
||||
var selectedFileId: Int64?
|
||||
if case let .file(file) = wallpaper {
|
||||
selectedFileId = file.id
|
||||
}
|
||||
|
||||
self.currentWallpaper = wallpaper
|
||||
self.sliderView?.value = 40.0
|
||||
|
||||
@@ -200,7 +213,11 @@ final class WallpaperPatternPanelNode: ASDisplayNode {
|
||||
|
||||
if let subnodes = self.scrollNode.subnodes {
|
||||
for case let subnode as SettingsThemeWallpaperNode in subnodes {
|
||||
subnode.setSelected(wallpaper == subnode.wallpaper, animated: false)
|
||||
var selected = false
|
||||
if case let .file(file) = subnode.wallpaper, file.id == selectedFileId {
|
||||
selected = true
|
||||
}
|
||||
subnode.setSelected(selected, animated: false)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user