Transcription animation improvements

This commit is contained in:
Ali 2022-05-31 16:10:13 +04:00
parent f581695640
commit 7cb9f925bd
3 changed files with 21 additions and 5 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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
}
}
}
}