Various improvements

This commit is contained in:
Ilya Laktyushin 2025-08-28 05:14:18 +04:00
parent 1e800125d5
commit a4ed31da74
3 changed files with 15 additions and 7 deletions

View File

@ -35,8 +35,8 @@ private struct ThemeSettingsThemeEntry: Comparable, Identifiable {
let strings: PresentationStrings
let wallpaper: TelegramWallpaper?
var stableId: Int {
return index
var stableId: String {
return self.chatTheme?.id ?? "\(self.index)"
}
static func ==(lhs: ThemeSettingsThemeEntry, rhs: ThemeSettingsThemeEntry) -> Bool {
@ -524,11 +524,13 @@ private final class ThemeSettingsThemeItemIconNode : ListViewItemNode {
if let theme = item.chatTheme, case let .gift(_, themeSettings) = theme {
if item.nightMode {
if let theme = themeSettings.first(where: { $0.baseTheme == .night || $0.baseTheme == .tinted }) {
bubbleColor = UIColor(rgb: UInt32(bitPattern: theme.accentColor))
let color = theme.wallpaper?.settings?.colors.first ?? theme.accentColor
bubbleColor = UIColor(rgb: UInt32(bitPattern: color))
}
} else {
if let theme = themeSettings.first(where: { $0.baseTheme == .classic || $0.baseTheme == .day }) {
bubbleColor = UIColor(rgb: UInt32(bitPattern: theme.accentColor))
let color = theme.wallpaper?.settings?.colors.first ?? theme.accentColor
bubbleColor = UIColor(rgb: UInt32(bitPattern: color))
}
}
}
@ -964,7 +966,6 @@ private class ChatThemeScreenNode: ViewControllerTracingNode, ASScrollViewDelega
self.cancelButtonNode.buttonNode.addTarget(self, action: #selector(self.cancelButtonPressed), forControlEvents: .touchUpInside)
self.doneButton.pressed = { [weak self] in
if let strongSelf = self {
strongSelf.doneButton.isUserInteractionEnabled = false
if strongSelf.doneButton.font == .bold {
strongSelf.complete()
} else {
@ -1349,6 +1350,7 @@ private class ChatThemeScreenNode: ViewControllerTracingNode, ASScrollViewDelega
func complete() {
let proceed = {
self.doneButton.isUserInteractionEnabled = false
self.completion?(self.selectedTheme)
}
if case let .gift(gift, _) = self.selectedTheme, case let .unique(uniqueGift) = gift, let themePeerId = uniqueGift.themePeerId {

View File

@ -996,7 +996,7 @@ final class GiftsListView: UIView {
fadeTransition.setAlpha(view: self.emptyResultsClippingView, alpha: visibleHeight < 300.0 ? 0.0 : 1.0)
if self.peerId == self.context.account.peerId, !self.canSelect && !self.filteredResultsAreEmpty && self.profileGifts.collectionId == nil {
if self.peerId == self.context.account.peerId, !self.canSelect && !self.filteredResultsAreEmpty && self.profileGifts.collectionId == nil && self.emptyResultsClippingView.isHidden {
let footerText: ComponentView<Empty>
if let current = self.footerText {
footerText = current
@ -1024,6 +1024,13 @@ final class GiftsListView: UIView {
transition.setFrame(view: view, frame: CGRect(origin: CGPoint(x: floor((size.width - footerTextSize.width) / 2.0), y: contentHeight), size: footerTextSize))
}
contentHeight += footerTextSize.height
} else if let footerText = self.footerText {
self.footerText = nil
if let view = footerText.view {
fadeTransition.setAlpha(view: view, alpha: 0.0, completion: { _ in
view.removeFromSuperview()
})
}
}
return contentHeight

View File

@ -90,7 +90,6 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr
private let tabSelector = ComponentView<Empty>()
public private(set) var currentCollection: GiftCollection = .all
private var footerText: ComponentView<Empty>?
private var panelBackground: NavigationBackgroundNode?
private var panelSeparator: ASDisplayNode?
private var panelButton: ComponentView<Empty>?