Channel appearance

This commit is contained in:
Isaac
2023-12-19 13:46:23 +04:00
parent 3fc9d37ba7
commit 2708aa0a41
12 changed files with 170 additions and 101 deletions

View File

@@ -193,10 +193,14 @@ private final class ThemeGridThemeItemIconNode : ASDisplayNode {
}
let string: String?
if let _ = item.themeReference.emoticon {
string = nil
if let themeReference = item.themeReference {
if let _ = themeReference.emoticon {
string = nil
} else {
string = themeDisplayName(strings: item.strings, reference: themeReference)
}
} else {
string = themeDisplayName(strings: item.strings, reference: item.themeReference)
string = nil
}
let text = NSAttributedString(string: string ?? item.strings.Conversation_Theme_NoTheme, font: Font.bold(14.0), textColor: .white)
@@ -207,16 +211,17 @@ private final class ThemeGridThemeItemIconNode : ASDisplayNode {
let (_, emojiApply) = makeEmojiLayout(TextNodeLayoutArguments(attributedString: title, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: size.width, height: CGFloat.greatestFiniteMagnitude), alignment: .center, cutout: nil, insets: UIEdgeInsets()))
if updatedThemeReference || updatedWallpaper || updatedNightMode || updatedSize {
var themeReference = item.themeReference
if case .builtin = themeReference, item.nightMode {
themeReference = .builtin(.night)
if var themeReference = item.themeReference {
if case .builtin = themeReference, item.nightMode {
themeReference = .builtin(.night)
}
let color = item.themeSpecificAccentColors[themeReference.index]
let wallpaper = item.themeSpecificChatWallpapers[themeReference.index]
self.imageNode.setSignal(themeIconImage(account: item.context.account, accountManager: item.context.sharedContext.accountManager, theme: themeReference, color: color, wallpaper: wallpaper ?? item.wallpaper, nightMode: item.nightMode, emoticon: true, large: true))
self.imageNode.backgroundColor = nil
}
let color = item.themeSpecificAccentColors[themeReference.index]
let wallpaper = item.themeSpecificChatWallpapers[themeReference.index]
self.imageNode.setSignal(themeIconImage(account: item.context.account, accountManager: item.context.sharedContext.accountManager, theme: themeReference, color: color, wallpaper: wallpaper ?? item.wallpaper, nightMode: item.nightMode, emoticon: true, large: true))
self.imageNode.backgroundColor = nil
}
if updatedTheme || updatedSelected {
@@ -501,7 +506,9 @@ class ThemeGridThemeItemNode: ListViewItemNode, ItemListItemNode {
let selected = item.currentTheme.index == theme.index
let iconItem = ThemeCarouselThemeIconItem(context: item.context, emojiFile: theme.emoticon.flatMap { item.animatedEmojiStickers[$0]?.first?.file }, themeReference: theme, nightMode: item.nightMode, channelMode: false, themeSpecificAccentColors: item.themeSpecificAccentColors, themeSpecificChatWallpapers: item.themeSpecificChatWallpapers, selected: selected, theme: item.theme, strings: item.strings, wallpaper: nil, action: { theme in
item.updatedTheme(theme)
if let theme {
item.updatedTheme(theme)
}
}, contextAction: nil)
validIds.append(theme.index)