diff --git a/submodules/Display/Source/ListView.swift b/submodules/Display/Source/ListView.swift index c53a1effa0..25a669b16c 100644 --- a/submodules/Display/Source/ListView.swift +++ b/submodules/Display/Source/ListView.swift @@ -4239,9 +4239,9 @@ open class ListView: ASDisplayNode, UIScrollViewAccessibilityDelegate, UIGesture if itemNode.apparentFrame.maxY <= visualInsets.top { offsetRanges.offset(IndexRange(first: 0, last: index), offset: -apparentHeightDelta) - } else if invertOffsetDirection { - if itemNode.apparentFrame.minY - apparentHeightDelta < visualInsets.top { - let overflowOffset = visualInsets.top - (itemNode.apparentFrame.minY - apparentHeightDelta) + } else if invertOffsetDirection /*&& itemNode.frame.height < self.visibleSize.height*/ { + if self.scroller.contentOffset.y < 1.0 { + /*let overflowOffset = visualInsets.top - (itemNode.apparentFrame.minY - apparentHeightDelta) let remainingOffset = apparentHeightDelta - overflowOffset offsetRanges.offset(IndexRange(first: 0, last: index), offset: -remainingOffset) @@ -4255,6 +4255,18 @@ open class ListView: ASDisplayNode, UIScrollViewAccessibilityDelegate, UIGesture } } + offsetRanges.offset(IndexRange(first: index + 1, last: Int.max), offset: offsetDelta)*/ + + var offsetDelta = apparentHeightDelta + if offsetDelta < 0.0 { + let maxDelta = visualInsets.top - itemNode.apparentFrame.maxY + if maxDelta > offsetDelta { + let remainingOffset = maxDelta - offsetDelta + offsetRanges.offset(IndexRange(first: 0, last: index), offset: remainingOffset) + offsetDelta = maxDelta + } + } + offsetRanges.offset(IndexRange(first: index + 1, last: Int.max), offset: offsetDelta) } else { offsetRanges.offset(IndexRange(first: 0, last: index), offset: -apparentHeightDelta) diff --git a/submodules/Display/Source/ListViewIntermediateState.swift b/submodules/Display/Source/ListViewIntermediateState.swift index 0edec15664..fcc91cc9a6 100644 --- a/submodules/Display/Source/ListViewIntermediateState.swift +++ b/submodules/Display/Source/ListViewIntermediateState.swift @@ -812,7 +812,7 @@ struct ListViewState { for node in self.nodes { i += 1 if node.index == itemIndex { - if isAnimated { + if !isAnimated { let offsetDirection: ListViewInsertionOffsetDirection if let direction = direction { offsetDirection = ListViewInsertionOffsetDirection(direction) diff --git a/submodules/TelegramUI/Sources/ChatMessageInteractiveFileNode.swift b/submodules/TelegramUI/Sources/ChatMessageInteractiveFileNode.swift index ac19923892..f2375eb673 100644 --- a/submodules/TelegramUI/Sources/ChatMessageInteractiveFileNode.swift +++ b/submodules/TelegramUI/Sources/ChatMessageInteractiveFileNode.swift @@ -42,7 +42,11 @@ private func transcribedText(message: Message) -> TranscribedText? { if !attribute.text.isEmpty { return .success(text: attribute.text, isPending: attribute.isPending) } else { - return .error + if attribute.isPending { + return nil + } else { + return .error + } } } }