mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-08 08:31:13 +00:00
Fix missing call list messages and animations
This commit is contained in:
parent
74ad5740ee
commit
0a20d69a3d
@ -104,7 +104,7 @@ class CallListCallItem: ListViewItem {
|
||||
Queue.mainQueue().async {
|
||||
completion(node, {
|
||||
return (nil, { _ in
|
||||
nodeApply().1(false)
|
||||
nodeApply(synchronousLoads).1(false)
|
||||
})
|
||||
})
|
||||
}
|
||||
@ -124,7 +124,7 @@ class CallListCallItem: ListViewItem {
|
||||
}
|
||||
Queue.mainQueue().async {
|
||||
completion(nodeLayout, { _ in
|
||||
apply().1(animated)
|
||||
apply(false).1(animated)
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -250,7 +250,7 @@ class CallListCallItemNode: ItemListRevealOptionsItemNode {
|
||||
let (nodeLayout, nodeApply) = makeLayout(item, params, first, last, firstWithHeader, callListNeighbors(item: item, topItem: previousItem, bottomItem: nextItem))
|
||||
self.contentSize = nodeLayout.contentSize
|
||||
self.insets = nodeLayout.insets
|
||||
let _ = nodeApply()
|
||||
let _ = nodeApply(false)
|
||||
}
|
||||
}
|
||||
|
||||
@ -284,7 +284,7 @@ class CallListCallItemNode: ItemListRevealOptionsItemNode {
|
||||
}
|
||||
}
|
||||
|
||||
func asyncLayout() -> (_ item: CallListCallItem, _ params: ListViewItemLayoutParams, _ first: Bool, _ last: Bool, _ firstWithHeader: Bool, _ neighbors: ItemListNeighbors) -> (ListViewItemNodeLayout, () -> (Signal<Void, NoError>?, (Bool) -> Void)) {
|
||||
func asyncLayout() -> (_ item: CallListCallItem, _ params: ListViewItemLayoutParams, _ first: Bool, _ last: Bool, _ firstWithHeader: Bool, _ neighbors: ItemListNeighbors) -> (ListViewItemNodeLayout, (Bool) -> (Signal<Void, NoError>?, (Bool) -> Void)) {
|
||||
let makeTitleLayout = TextNode.asyncLayout(self.titleNode)
|
||||
let makeStatusLayout = TextNode.asyncLayout(self.statusNode)
|
||||
let makeDateLayout = TextNode.asyncLayout(self.dateNode)
|
||||
@ -445,14 +445,14 @@ class CallListCallItemNode: ItemListRevealOptionsItemNode {
|
||||
|
||||
let contentSize = nodeLayout.contentSize
|
||||
|
||||
return (nodeLayout, { [weak self] in
|
||||
return (nodeLayout, { [weak self] synchronousLoads in
|
||||
if let strongSelf = self {
|
||||
if let peer = item.topMessage.peers[item.topMessage.id.peerId] {
|
||||
var overrideImage: AvatarNodeImageOverride?
|
||||
if peer.isDeleted {
|
||||
overrideImage = .deletedIcon
|
||||
}
|
||||
strongSelf.avatarNode.setPeer(account: item.account, theme: item.presentationData.theme, peer: peer, overrideImage: overrideImage, emptyColor: item.presentationData.theme.list.mediaPlaceholderColor)
|
||||
strongSelf.avatarNode.setPeer(account: item.account, theme: item.presentationData.theme, peer: peer, overrideImage: overrideImage, emptyColor: item.presentationData.theme.list.mediaPlaceholderColor, synchronousLoad: synchronousLoads)
|
||||
}
|
||||
|
||||
return (strongSelf.avatarNode.ready, { [weak strongSelf] animated in
|
||||
|
@ -72,11 +72,21 @@ func preparedCallListNodeViewTransition(from fromView: CallListNodeView?, to toV
|
||||
var stationaryItemRange: (Int, Int)?
|
||||
var scrollToItem: ListViewScrollToItem?
|
||||
|
||||
var wasEmpty = false
|
||||
if let fromView = fromView, fromView.originalView.entries.isEmpty {
|
||||
wasEmpty = true
|
||||
}
|
||||
|
||||
switch reason {
|
||||
case .initial:
|
||||
let _ = options.insert(.LowLatency)
|
||||
let _ = options.insert(.Synchronous)
|
||||
let _ = options.insert(.PreferSynchronousResourceLoading)
|
||||
case .interactiveChanges:
|
||||
if wasEmpty {
|
||||
let _ = options.insert(.Synchronous)
|
||||
let _ = options.insert(.PreferSynchronousResourceLoading)
|
||||
} else {
|
||||
let _ = options.insert(.AnimateAlpha)
|
||||
if !disableAnimations {
|
||||
let _ = options.insert(.AnimateInsertion)
|
||||
@ -88,12 +98,14 @@ func preparedCallListNodeViewTransition(from fromView: CallListNodeView?, to toV
|
||||
maxAnimatedInsertionIndex += 1
|
||||
}
|
||||
}
|
||||
}
|
||||
case .reload:
|
||||
break
|
||||
case .reloadAnimated:
|
||||
let _ = options.insert(.LowLatency)
|
||||
let _ = options.insert(.Synchronous)
|
||||
let _ = options.insert(.AnimateCrossfade)
|
||||
let _ = options.insert(.PreferSynchronousResourceLoading)
|
||||
}
|
||||
|
||||
for (index, entry, previousIndex) in indicesAndItems {
|
||||
|
@ -82,6 +82,7 @@ final class MutableGlobalMessageTagsViewReplayContext {
|
||||
|
||||
final class MutableGlobalMessageTagsView: MutablePostboxView {
|
||||
private let globalTag: GlobalMessageTags
|
||||
private let position: MessageIndex
|
||||
private let count: Int
|
||||
private let groupingPredicate: ((Message, Message) -> Bool)?
|
||||
|
||||
@ -91,6 +92,7 @@ final class MutableGlobalMessageTagsView: MutablePostboxView {
|
||||
|
||||
init(postbox: Postbox, globalTag: GlobalMessageTags, position: MessageIndex, count: Int, groupingPredicate: ((Message, Message) -> Bool)?) {
|
||||
self.globalTag = globalTag
|
||||
self.position = position
|
||||
self.count = count
|
||||
self.groupingPredicate = groupingPredicate
|
||||
|
||||
@ -115,6 +117,11 @@ final class MutableGlobalMessageTagsView: MutablePostboxView {
|
||||
|
||||
let context = MutableGlobalMessageTagsViewReplayContext()
|
||||
|
||||
var wasSingleHole = false
|
||||
if self.entries.count == 1, case .hole = self.entries[0] {
|
||||
wasSingleHole = true
|
||||
}
|
||||
|
||||
for operation in transaction.currentGlobalTagsOperations {
|
||||
switch operation {
|
||||
case let .insertMessage(tags, message):
|
||||
@ -172,6 +179,21 @@ final class MutableGlobalMessageTagsView: MutablePostboxView {
|
||||
}
|
||||
|
||||
if hasChanges || !context.empty() {
|
||||
if wasSingleHole {
|
||||
let (entries, lower, upper) = postbox.messageHistoryTable.entriesAround(globalTagMask: self.globalTag, index: self.position, count: self.count)
|
||||
|
||||
self.entries = entries.map { entry -> InternalGlobalMessageTagsEntry in
|
||||
switch entry {
|
||||
case let .message(message):
|
||||
return .intermediateMessage(message)
|
||||
case let .hole(index):
|
||||
return .hole(index)
|
||||
}
|
||||
}
|
||||
self.earlier = lower
|
||||
self.later = upper
|
||||
}
|
||||
|
||||
self.complete(postbox: postbox, context: context)
|
||||
self.render(postbox: postbox)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user