Merge commit '517b858168e94149b1cb5b453dc42e4b91a50aa5'

This commit is contained in:
Ali 2021-05-27 04:14:23 +04:00
commit 8201f8c497
4 changed files with 16 additions and 10 deletions

View File

@ -249,11 +249,15 @@ private final class ThemeSettingsThemeItemIconNode : ListViewItemNode {
var updatedThemeReference = false
var updatedAccentColor = false
var updatedTheme = false
var updatedWallpaper = false
var updatedSelected = false
if currentItem?.themeReference != item.themeReference {
updatedThemeReference = true
}
if currentItem?.wallpaper != item.wallpaper {
updatedWallpaper = true
}
if currentItem == nil || currentItem?.accentColor != item.accentColor {
updatedAccentColor = true
}
@ -278,7 +282,7 @@ private final class ThemeSettingsThemeItemIconNode : ListViewItemNode {
}
strongSelf.containerNode.isGestureEnabled = false
} else {
if updatedThemeReference || updatedAccentColor {
if updatedThemeReference || updatedAccentColor || updatedWallpaper {
strongSelf.imageNode.setSignal(themeIconImage(account: item.context.account, accountManager: item.context.sharedContext.accountManager, theme: item.themeReference, color: item.accentColor, wallpaper: item.wallpaper))
}
strongSelf.containerNode.isGestureEnabled = true
@ -545,8 +549,6 @@ class ThemeSettingsThemeItemNode: ListViewItemNode, ItemListItemNode {
return (layout, { [weak self] in
if let strongSelf = self {
let isFirstLayout = currentItem == nil
strongSelf.item = item
strongSelf.layoutParams = params
@ -636,14 +638,15 @@ class ThemeSettingsThemeItemNode: ListViewItemNode, ItemListItemNode {
let customWallpaper = item.themeSpecificChatWallpapers[theme.generalThemeReference.index]
let wallpaper = accentColor?.wallpaper ?? customWallpaper ?? themeWallpaper
entries.append(ThemeSettingsThemeEntry(index: index, themeReference: theme, title: title, accentColor: accentColor, selected: item.currentTheme.index == theme.index, theme: item.theme, wallpaper: wallpaper))
index += 1
}
let action: (PresentationThemeReference) -> Void = { [weak self, weak item] themeReference in
let action: (PresentationThemeReference) -> Void = { [weak self] themeReference in
if let strongSelf = self {
strongSelf.item?.updatedTheme(themeReference)
ensureThemeVisible(listNode: strongSelf.listNode, themeReference: themeReference, animated: true)
let _ = ensureThemeVisible(listNode: strongSelf.listNode, themeReference: themeReference, animated: true)
}
}
let previousEntries = strongSelf.entries ?? []

View File

@ -138,6 +138,7 @@ private class CallStatusBarBackgroundNode: ASDisplayNode {
}
private func setupGradientAnimations() {
return
if let _ = self.foregroundGradientLayer.animation(forKey: "movement") {
} else {
let previousValue = self.foregroundGradientLayer.startPoint

View File

@ -328,7 +328,6 @@ final class VoiceChatTileItemNode: ASDisplayNode {
}
let titleFont = Font.semibold(13.0)
let subtitleFont = Font.regular(13.0)
let titleColor = UIColor.white
var titleAttributedString: NSAttributedString?
if let user = item.peer as? TelegramUser {

View File

@ -1130,7 +1130,7 @@ public func themeImage(account: Account, accountManager: AccountManager, source:
public func themeIconImage(account: Account, accountManager: AccountManager, theme: PresentationThemeReference, color: PresentationThemeAccentColor?, wallpaper: TelegramWallpaper? = nil) -> Signal<(TransformImageArguments) -> DrawingContext?, NoError> {
let colorsSignal: Signal<((UIColor, UIColor?, [UInt32]), (UIColor, UIColor), (UIColor, UIColor), UIImage?, Int32?), NoError>
if case let .builtin(theme) = theme {
if false, case let .builtin(theme) = theme {
let incomingColor: UIColor
let outgoingColor: (UIColor, UIColor)
var accentColor = color?.color
@ -1242,9 +1242,11 @@ public func themeIconImage(account: Account, accountManager: AccountManager, the
} else if case let .cloud(theme) = theme, let resource = theme.theme.file?.resource {
reference = .theme(theme: .slug(theme.theme.slug), resource: resource)
}
let themeSignal: Signal<PresentationTheme?, NoError>
if case let .cloud(theme) = theme, let settings = theme.theme.settings {
if case let .builtin(theme) = theme {
themeSignal = .single(makeDefaultPresentationTheme(reference: theme, serviceBackgroundColor: 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: settings.accentColor), backgroundColors: [], bubbleColors: settings.messageColors.flatMap { (UIColor(argb: $0.top), UIColor(argb: $0.bottom)) }, wallpaper: settings.wallpaper, serviceBackgroundColor: nil, preview: false)
subscriber.putNext(theme)
@ -1273,7 +1275,8 @@ public func themeIconImage(account: Account, accountManager: AccountManager, the
var backgroundColor: (UIColor, UIColor?, [UInt32])
let incomingColor = (theme.chat.message.incoming.bubble.withoutWallpaper.fill, theme.chat.message.incoming.bubble.withoutWallpaper.gradientFill)
let outgoingColor = (theme.chat.message.outgoing.bubble.withoutWallpaper.fill, theme.chat.message.outgoing.bubble.withoutWallpaper.gradientFill)
switch theme.chat.defaultWallpaper {
let wallpaper = wallpaper ?? theme.chat.defaultWallpaper
switch wallpaper {
case .builtin:
backgroundColor = (UIColor(rgb: 0xd6e2ee), nil, [])
case let .color(color):