Various UI improvements

This commit is contained in:
Ilya Laktyushin
2020-01-08 00:17:55 +03:00
parent 78ccc864b9
commit bae930ec20
26 changed files with 1001 additions and 87 deletions

View File

@@ -97,15 +97,18 @@ public struct PresentationLocalTheme: PostboxCoding, Equatable {
public struct PresentationCloudTheme: PostboxCoding, Equatable {
public let theme: TelegramTheme
public let resolvedWallpaper: TelegramWallpaper?
public let creatorAccountId: AccountRecordId?
public init(theme: TelegramTheme, resolvedWallpaper: TelegramWallpaper?) {
public init(theme: TelegramTheme, resolvedWallpaper: TelegramWallpaper?, creatorAccountId: AccountRecordId?) {
self.theme = theme
self.resolvedWallpaper = resolvedWallpaper
self.creatorAccountId = creatorAccountId
}
public init(decoder: PostboxDecoder) {
self.theme = decoder.decodeObjectForKey("theme", decoder: { TelegramTheme(decoder: $0) }) as! TelegramTheme
self.resolvedWallpaper = decoder.decodeObjectForKey("wallpaper", decoder: { TelegramWallpaper(decoder: $0) }) as? TelegramWallpaper
self.creatorAccountId = decoder.decodeOptionalInt64ForKey("account").flatMap { AccountRecordId(rawValue: $0) }
}
public func encode(_ encoder: PostboxEncoder) {
@@ -115,6 +118,11 @@ public struct PresentationCloudTheme: PostboxCoding, Equatable {
} else {
encoder.encodeNil(forKey: "wallpaper")
}
if let accountId = self.creatorAccountId {
encoder.encodeInt64(accountId.int64, forKey: "account")
} else {
encoder.encodeNil(forKey: "account")
}
}
public static func ==(lhs: PresentationCloudTheme, rhs: PresentationCloudTheme) -> Bool {