mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-29 19:35:08 +00:00
Improve video messages autoscrolling
This commit is contained in:
parent
656a0247fc
commit
05c3ae3ae0
@ -1361,6 +1361,7 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
|||||||
|
|
||||||
if (isChat && (wasPlaying || currentlyPlayingVideo)) || (!isChat && !wasPlaying && currentlyPlayingVideo) {
|
if (isChat && (wasPlaying || currentlyPlayingVideo)) || (!isChat && !wasPlaying && currentlyPlayingVideo) {
|
||||||
var currentIsVisible = true
|
var currentIsVisible = true
|
||||||
|
var nextIsVisible = false
|
||||||
if let appliedPlayingMessageId = strongSelf.appliedPlayingMessageId {
|
if let appliedPlayingMessageId = strongSelf.appliedPlayingMessageId {
|
||||||
currentIsVisible = false
|
currentIsVisible = false
|
||||||
strongSelf.forEachVisibleMessageItemNode({ view in
|
strongSelf.forEachVisibleMessageItemNode({ view in
|
||||||
@ -1369,7 +1370,12 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if currentIsVisible && currentlyPlayingVideo {
|
strongSelf.forEachVisibleMessageItemNode({ view in
|
||||||
|
if view.item?.message.id == currentlyPlayingMessageId.id {
|
||||||
|
nextIsVisible = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if currentIsVisible && nextIsVisible && currentlyPlayingVideo {
|
||||||
updatedScrollPosition = .index(index: .message(currentlyPlayingMessageId), position: .center(.bottom), directionHint: .Up, animated: true, highlight: true, displayLink: true)
|
updatedScrollPosition = .index(index: .message(currentlyPlayingMessageId), position: .center(.bottom), directionHint: .Up, animated: true, highlight: true, displayLink: true)
|
||||||
scrollAnimationCurve = .Spring(duration: 0.4)
|
scrollAnimationCurve = .Spring(duration: 0.4)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user