mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Merge branches 'master' and 'master' of gitlab.com:peter-iakovlev/telegram-ios
This commit is contained in:
commit
14d0dd3d6d
@ -3663,10 +3663,23 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
||||
if let componentView = self.chatListHeaderView(), let storyPeerListView = componentView.storyPeerListView() {
|
||||
let _ = storyPeerListView
|
||||
|
||||
var initialOrder: [EnginePeer.Id] = []
|
||||
if let orderedStorySubscriptions = self.orderedStorySubscriptions {
|
||||
if let accountItem = orderedStorySubscriptions.accountItem {
|
||||
if accountItem.hasPending || accountItem.storyCount != 0 {
|
||||
initialOrder.append(self.context.account.peerId)
|
||||
}
|
||||
}
|
||||
for item in orderedStorySubscriptions.items {
|
||||
initialOrder.append(item.peer.id)
|
||||
}
|
||||
}
|
||||
|
||||
StoryContainerScreen.openPeerStoriesCustom(
|
||||
context: self.context,
|
||||
peerId: peerId,
|
||||
isHidden: self.location == .chatList(groupId: .archive),
|
||||
initialOrder: initialOrder,
|
||||
singlePeer: false,
|
||||
parentController: self,
|
||||
transitionIn: { [weak self] in
|
||||
|
@ -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 {
|
||||
@ -2436,7 +2442,7 @@ final class ChatListControllerNode: ASDisplayNode, UIGestureRecognizerDelegate {
|
||||
self.currentOverscrollStoryExpansionTimestamp = timestamp
|
||||
}
|
||||
|
||||
if let currentOverscrollStoryExpansionTimestamp = self.currentOverscrollStoryExpansionTimestamp, currentOverscrollStoryExpansionTimestamp <= timestamp - 0.05 {
|
||||
if let currentOverscrollStoryExpansionTimestamp = self.currentOverscrollStoryExpansionTimestamp, currentOverscrollStoryExpansionTimestamp <= timestamp - 0.0 {
|
||||
self.allowOverscrollStoryExpansion = false
|
||||
self.currentOverscrollStoryExpansionTimestamp = nil
|
||||
self.allowOverscrollItemExpansion = false
|
||||
@ -2472,7 +2478,7 @@ final class ChatListControllerNode: ASDisplayNode, UIGestureRecognizerDelegate {
|
||||
self.currentOverscrollItemExpansionTimestamp = timestamp
|
||||
}
|
||||
|
||||
if let currentOverscrollItemExpansionTimestamp = self.currentOverscrollItemExpansionTimestamp, currentOverscrollItemExpansionTimestamp <= timestamp - 0.2 {
|
||||
if let currentOverscrollItemExpansionTimestamp = self.currentOverscrollItemExpansionTimestamp, currentOverscrollItemExpansionTimestamp <= timestamp - 0.0 {
|
||||
self.allowOverscrollItemExpansion = false
|
||||
|
||||
if 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
|
||||
@ -2906,7 +2929,7 @@ public final class ChatListNode: ListView {
|
||||
}
|
||||
}
|
||||
})
|
||||
if isHiddenItemVisible {
|
||||
if isHiddenItemVisible && !self.currentState.hiddenItemShouldBeTemporaryRevealed {
|
||||
if self.hapticFeedback == nil {
|
||||
self.hapticFeedback = HapticFeedback()
|
||||
}
|
||||
|
@ -1170,7 +1170,10 @@ func _internal_markStoryAsSeen(account: Account, peerId: PeerId, id: Int32, asPi
|
||||
).postboxRepresentation)
|
||||
}
|
||||
|
||||
#if DEBUG && false
|
||||
#else
|
||||
_internal_addSynchronizeViewStoriesOperation(peerId: peerId, storyId: id, transaction: transaction)
|
||||
#endif
|
||||
|
||||
return transaction.getPeer(peerId).flatMap(apiInputUser)
|
||||
}
|
||||
@ -1178,12 +1181,6 @@ func _internal_markStoryAsSeen(account: Account, peerId: PeerId, id: Int32, asPi
|
||||
account.stateManager.injectStoryUpdates(updates: [.read(peerId: peerId, maxId: id)])
|
||||
|
||||
return .complete()
|
||||
|
||||
/*return account.network.request(Api.functions.stories.readStories(userId: inputUser, maxId: id))
|
||||
|> `catch` { _ -> Signal<[Int32], NoError> in
|
||||
return .single([])
|
||||
}
|
||||
|> ignoreValues*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -158,6 +158,7 @@ public extension StoryContainerScreen {
|
||||
context: AccountContext,
|
||||
peerId: EnginePeer.Id,
|
||||
isHidden: Bool,
|
||||
initialOrder: [EnginePeer.Id] = [],
|
||||
singlePeer: Bool,
|
||||
parentController: ViewController,
|
||||
transitionIn: @escaping () -> StoryContainerScreen.TransitionIn?,
|
||||
@ -165,7 +166,7 @@ public extension StoryContainerScreen {
|
||||
setFocusedItem: @escaping (Signal<StoryId?, NoError>) -> Void,
|
||||
setProgress: @escaping (Signal<Never, NoError>) -> Void
|
||||
) {
|
||||
let storyContent = StoryContentContextImpl(context: context, isHidden: isHidden, focusedPeerId: peerId, singlePeer: singlePeer)
|
||||
let storyContent = StoryContentContextImpl(context: context, isHidden: isHidden, focusedPeerId: peerId, singlePeer: singlePeer, fixedOrder: initialOrder)
|
||||
let signal = storyContent.state
|
||||
|> take(1)
|
||||
|> mapToSignal { state -> Signal<StoryContentContextState, NoError> in
|
||||
|
@ -815,7 +815,8 @@ public final class StoryPeerListComponent: Component {
|
||||
self.overscrollHiddenChatItemsAllowed = false
|
||||
}
|
||||
|
||||
if let overscrollFocusIndex, overscrollStage2 >= 0.7 {
|
||||
//print("overscrollStage2: \(overscrollStage2)")
|
||||
if let overscrollFocusIndex, overscrollStage2 >= 1.25 {
|
||||
self.overscrollSelectedId = self.sortedItems[overscrollFocusIndex].peer.id
|
||||
} else {
|
||||
self.overscrollSelectedId = nil
|
||||
@ -1000,11 +1001,13 @@ public final class StoryPeerListComponent: Component {
|
||||
var leftNeighborDistance: CGPoint?
|
||||
var rightNeighborDistance: CGPoint?
|
||||
|
||||
if let leftItemFrame {
|
||||
leftNeighborDistance = CGPoint(x: abs(leftItemFrame.midX - measuredItem.itemFrame.midX), y: leftItemFrame.minY - measuredItem.itemFrame.minY)
|
||||
}
|
||||
if let rightItemFrame {
|
||||
rightNeighborDistance = CGPoint(x: abs(rightItemFrame.midX - measuredItem.itemFrame.midX), y: rightItemFrame.minY - measuredItem.itemFrame.minY)
|
||||
if collapsedState.maxFraction < 0.5 {
|
||||
if let leftItemFrame {
|
||||
leftNeighborDistance = CGPoint(x: abs(leftItemFrame.midX - measuredItem.itemFrame.midX), y: leftItemFrame.minY - measuredItem.itemFrame.minY)
|
||||
}
|
||||
if let rightItemFrame {
|
||||
rightNeighborDistance = CGPoint(x: abs(rightItemFrame.midX - measuredItem.itemFrame.midX), y: rightItemFrame.minY - measuredItem.itemFrame.minY)
|
||||
}
|
||||
}
|
||||
|
||||
let totalCount: Int
|
||||
@ -1138,11 +1141,13 @@ public final class StoryPeerListComponent: Component {
|
||||
var leftNeighborDistance: CGPoint?
|
||||
var rightNeighborDistance: CGPoint?
|
||||
|
||||
if let leftItemFrame {
|
||||
leftNeighborDistance = CGPoint(x: abs(leftItemFrame.midX - measuredItem.itemFrame.midX), y: leftItemFrame.minY - measuredItem.itemFrame.minY)
|
||||
}
|
||||
if let rightItemFrame {
|
||||
rightNeighborDistance = CGPoint(x: abs(rightItemFrame.midX - measuredItem.itemFrame.midX), y: rightItemFrame.minY - measuredItem.itemFrame.minY)
|
||||
if collapsedState.maxFraction < 0.5 {
|
||||
if let leftItemFrame {
|
||||
leftNeighborDistance = CGPoint(x: abs(leftItemFrame.midX - measuredItem.itemFrame.midX), y: leftItemFrame.minY - measuredItem.itemFrame.minY)
|
||||
}
|
||||
if let rightItemFrame {
|
||||
rightNeighborDistance = CGPoint(x: abs(rightItemFrame.midX - measuredItem.itemFrame.midX), y: rightItemFrame.minY - measuredItem.itemFrame.minY)
|
||||
}
|
||||
}
|
||||
|
||||
let _ = visibleItem.view.update(
|
||||
@ -1405,6 +1410,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
|
||||
}
|
||||
|
@ -640,8 +640,9 @@ public final class StoryPeerListItemComponent: Component {
|
||||
|
||||
let minimizedLineWidth: CGFloat = 4.3
|
||||
|
||||
let indicatorLineSeenWidth: CGFloat = baseLineSeenWidth * component.scale + minimizedLineWidth * (1.0 - component.scale)
|
||||
let indicatorLineUnseenWidth: CGFloat = baseLineUnseenWidth * component.scale + minimizedLineWidth * (1.0 - component.scale)
|
||||
let normalizedScale = max(0.0, min(1.0, component.scale))
|
||||
let indicatorLineSeenWidth: CGFloat = baseLineSeenWidth * normalizedScale + minimizedLineWidth * (1.0 - normalizedScale)
|
||||
let indicatorLineUnseenWidth: CGFloat = baseLineUnseenWidth * normalizedScale + minimizedLineWidth * (1.0 - normalizedScale)
|
||||
|
||||
avatarNode.setPeer(
|
||||
context: component.context,
|
||||
@ -715,7 +716,10 @@ public final class StoryPeerListItemComponent: Component {
|
||||
|
||||
let baseRadius: CGFloat = 30.66
|
||||
let collapsedRadius: CGFloat = 35.0
|
||||
let indicatorRadius: CGFloat = baseRadius * component.scale + collapsedRadius * (1.0 - component.scale)
|
||||
var indicatorRadius: CGFloat = baseRadius * normalizedScale + collapsedRadius * (1.0 - normalizedScale)
|
||||
if component.scale > 1.0 {
|
||||
indicatorRadius += max(0.0, component.scale - 1.0) * 0.0
|
||||
}
|
||||
|
||||
self.indicatorShapeSeenLayer.lineWidth = indicatorLineSeenWidth
|
||||
self.indicatorShapeUnseenLayer.lineWidth = indicatorLineUnseenWidth
|
||||
|
Loading…
x
Reference in New Issue
Block a user