This commit is contained in:
Ali 2019-12-27 19:47:47 +04:00
parent e69dbc82bd
commit c8caa0eb70
2 changed files with 9 additions and 3 deletions

View File

@ -16,11 +16,11 @@ private let randomBackgroundColors: [Int32] = [0x007aff, 0x00c2ed, 0x29b327, 0xe
extension TelegramThemeSettings { extension TelegramThemeSettings {
convenience init(baseTheme: TelegramBaseTheme, accentColor: UIColor, messageColors: (top: UIColor, bottom: UIColor?)?, wallpaper: TelegramWallpaper?) { convenience init(baseTheme: TelegramBaseTheme, accentColor: UIColor, messageColors: (top: UIColor, bottom: UIColor?)?, wallpaper: TelegramWallpaper?) {
var messageColorsValues: (Int32, Int32)? var messageColorsValues: (UInt32, UInt32)?
if let colors = messageColors { if let colors = messageColors {
messageColorsValues = (Int32(bitPattern: colors.0.argb), Int32(bitPattern: colors.1?.argb ?? colors.0.argb)) messageColorsValues = (UInt32(bitPattern: colors.0.argb), UInt32(bitPattern: colors.1?.argb ?? colors.0.argb))
} }
self.init(baseTheme: baseTheme, accentColor: Int32(bitPattern: accentColor.argb), messageColors: messageColorsValues, wallpaper: wallpaper) self.init(baseTheme: baseTheme, accentColor: UInt32(bitPattern: accentColor.argb), messageColors: messageColorsValues, wallpaper: wallpaper)
} }
} }

View File

@ -7,6 +7,12 @@ public enum TelegramBaseTheme: Int32 {
case tinted case tinted
} }
public extension UInt32 {
init(bitPattern: UInt32) {
self = bitPattern
}
}
public final class TelegramThemeSettings: PostboxCoding, Equatable { public final class TelegramThemeSettings: PostboxCoding, Equatable {
public static func == (lhs: TelegramThemeSettings, rhs: TelegramThemeSettings) -> Bool { public static func == (lhs: TelegramThemeSettings, rhs: TelegramThemeSettings) -> Bool {
if lhs.baseTheme != rhs.baseTheme { if lhs.baseTheme != rhs.baseTheme {