Various fixes

This commit is contained in:
Ilya Laktyushin 2022-11-07 23:21:46 +04:00
parent ec4283159b
commit 176aabb041
4 changed files with 26 additions and 19 deletions

View File

@ -1446,7 +1446,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
if let restrictedNode = self.restrictedNode { if let restrictedNode = self.restrictedNode {
transition.updateFrame(node: restrictedNode, frame: contentBounds) transition.updateFrame(node: restrictedNode, frame: contentBounds)
restrictedNode.update(rect: contentBounds, within: contentBounds.size, transition: transition) restrictedNode.update(rect: contentBounds, within: contentBounds.size, transition: transition)
restrictedNode.updateLayout(backgroundNode: self.backgroundNode, size: contentBounds.size, transition: transition) restrictedNode.updateLayout(presentationData: ChatPresentationData(theme: ChatPresentationThemeData(theme: self.chatPresentationInterfaceState.theme, wallpaper: self.chatPresentationInterfaceState.chatWallpaper), fontSize: self.chatPresentationInterfaceState.fontSize, strings: self.chatPresentationInterfaceState.strings, dateTimeFormat: self.chatPresentationInterfaceState.dateTimeFormat, nameDisplayOrder: self.chatPresentationInterfaceState.nameDisplayOrder, disableAnimations: false, largeEmoji: false, chatBubbleCorners: PresentationChatBubbleCorners(mainRadius: 0.0, auxiliaryRadius: 0.0, mergeBubbleCorners: false)), backgroundNode: self.backgroundNode, size: contentBounds.size, transition: transition)
} }
let (duration, curve) = listViewAnimationDurationAndCurve(transition: transition) let (duration, curve) = listViewAnimationDurationAndCurve(transition: transition)
@ -2343,7 +2343,9 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
self.historyNodeContainer.isHidden = true self.historyNodeContainer.isHidden = true
self.navigateButtons.isHidden = true self.navigateButtons.isHidden = true
self.loadingNode.isHidden = true self.loadingNode.isHidden = true
self.loadingPlaceholderNode?.isHidden = true
self.emptyNode?.isHidden = true self.emptyNode?.isHidden = true
self.updateIsLoading(isLoading: false, earlier: false, animated: false)
} else if let restrictedNode = self.restrictedNode { } else if let restrictedNode = self.restrictedNode {
self.restrictedNode = nil self.restrictedNode = nil
restrictedNode.removeFromSupernode() restrictedNode.removeFromSupernode()

View File

@ -963,8 +963,6 @@ final class ChatEmptyNode: ASDisplayNode {
self.backgroundNode.updateColor(color: selectDateFillStaticColor(theme: interfaceState.theme, wallpaper: interfaceState.chatWallpaper), enableBlur: dateFillNeedsBlur(theme: interfaceState.theme, wallpaper: interfaceState.chatWallpaper), transition: .immediate) self.backgroundNode.updateColor(color: selectDateFillStaticColor(theme: interfaceState.theme, wallpaper: interfaceState.chatWallpaper), enableBlur: dateFillNeedsBlur(theme: interfaceState.theme, wallpaper: interfaceState.chatWallpaper), transition: .immediate)
} }
var isScheduledMessages = false var isScheduledMessages = false
if case .scheduledMessages = interfaceState.subject { if case .scheduledMessages = interfaceState.subject {
isScheduledMessages = true isScheduledMessages = true

View File

@ -50,6 +50,7 @@ final class ChatRecentActionsControllerNode: ViewControllerTracingNode {
private let galleryHiddenMesageAndMediaDisposable = MetaDisposable() private let galleryHiddenMesageAndMediaDisposable = MetaDisposable()
private let temporaryHiddenGalleryMediaDisposable = MetaDisposable() private let temporaryHiddenGalleryMediaDisposable = MetaDisposable()
private var chatPresentationData: ChatPresentationData
private var chatPresentationDataPromise: Promise<ChatPresentationData> private var chatPresentationDataPromise: Promise<ChatPresentationData>
private var automaticMediaDownloadSettings: MediaAutoDownloadSettings private var automaticMediaDownloadSettings: MediaAutoDownloadSettings
@ -120,6 +121,7 @@ final class ChatRecentActionsControllerNode: ViewControllerTracingNode {
self.emptyNode = ChatRecentActionsEmptyNode(theme: self.presentationData.theme, chatWallpaper: self.presentationData.chatWallpaper, chatBubbleCorners: self.presentationData.chatBubbleCorners) self.emptyNode = ChatRecentActionsEmptyNode(theme: self.presentationData.theme, chatWallpaper: self.presentationData.chatWallpaper, chatBubbleCorners: self.presentationData.chatBubbleCorners)
self.emptyNode.alpha = 0.0 self.emptyNode.alpha = 0.0
self.chatPresentationData = ChatPresentationData(theme: ChatPresentationThemeData(theme: presentationData.theme, wallpaper: presentationData.chatWallpaper), fontSize: presentationData.chatFontSize, strings: presentationData.strings, dateTimeFormat: presentationData.dateTimeFormat, nameDisplayOrder: presentationData.nameDisplayOrder, disableAnimations: true, largeEmoji: presentationData.largeEmoji, chatBubbleCorners: presentationData.chatBubbleCorners)
self.chatPresentationDataPromise = Promise() self.chatPresentationDataPromise = Promise()
self.eventLogContext = self.context.engine.peers.channelAdminEventLog(peerId: self.peer.id) self.eventLogContext = self.context.engine.peers.channelAdminEventLog(peerId: self.peer.id)
@ -628,7 +630,8 @@ final class ChatRecentActionsControllerNode: ViewControllerTracingNode {
func updatePresentationData(_ presentationData: PresentationData) { func updatePresentationData(_ presentationData: PresentationData) {
self.presentationData = presentationData self.presentationData = presentationData
self.chatPresentationDataPromise.set(.single(ChatPresentationData(theme: ChatPresentationThemeData(theme: presentationData.theme, wallpaper: presentationData.chatWallpaper), fontSize: presentationData.chatFontSize, strings: presentationData.strings, dateTimeFormat: presentationData.dateTimeFormat, nameDisplayOrder: presentationData.nameDisplayOrder, disableAnimations: true, largeEmoji: presentationData.largeEmoji, chatBubbleCorners: presentationData.chatBubbleCorners))) self.chatPresentationData = ChatPresentationData(theme: ChatPresentationThemeData(theme: presentationData.theme, wallpaper: presentationData.chatWallpaper), fontSize: presentationData.chatFontSize, strings: presentationData.strings, dateTimeFormat: presentationData.dateTimeFormat, nameDisplayOrder: presentationData.nameDisplayOrder, disableAnimations: true, largeEmoji: presentationData.largeEmoji, chatBubbleCorners: presentationData.chatBubbleCorners)
self.chatPresentationDataPromise.set(.single(self.chatPresentationData))
self.backgroundNode.update(wallpaper: presentationData.chatWallpaper) self.backgroundNode.update(wallpaper: presentationData.chatWallpaper)
self.backgroundNode.updateBubbleTheme(bubbleTheme: presentationData.theme, bubbleCorners: presentationData.chatBubbleCorners) self.backgroundNode.updateBubbleTheme(bubbleTheme: presentationData.theme, bubbleCorners: presentationData.chatBubbleCorners)
@ -667,7 +670,7 @@ final class ChatRecentActionsControllerNode: ViewControllerTracingNode {
let emptyFrame = CGRect(origin: CGPoint(x: 0.0, y: navigationBarHeight), size: CGSize(width: layout.size.width, height: layout.size.height - navigationBarHeight - panelHeight)) let emptyFrame = CGRect(origin: CGPoint(x: 0.0, y: navigationBarHeight), size: CGSize(width: layout.size.width, height: layout.size.height - navigationBarHeight - panelHeight))
transition.updateFrame(node: self.emptyNode, frame: emptyFrame) transition.updateFrame(node: self.emptyNode, frame: emptyFrame)
self.emptyNode.update(rect: emptyFrame, within: layout.size) self.emptyNode.update(rect: emptyFrame, within: layout.size)
self.emptyNode.updateLayout(backgroundNode: self.backgroundNode, size: emptyFrame.size, transition: transition) self.emptyNode.updateLayout(presentationData: self.chatPresentationData, backgroundNode: self.backgroundNode, size: emptyFrame.size, transition: transition)
let contentBottomInset: CGFloat = panelHeight + 4.0 let contentBottomInset: CGFloat = panelHeight + 4.0
let listInsets = UIEdgeInsets(top: contentBottomInset, left: layout.safeInsets.right, bottom: insets.top, right: layout.safeInsets.left) let listInsets = UIEdgeInsets(top: contentBottomInset, left: layout.safeInsets.right, bottom: insets.top, right: layout.safeInsets.left)

View File

@ -5,6 +5,7 @@ import AsyncDisplayKit
import TelegramCore import TelegramCore
import TelegramPresentationData import TelegramPresentationData
import WallpaperBackgroundNode import WallpaperBackgroundNode
import ChatPresentationInterfaceState
private let titleFont = Font.medium(16.0) private let titleFont = Font.medium(16.0)
private let textFont = Font.regular(15.0) private let textFont = Font.regular(15.0)
@ -13,7 +14,7 @@ final class ChatRecentActionsEmptyNode: ASDisplayNode {
private var theme: PresentationTheme private var theme: PresentationTheme
private var chatWallpaper: TelegramWallpaper private var chatWallpaper: TelegramWallpaper
private let backgroundNode: ASImageNode private let backgroundNode: NavigationBackgroundNode
private let titleNode: TextNode private let titleNode: TextNode
private let textNode: TextNode private let textNode: TextNode
@ -22,7 +23,7 @@ final class ChatRecentActionsEmptyNode: ASDisplayNode {
private var absolutePosition: (CGRect, CGSize)? private var absolutePosition: (CGRect, CGSize)?
private var layoutParams: CGSize? private var layoutParams: (CGSize, ChatPresentationData)?
private var title: String = "" private var title: String = ""
private var text: String = "" private var text: String = ""
@ -31,8 +32,7 @@ final class ChatRecentActionsEmptyNode: ASDisplayNode {
self.theme = theme self.theme = theme
self.chatWallpaper = chatWallpaper self.chatWallpaper = chatWallpaper
self.backgroundNode = ASImageNode() self.backgroundNode = NavigationBackgroundNode(color: .clear)
self.backgroundNode.isLayerBacked = true
self.titleNode = TextNode() self.titleNode = TextNode()
self.titleNode.isUserInteractionEnabled = false self.titleNode.isUserInteractionEnabled = false
@ -44,9 +44,6 @@ final class ChatRecentActionsEmptyNode: ASDisplayNode {
self.allowsGroupOpacity = true self.allowsGroupOpacity = true
let graphics = PresentationResourcesChat.additionalGraphics(theme, wallpaper: chatWallpaper, bubbleCorners: chatBubbleCorners)
self.backgroundNode.image = graphics.chatEmptyItemBackgroundImage
self.addSubnode(self.backgroundNode) self.addSubnode(self.backgroundNode)
self.addSubnode(self.titleNode) self.addSubnode(self.titleNode)
self.addSubnode(self.textNode) self.addSubnode(self.textNode)
@ -62,9 +59,14 @@ final class ChatRecentActionsEmptyNode: ASDisplayNode {
} }
} }
func updateLayout(backgroundNode: WallpaperBackgroundNode, size: CGSize, transition: ContainedViewLayoutTransition) { func updateLayout(presentationData: ChatPresentationData, backgroundNode: WallpaperBackgroundNode, size: CGSize, transition: ContainedViewLayoutTransition) {
self.wallpaperBackgroundNode = backgroundNode self.wallpaperBackgroundNode = backgroundNode
self.layoutParams = size self.layoutParams = (size, presentationData)
self.theme = presentationData.theme.theme
self.chatWallpaper = presentationData.theme.wallpaper
self.backgroundNode.updateColor(color: selectDateFillStaticColor(theme: presentationData.theme.theme, wallpaper: presentationData.theme.wallpaper), enableBlur: dateFillNeedsBlur(theme: presentationData.theme.theme, wallpaper: presentationData.theme.wallpaper), transition: .immediate)
let insets = UIEdgeInsets(top: 10.0, left: 10.0, bottom: 10.0, right: 10.0) let insets = UIEdgeInsets(top: 10.0, left: 10.0, bottom: 10.0, right: 10.0)
@ -82,6 +84,8 @@ final class ChatRecentActionsEmptyNode: ASDisplayNode {
let contentSize = CGSize(width: max(titleLayout.size.width, textLayout.size.width) + insets.left + insets.right, height: insets.top + insets.bottom + titleLayout.size.height + spacing + textLayout.size.height) let contentSize = CGSize(width: max(titleLayout.size.width, textLayout.size.width) + insets.left + insets.right, height: insets.top + insets.bottom + titleLayout.size.height + spacing + textLayout.size.height)
let backgroundFrame = CGRect(origin: CGPoint(x: floor((size.width - contentSize.width) / 2.0), y: floor((size.height - contentSize.height) / 2.0)), size: contentSize) let backgroundFrame = CGRect(origin: CGPoint(x: floor((size.width - contentSize.width) / 2.0), y: floor((size.height - contentSize.height) / 2.0)), size: contentSize)
transition.updateFrame(node: self.backgroundNode, frame: backgroundFrame) transition.updateFrame(node: self.backgroundNode, frame: backgroundFrame)
self.backgroundNode.update(size: self.backgroundNode.bounds.size, cornerRadius: min(14.0, self.backgroundNode.bounds.height / 2.0), transition: transition)
transition.updateFrame(node: self.titleNode, frame: CGRect(origin: CGPoint(x: backgroundFrame.minX + floor((contentSize.width - titleLayout.size.width) / 2.0), y: backgroundFrame.minY + insets.top), size: titleLayout.size)) transition.updateFrame(node: self.titleNode, frame: CGRect(origin: CGPoint(x: backgroundFrame.minX + floor((contentSize.width - titleLayout.size.width) / 2.0), y: backgroundFrame.minY + insets.top), size: titleLayout.size))
transition.updateFrame(node: self.textNode, frame: CGRect(origin: CGPoint(x: backgroundFrame.minX + floor((contentSize.width - textLayout.size.width) / 2.0), y: backgroundFrame.minY + insets.top + titleLayout.size.height + spacing), size: textLayout.size)) transition.updateFrame(node: self.textNode, frame: CGRect(origin: CGPoint(x: backgroundFrame.minX + floor((contentSize.width - textLayout.size.width) / 2.0), y: backgroundFrame.minY + insets.top + titleLayout.size.height + spacing), size: textLayout.size))
@ -119,8 +123,8 @@ final class ChatRecentActionsEmptyNode: ASDisplayNode {
if self.title != title || self.text != text { if self.title != title || self.text != text {
self.title = title self.title = title
self.text = text self.text = text
if let size = self.layoutParams, let wallpaperBackgroundNode = self.wallpaperBackgroundNode { if let (size, presentationData) = self.layoutParams, let wallpaperBackgroundNode = self.wallpaperBackgroundNode {
self.updateLayout(backgroundNode: wallpaperBackgroundNode, size: size, transition: .immediate) self.updateLayout(presentationData: presentationData, backgroundNode: wallpaperBackgroundNode, size: size, transition: .immediate)
} }
} }
} }