Theme fixes

This commit is contained in:
Ilya Laktyushin 2019-12-27 13:57:16 +03:00
parent b97b7a3aae
commit f88599d66a
2 changed files with 10 additions and 10 deletions

View File

@ -609,7 +609,7 @@ class ThemeSettingsThemeItemNode: ListViewItemNode, ItemListItemNode {
var entries: [ThemeSettingsThemeEntry] = []
var index: Int = 0
for var theme in item.themes.prefix(1) {
for var theme in item.themes {
if !item.displayUnsupported, case let .cloud(theme) = theme, theme.theme.file == nil {
continue
}

View File

@ -1163,7 +1163,15 @@ public func themeIconImage(account: Account, accountManager: AccountManager, the
}
let themeSignal: Signal<PresentationTheme?, NoError>
if let reference = reference {
if case let .cloud(theme) = theme, let settings = theme.theme.settings {
themeSignal = Signal { subscriber in
let theme = makePresentationTheme(mediaBox: accountManager.mediaBox, themeReference: .builtin(PresentationBuiltinThemeReference(baseTheme: settings.baseTheme)), accentColor: UIColor(argb: UInt32(bitPattern: settings.accentColor)), backgroundColors: nil, bubbleColors: settings.messageColors.flatMap { (UIColor(argb: UInt32(bitPattern: $0.top)), UIColor(argb: UInt32(bitPattern: $0.bottom))) }, wallpaper: settings.wallpaper, serviceBackgroundColor: nil, preview: false)
subscriber.putNext(theme)
subscriber.putCompletion()
return EmptyDisposable
}
} else if let reference = reference {
themeSignal = telegramThemeData(account: account, accountManager: accountManager, reference: reference, synchronousLoad: false)
|> map { data -> PresentationTheme? in
if let data = data, let theme = makePresentationTheme(data: data) {
@ -1172,14 +1180,6 @@ public func themeIconImage(account: Account, accountManager: AccountManager, the
return nil
}
}
} else if case let .cloud(theme) = theme, let settings = theme.theme.settings {
themeSignal = Signal { subscriber in
let theme = makePresentationTheme(mediaBox: accountManager.mediaBox, themeReference: .builtin(PresentationBuiltinThemeReference(baseTheme: settings.baseTheme)), accentColor: UIColor(argb: UInt32(bitPattern: settings.accentColor)), backgroundColors: nil, bubbleColors: settings.messageColors.flatMap { (UIColor(argb: UInt32(bitPattern: $0.top)), UIColor(argb: UInt32(bitPattern: $0.bottom))) }, wallpaper: settings.wallpaper, serviceBackgroundColor: nil, preview: false)
subscriber.putNext(theme)
subscriber.putCompletion()
return EmptyDisposable
}
} else {
themeSignal = .never()
}