mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Stories
This commit is contained in:
parent
5862088d85
commit
9d58e1d406
@ -982,12 +982,12 @@ public final class ChatListContainerNode: ASDisplayNode, UIGestureRecognizerDele
|
||||
}
|
||||
}
|
||||
}
|
||||
itemNode.listNode.didBeginInteractiveDragging = { [weak self] _ in
|
||||
itemNode.listNode.didBeginInteractiveDragging = { [weak self] listView in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
|
||||
self.didBeginInteractiveDragging?()
|
||||
self.didBeginInteractiveDragging?(listView)
|
||||
|
||||
if self.isInlineMode {
|
||||
return
|
||||
@ -1115,7 +1115,7 @@ public final class ChatListContainerNode: ASDisplayNode, UIGestureRecognizerDele
|
||||
var contentOffset: ListViewVisibleContentOffset?
|
||||
public var contentOffsetChanged: ((ListViewVisibleContentOffset, ListView) -> Void)?
|
||||
public var contentScrollingEnded: ((ListView) -> Bool)?
|
||||
var didBeginInteractiveDragging: (() -> Void)?
|
||||
var didBeginInteractiveDragging: ((ListView) -> Void)?
|
||||
var endedInteractiveDragging: ((ListView) -> Void)?
|
||||
var shouldStopScrolling: ((ListView, CGFloat) -> Bool)?
|
||||
var activateChatPreview: ((ChatListItem, Int64?, ASDisplayNode, ContextGesture?, CGPoint?) -> Void)?
|
||||
@ -1822,8 +1822,8 @@ final class ChatListControllerNode: ASDisplayNode, UIGestureRecognizerDelegate {
|
||||
self.mainContainerNode.contentScrollingEnded = { [weak self] listView in
|
||||
return self?.contentScrollingEnded(listView: listView, isPrimary: true) ?? false
|
||||
}
|
||||
self.mainContainerNode.didBeginInteractiveDragging = { [weak self] in
|
||||
self?.didBeginInteractiveDragging(isPrimary: true)
|
||||
self.mainContainerNode.didBeginInteractiveDragging = { [weak self] listView in
|
||||
self?.didBeginInteractiveDragging(listView: listView, isPrimary: true)
|
||||
}
|
||||
self.mainContainerNode.endedInteractiveDragging = { [weak self] listView in
|
||||
self?.endedInteractiveDragging(listView: listView, isPrimary: true)
|
||||
@ -2427,6 +2427,12 @@ final class ChatListControllerNode: ASDisplayNode, UIGestureRecognizerDelegate {
|
||||
overscrollHiddenChatItemsAllowed = storyPeerListView.overscrollHiddenChatItemsAllowed
|
||||
}
|
||||
|
||||
if let chatListNode = listView as? ChatListNode {
|
||||
if chatListNode.hasItemsToBeRevealed() {
|
||||
overscrollSelectedId = nil
|
||||
}
|
||||
}
|
||||
|
||||
if let controller = self.controller {
|
||||
if let peerId = overscrollSelectedId {
|
||||
if self.allowOverscrollStoryExpansion && self.inlineStackContainerNode == nil && isPrimary {
|
||||
@ -2514,9 +2520,13 @@ final class ChatListControllerNode: ASDisplayNode, UIGestureRecognizerDelegate {
|
||||
return false
|
||||
}
|
||||
|
||||
private func didBeginInteractiveDragging(isPrimary: Bool) {
|
||||
private func didBeginInteractiveDragging(listView: ListView, isPrimary: Bool) {
|
||||
if isPrimary {
|
||||
self.allowOverscrollStoryExpansion = true
|
||||
if let chatListNode = listView as? ChatListNode, !chatListNode.hasItemsToBeRevealed() {
|
||||
self.allowOverscrollStoryExpansion = true
|
||||
} else {
|
||||
self.allowOverscrollStoryExpansion = false
|
||||
}
|
||||
}
|
||||
self.allowOverscrollItemExpansion = true
|
||||
}
|
||||
@ -2598,8 +2608,8 @@ final class ChatListControllerNode: ASDisplayNode, UIGestureRecognizerDelegate {
|
||||
inlineStackContainerNode.contentOffsetChanged = { [weak self] offset, listView in
|
||||
self?.contentOffsetChanged(offset: offset, listView: listView, isPrimary: false)
|
||||
}
|
||||
inlineStackContainerNode.didBeginInteractiveDragging = { [weak self] in
|
||||
self?.didBeginInteractiveDragging(isPrimary: false)
|
||||
inlineStackContainerNode.didBeginInteractiveDragging = { [weak self] listView in
|
||||
self?.didBeginInteractiveDragging(listView: listView, isPrimary: false)
|
||||
}
|
||||
inlineStackContainerNode.endedInteractiveDragging = { [weak self] listView in
|
||||
self?.endedInteractiveDragging(listView: listView, isPrimary: false)
|
||||
|
@ -2890,6 +2890,29 @@ public final class ChatListNode: ListView {
|
||||
}
|
||||
}
|
||||
|
||||
func hasItemsToBeRevealed() -> Bool {
|
||||
if self.currentState.hiddenItemShouldBeTemporaryRevealed {
|
||||
return false
|
||||
}
|
||||
var isHiddenItemVisible = false
|
||||
self.forEachItemNode({ itemNode in
|
||||
if let itemNode = itemNode as? ChatListItemNode, let item = itemNode.item {
|
||||
if case let .peer(peerData) = item.content, let threadInfo = peerData.threadInfo {
|
||||
if threadInfo.isHidden {
|
||||
isHiddenItemVisible = true
|
||||
}
|
||||
}
|
||||
if case let .groupReference(groupReference) = item.content {
|
||||
if groupReference.hiddenByDefault {
|
||||
isHiddenItemVisible = true
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return isHiddenItemVisible
|
||||
}
|
||||
|
||||
func revealScrollHiddenItem() {
|
||||
var isHiddenItemVisible = false
|
||||
self.forEachItemNode({ itemNode in
|
||||
|
@ -815,7 +815,7 @@ public final class StoryPeerListComponent: Component {
|
||||
self.overscrollHiddenChatItemsAllowed = false
|
||||
}
|
||||
|
||||
if let overscrollFocusIndex, overscrollStage2 >= 0.7 {
|
||||
if let overscrollFocusIndex, overscrollStage2 >= 1.2 {
|
||||
self.overscrollSelectedId = self.sortedItems[overscrollFocusIndex].peer.id
|
||||
} else {
|
||||
self.overscrollSelectedId = nil
|
||||
@ -1405,6 +1405,10 @@ public final class StoryPeerListComponent: Component {
|
||||
return nil
|
||||
}
|
||||
} else {
|
||||
if !self.scrollView.frame.contains(point) {
|
||||
return nil
|
||||
}
|
||||
|
||||
if !result.isDescendant(of: self.scrollContainerView) {
|
||||
return nil
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user