Theme updates

This commit is contained in:
Ali 2021-05-29 01:10:45 +04:00
parent b11b306c30
commit 154c74a607
20 changed files with 115 additions and 61 deletions

View file

@ -147,34 +147,31 @@ public final class CachedPatternWallpaperMaskRepresentation: CachedMediaResource
public final class CachedPatternWallpaperRepresentation: CachedMediaResourceRepresentation {
public let keepDuration: CachedMediaRepresentationKeepDuration = .general
public let color: UInt32
public let bottomColor: UInt32?
public let colors: [UInt32]
public let intensity: Int32
public let rotation: Int32?
public var uniqueId: String {
var id: String
if let bottomColor = self.bottomColor {
id = "pattern-wallpaper-\(self.color)-\(bottomColor)-\(self.intensity)"
} else {
id = "pattern-wallpaper-\(self.color)-\(self.intensity)"
var id: String = "pattern-wallpaper"
for color in self.colors {
id.append("-\(color)")
}
id.append("-\(self.intensity)")
if let rotation = self.rotation, rotation != 0 {
id += "-\(rotation)deg"
}
return id
}
public init(color: UInt32, bottomColor: UInt32?, intensity: Int32, rotation: Int32?) {
self.color = color
self.bottomColor = bottomColor
public init(colors: [UInt32], intensity: Int32, rotation: Int32?) {
self.colors = colors
self.intensity = intensity
self.rotation = rotation
}
public func isEqual(to: CachedMediaResourceRepresentation) -> Bool {
if let to = to as? CachedPatternWallpaperRepresentation {
return self.color == to.color && self.bottomColor == to.bottomColor && self.intensity == intensity && self.rotation == to.rotation
return self.colors == to.colors && self.intensity == intensity && self.rotation == to.rotation
} else {
return false
}