Add support for gradient wallpapers

Implement new colors selection UI
This commit is contained in:
Ilya Laktyushin
2019-11-16 08:31:47 +04:00
parent 692b37fa4d
commit 78a09a38b3
33 changed files with 990 additions and 311 deletions

View File

@@ -99,7 +99,12 @@ final class SettingsThemeWallpaperNode: ASDisplayNode {
self.backgroundNode.isHidden = false
self.backgroundNode.backgroundColor = UIColor(rgb: UInt32(bitPattern: color))
}
case let .gradient(topColor, bottomColor):
self.imageNode.isHidden = false
self.backgroundNode.isHidden = true
self.imageNode.setSignal(gradientImage([UIColor(rgb: UInt32(bitPattern: topColor)), UIColor(rgb: UInt32(bitPattern: bottomColor))]))
let apply = self.imageNode.asyncLayout()(TransformImageArguments(corners: corners, imageSize: CGSize(), boundingSize: size, intrinsicInsets: UIEdgeInsets()))
apply()
case let .image(representations, _):
self.imageNode.isHidden = false
self.backgroundNode.isHidden = true
@@ -144,7 +149,7 @@ final class SettingsThemeWallpaperNode: ASDisplayNode {
}
} else if let wallpaper = self.wallpaper {
switch wallpaper {
case .builtin, .color:
case .builtin, .color, .gradient:
let apply = self.imageNode.asyncLayout()(TransformImageArguments(corners: corners, imageSize: CGSize(), boundingSize: size, intrinsicInsets: UIEdgeInsets()))
apply()
case let .image(representations, _):