mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Theme updates
This commit is contained in:
parent
b11b306c30
commit
154c74a607
20 changed files with 115 additions and 61 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue