Remove experimental scrolling code

This commit is contained in:
Ali 2021-11-25 19:01:43 +04:00
parent 9a2cfe9ed8
commit 17ca45d496

View File

@ -18,7 +18,6 @@ import AccountContext
import ChatInterfaceState import ChatInterfaceState
import ChatListUI import ChatListUI
import ComponentFlow import ComponentFlow
import SparseItemGrid
extension ChatReplyThreadMessage { extension ChatReplyThreadMessage {
var effectiveTopId: MessageId { var effectiveTopId: MessageId {
@ -574,7 +573,7 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
private var preloadAdPeerId: PeerId? private var preloadAdPeerId: PeerId?
private let preloadAdPeerDisposable = MetaDisposable() private let preloadAdPeerDisposable = MetaDisposable()
var historyScrollingArea: SparseDiscreteScrollingArea? { /*var historyScrollingArea: SparseDiscreteScrollingArea? {
didSet { didSet {
oldValue?.navigateToPosition = nil oldValue?.navigateToPosition = nil
if let historyScrollingArea = self.historyScrollingArea { if let historyScrollingArea = self.historyScrollingArea {
@ -586,10 +585,10 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
} }
} }
} }
} }*/
private var scrollingState: ListView.ScrollingIndicatorState? //private var scrollingState: ListView.ScrollingIndicatorState?
private let sparseScrollingContext: SparseMessageScrollingContext? //private let sparseScrollingContext: SparseMessageScrollingContext?
private let scrollNavigationDisposable = MetaDisposable() //private let scrollNavigationDisposable = MetaDisposable()
private let clientId: Atomic<Int32> private let clientId: Atomic<Int32>
@ -617,12 +616,12 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
self.prefetchManager = InChatPrefetchManager(context: context) self.prefetchManager = InChatPrefetchManager(context: context)
var displayAdPeer: PeerId? var displayAdPeer: PeerId?
var sparseScrollPeerId: PeerId? //var sparseScrollPeerId: PeerId?
switch subject { switch subject {
case .none, .message: case .none, .message:
if case let .peer(peerId) = chatLocation { if case let .peer(peerId) = chatLocation {
displayAdPeer = peerId displayAdPeer = peerId
sparseScrollPeerId = peerId //sparseScrollPeerId = peerId
} }
default: default:
break break
@ -637,11 +636,11 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
adMessages = .single([]) adMessages = .single([])
} }
if case .bubbles = mode, let peerId = sparseScrollPeerId { /*if case .bubbles = mode, let peerId = sparseScrollPeerId {
self.sparseScrollingContext = context.engine.messages.sparseMessageScrollingContext(peerId: peerId) self.sparseScrollingContext = context.engine.messages.sparseMessageScrollingContext(peerId: peerId)
} else { } else {
self.sparseScrollingContext = nil self.sparseScrollingContext = nil
} }*/
let clientId = Atomic<Int32>(value: nextClientId) let clientId = Atomic<Int32>(value: nextClientId)
self.clientId = clientId self.clientId = clientId
@ -1435,7 +1434,7 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
self?.isInteractivelyScrollingValue = true self?.isInteractivelyScrollingValue = true
self?.isInteractivelyScrollingPromise.set(true) self?.isInteractivelyScrollingPromise.set(true)
self?.beganDragging?() self?.beganDragging?()
self?.updateHistoryScrollingArea(transition: .immediate) //self?.updateHistoryScrollingArea(transition: .immediate)
} }
self.endedInteractiveDragging = { [weak self] _ in self.endedInteractiveDragging = { [weak self] _ in
@ -1477,16 +1476,16 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
} }
strongSelf.isInteractivelyScrollingValue = false strongSelf.isInteractivelyScrollingValue = false
strongSelf.isInteractivelyScrollingPromise.set(false) strongSelf.isInteractivelyScrollingPromise.set(false)
strongSelf.updateHistoryScrollingArea(transition: .immediate) //strongSelf.updateHistoryScrollingArea(transition: .immediate)
} }
self.updateScrollingIndicator = { [weak self] scrollingState, transition in /*self.updateScrollingIndicator = { [weak self] scrollingState, transition in
guard let strongSelf = self else { guard let strongSelf = self else {
return return
} }
strongSelf.scrollingState = scrollingState strongSelf.scrollingState = scrollingState
strongSelf.updateHistoryScrollingArea(transition: transition) strongSelf.updateHistoryScrollingArea(transition: transition)
} }*/
let selectionRecognizer = ChatHistoryListSelectionRecognizer(target: self, action: #selector(self.selectionPanGesture(_:))) let selectionRecognizer = ChatHistoryListSelectionRecognizer(target: self, action: #selector(self.selectionPanGesture(_:)))
selectionRecognizer.shouldBegin = { [weak self] in selectionRecognizer.shouldBegin = { [weak self] in
@ -1505,14 +1504,14 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
self.canReadHistoryDisposable?.dispose() self.canReadHistoryDisposable?.dispose()
self.loadedMessagesFromCachedDataDisposable?.dispose() self.loadedMessagesFromCachedDataDisposable?.dispose()
self.preloadAdPeerDisposable.dispose() self.preloadAdPeerDisposable.dispose()
self.scrollNavigationDisposable.dispose() //self.scrollNavigationDisposable.dispose()
} }
public func setLoadStateUpdated(_ f: @escaping (ChatHistoryNodeLoadState, Bool) -> Void) { public func setLoadStateUpdated(_ f: @escaping (ChatHistoryNodeLoadState, Bool) -> Void) {
self.loadStateUpdated = f self.loadStateUpdated = f
} }
private func updateHistoryScrollingArea(transition: ContainedViewLayoutTransition) { /*private func updateHistoryScrollingArea(transition: ContainedViewLayoutTransition) {
guard let historyScrollingArea = self.historyScrollingArea else { guard let historyScrollingArea = self.historyScrollingArea else {
return return
} }
@ -1633,7 +1632,7 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
} else { } else {
self.historyScrollingArea?.resetNavigatingToPosition() self.historyScrollingArea?.resetNavigatingToPosition()
} }
} }*/
private func maybeUpdateOverscrollAction(offset: CGFloat?) { private func maybeUpdateOverscrollAction(offset: CGFloat?) {
if self.freezeOverscrollControl { if self.freezeOverscrollControl {