Restore background async in ListView

This commit is contained in:
Ali 2022-01-15 18:16:07 +04:00
parent d6f2d959a0
commit a5bea5b54d
3 changed files with 10 additions and 7 deletions

View File

@ -1575,7 +1575,7 @@ open class ListView: ASDisplayNode, UIScrollViewAccessibilityDelegate, UIGesture
}
private func async(_ f: @escaping () -> Void) {
DispatchQueue.main.async(execute: f)
DispatchQueue.global(qos: .userInteractive).async(execute: f)
}
private func nodeForItem(synchronous: Bool, synchronousLoads: Bool, item: ListViewItem, previousNode: QueueLocalObject<ListViewItemNode>?, index: Int, previousItem: ListViewItem?, nextItem: ListViewItem?, params: ListViewItemLayoutParams, updateAnimationIsAnimated: Bool, updateAnimationIsCrossfade: Bool, completion: @escaping (QueueLocalObject<ListViewItemNode>, ListViewItemNodeLayout, @escaping () -> (Signal<Void, NoError>?, (ListViewItemApply) -> Void)) -> Void) {

View File

@ -1255,14 +1255,14 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState
var hasReadReports = false
if let channel = peer as? TelegramChannel {
if case .group = channel.info {
if let cachedData = cachedData as? CachedChannelData, let memberCount = cachedData.participantsSummary.memberCount, memberCount <= 50 {
if canViewStats {
hasReadReports = true
}
} else {
reactionCount = 0
}
} else if let group = peer as? TelegramGroup {
if group.participantCount <= 50 {
} else if let _ = peer as? TelegramGroup {
if canViewStats {
hasReadReports = true
}
} else {

View File

@ -59,7 +59,7 @@ final class MessageReactionButtonsNode: ASDisplayNode {
private var bubbleBackgroundNode: WallpaperBubbleBackgroundNode?
private let container: ReactionButtonsAsyncLayoutContainer
private let backgroundMaskView: UIView
private var backgroundMaskView: UIView?
private var backgroundMaskButtons: [String: UIView] = [:]
var reactionSelected: ((String) -> Void)?
@ -67,7 +67,6 @@ final class MessageReactionButtonsNode: ASDisplayNode {
override init() {
self.container = ReactionButtonsAsyncLayoutContainer()
self.backgroundMaskView = UIView()
super.init()
}
@ -219,6 +218,10 @@ final class MessageReactionButtonsNode: ASDisplayNode {
return
}
if strongSelf.backgroundMaskView == nil {
strongSelf.backgroundMaskView = UIView()
}
let backgroundInsets: CGFloat = 10.0
switch type {
@ -330,7 +333,7 @@ final class MessageReactionButtonsNode: ASDisplayNode {
}
if itemMaskView.superview == nil {
strongSelf.backgroundMaskView.addSubview(itemMaskView)
strongSelf.backgroundMaskView?.addSubview(itemMaskView)
if animation.isAnimated {
itemMaskView.layer.animateScale(from: 0.01, to: 1.0, duration: 0.4, timingFunction: kCAMediaTimingFunctionSpring)
itemMaskView.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)