Various improvements

This commit is contained in:
Ali
2023-04-14 18:59:33 +04:00
parent 014ee47a95
commit cfe7f43e0d
33 changed files with 430 additions and 85 deletions

View File

@@ -360,7 +360,7 @@ final class ChatLoadingPlaceholderNode: ASDisplayNode {
let messageContainer = self.messageContainers[k]
let messageSize = messageContainer.frame.size
messageContainer.update(size: size, hasAvatar: self.chatType != .channel, rect: CGRect(origin: CGPoint(x: 0.0, y: offset - messageSize.height), size: messageSize), transition: transition)
messageContainer.update(size: size, hasAvatar: self.chatType != .channel && self.chatType != .user, rect: CGRect(origin: CGPoint(x: 0.0, y: offset - messageSize.height), size: messageSize), transition: transition)
offset -= messageSize.height
}
}
@@ -388,6 +388,7 @@ final class ChatLoadingPlaceholderNode: ASDisplayNode {
enum ChatType: Equatable {
case generic
case user
case group
case channel
}
@@ -395,7 +396,9 @@ final class ChatLoadingPlaceholderNode: ASDisplayNode {
func updatePresentationInterfaceState(_ chatPresentationInterfaceState: ChatPresentationInterfaceState) {
var chatType: ChatType = .channel
if let peer = chatPresentationInterfaceState.renderedPeer?.peer {
if peer is TelegramGroup {
if peer is TelegramUser {
chatType = .user
} else if peer is TelegramGroup {
chatType = .group
} else if let channel = peer as? TelegramChannel {
if case .group = channel.info {
@@ -469,7 +472,7 @@ final class ChatLoadingPlaceholderNode: ASDisplayNode {
for messageContainer in self.messageContainers {
let messageSize = dimensions[index % 14]
messageContainer.update(size: bounds.size, hasAvatar: self.chatType != .channel, rect: CGRect(origin: CGPoint(x: 0.0, y: bounds.size.height - insets.bottom - offset - messageSize.height), size: messageSize), transition: transition)
messageContainer.update(size: bounds.size, hasAvatar: self.chatType != .channel && self.chatType != .user, rect: CGRect(origin: CGPoint(x: 0.0, y: bounds.size.height - insets.bottom - offset - messageSize.height), size: messageSize), transition: transition)
offset += messageSize.height
index += 1
}