mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-06 17:00:13 +00:00
Fix monoforum loading placeholder
This commit is contained in:
parent
2ca01d18eb
commit
e3afecd82c
@ -3,6 +3,7 @@ import UIKit
|
||||
import AsyncDisplayKit
|
||||
import SwiftSignalKit
|
||||
import Display
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import TelegramPresentationData
|
||||
import ActivityIndicator
|
||||
@ -408,17 +409,17 @@ public final class ChatLoadingPlaceholderNode: ASDisplayNode {
|
||||
case channel
|
||||
}
|
||||
private var chatType: ChatType = .channel
|
||||
public func updatePresentationInterfaceState(_ chatPresentationInterfaceState: ChatPresentationInterfaceState) {
|
||||
public func updatePresentationInterfaceState(renderedPeer: RenderedPeer?, chatLocation: ChatLocation) {
|
||||
var chatType: ChatType = .channel
|
||||
if let peer = chatPresentationInterfaceState.renderedPeer?.peer {
|
||||
if let peer = renderedPeer?.peer {
|
||||
if peer is TelegramUser {
|
||||
chatType = .user
|
||||
} else if peer is TelegramGroup {
|
||||
chatType = .group
|
||||
} else if let channel = peer as? TelegramChannel {
|
||||
if channel.isMonoForum {
|
||||
if let mainChannel = chatPresentationInterfaceState.renderedPeer?.chatOrMonoforumMainPeer as? TelegramChannel, mainChannel.hasPermission(.sendSomething) {
|
||||
if chatPresentationInterfaceState.chatLocation.threadId == nil {
|
||||
if let mainChannel = renderedPeer?.chatOrMonoforumMainPeer as? TelegramChannel, mainChannel.hasPermission(.sendSomething) {
|
||||
if chatLocation.threadId == nil {
|
||||
chatType = .group
|
||||
} else {
|
||||
chatType = .user
|
||||
|
||||
@ -200,6 +200,7 @@ class ChatControllerNode: ASDisplayNode, ASScrollViewDelegate {
|
||||
|
||||
private(set) var validLayout: (ContainerViewLayout, CGFloat)?
|
||||
private var visibleAreaInset = UIEdgeInsets()
|
||||
private var loadingNodeInsets = UIEdgeInsets()
|
||||
private var currentListViewLayout: (size: CGSize, insets: UIEdgeInsets, scrollIndicatorInsets: UIEdgeInsets)?
|
||||
|
||||
private(set) var searchNavigationNode: ChatSearchNavigationContentNode?
|
||||
@ -360,7 +361,7 @@ class ChatControllerNode: ASDisplayNode, ASScrollViewDelegate {
|
||||
}
|
||||
} else {
|
||||
loadingPlaceholderNode = ChatLoadingPlaceholderNode(context: self.context, theme: self.chatPresentationInterfaceState.theme, chatWallpaper: self.chatPresentationInterfaceState.chatWallpaper, bubbleCorners: self.chatPresentationInterfaceState.bubbleCorners, backgroundNode: self.backgroundNode)
|
||||
loadingPlaceholderNode.updatePresentationInterfaceState(self.chatPresentationInterfaceState)
|
||||
loadingPlaceholderNode.updatePresentationInterfaceState(renderedPeer: self.chatPresentationInterfaceState.renderedPeer, chatLocation: self.chatLocation)
|
||||
self.backgroundNode.supernode?.insertSubnode(loadingPlaceholderNode, aboveSubnode: self.backgroundNode)
|
||||
|
||||
self.loadingPlaceholderNode = loadingPlaceholderNode
|
||||
@ -370,7 +371,7 @@ class ChatControllerNode: ASDisplayNode, ASScrollViewDelegate {
|
||||
let contentBounds = self.loadingNode.frame
|
||||
loadingPlaceholderNode.frame = contentBounds
|
||||
if let loadingPlaceholderNode = self.loadingPlaceholderNode, let validLayout = self.validLayout {
|
||||
loadingPlaceholderNode.updateLayout(size: contentBounds.size, insets: self.visibleAreaInset, metrics: validLayout.0.metrics, transition: .immediate)
|
||||
loadingPlaceholderNode.updateLayout(size: contentBounds.size, insets: self.loadingNodeInsets, metrics: validLayout.0.metrics, transition: .immediate)
|
||||
loadingPlaceholderNode.update(rect: contentBounds, within: contentBounds.size, transition: .immediate)
|
||||
}
|
||||
}
|
||||
@ -2245,6 +2246,7 @@ class ChatControllerNode: ASDisplayNode, ASScrollViewDelegate {
|
||||
if let leftPanelSize {
|
||||
loadingNodeInsets.left += leftPanelSize.width
|
||||
}
|
||||
self.loadingNodeInsets = loadingNodeInsets
|
||||
self.loadingNode.updateLayout(size: contentBounds.size, insets: loadingNodeInsets, transition: transition)
|
||||
|
||||
if let loadingPlaceholderNode = self.loadingPlaceholderNode {
|
||||
@ -3571,7 +3573,9 @@ class ChatControllerNode: ASDisplayNode, ASScrollViewDelegate {
|
||||
self.backgroundNode.update(wallpaper: chatPresentationInterfaceState.chatWallpaper, animated: true)
|
||||
|
||||
self.historyNode.verticalScrollIndicatorColor = UIColor(white: 0.5, alpha: 0.8)
|
||||
self.loadingPlaceholderNode?.updatePresentationInterfaceState(chatPresentationInterfaceState)
|
||||
if self.pendingSwitchToChatLocation == nil {
|
||||
self.loadingPlaceholderNode?.updatePresentationInterfaceState(renderedPeer: chatPresentationInterfaceState.renderedPeer, chatLocation: self.chatLocation)
|
||||
}
|
||||
|
||||
var updatedInputFocus = self.chatPresentationInterfaceStateRequiresInputFocus(self.chatPresentationInterfaceState) != self.chatPresentationInterfaceStateRequiresInputFocus(chatPresentationInterfaceState)
|
||||
if self.chatPresentationInterfaceStateInputView(self.chatPresentationInterfaceState) !== self.chatPresentationInterfaceStateInputView(chatPresentationInterfaceState) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user