diff --git a/submodules/ChatListUI/Sources/ChatListController.swift b/submodules/ChatListUI/Sources/ChatListController.swift index 59c04fdfc3..08c4e17a16 100644 --- a/submodules/ChatListUI/Sources/ChatListController.swift +++ b/submodules/ChatListUI/Sources/ChatListController.swift @@ -178,7 +178,10 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController private var powerSavingMonitoringDisposable: Disposable? - private(set) var storySubscriptions: EngineStorySubscriptions? + private var rawStorySubscriptions: EngineStorySubscriptions? + private var shouldFixStorySubscriptionOrder: Bool = false + private var fixedStorySubscriptionOrder: [EnginePeer.Id] = [] + var orderedStorySubscriptions: EngineStorySubscriptions? private var storyProgressDisposable: Disposable? private var storySubscriptionsDisposable: Disposable? @@ -838,6 +841,30 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController self.present(controller, in: .window(.root)) } + func allowAutomaticOrder() { + if !self.shouldFixStorySubscriptionOrder { + return + } + + self.shouldFixStorySubscriptionOrder = false + self.fixedStorySubscriptionOrder = self.rawStorySubscriptions?.items.map(\.peer.id) ?? [] + if self.orderedStorySubscriptions != self.rawStorySubscriptions { + self.orderedStorySubscriptions = self.rawStorySubscriptions + + // important not to cause a loop + DispatchQueue.main.async { [weak self] in + guard let self else { + return + } + + self.chatListDisplayNode.requestNavigationBarLayout(transition: Transition.immediate.withUserData(ChatListNavigationBar.AnimationHint( + disableStoriesAnimations: false, + crossfadeStoryPeers: true + ))) + } + } + } + private func updateThemeAndStrings() { if case .chatList(.root) = self.location { self.tabBarItem.title = self.presentationData.strings.DialogList_Title @@ -1283,7 +1310,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController return } - let storyContent = StoryContentContextImpl(context: self.context, isHidden: false, focusedPeerId: peerId, singlePeer: false) + let storyContent = StoryContentContextImpl(context: self.context, isHidden: false, focusedPeerId: peerId, singlePeer: true) let _ = (storyContent.state |> filter { $0.slice != nil } |> take(1) @@ -1821,17 +1848,38 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController } }) self.storySubscriptionsDisposable = (self.context.engine.messages.storySubscriptions(isHidden: false) - |> deliverOnMainQueue).start(next: { [weak self] storySubscriptions in + |> deliverOnMainQueue).start(next: { [weak self] rawStorySubscriptions in guard let self else { return } var wasEmpty = true - if let storySubscriptions = self.storySubscriptions, !storySubscriptions.items.isEmpty { + if let rawStorySubscriptions = self.rawStorySubscriptions, !rawStorySubscriptions.items.isEmpty { wasEmpty = false } - self.storySubscriptions = storySubscriptions - let isEmpty = storySubscriptions.items.isEmpty + + self.rawStorySubscriptions = rawStorySubscriptions + var items: [EngineStorySubscriptions.Item] = [] + if self.shouldFixStorySubscriptionOrder { + for peerId in self.fixedStorySubscriptionOrder { + if let item = rawStorySubscriptions.items.first(where: { $0.peer.id == peerId }) { + items.append(item) + } + } + } + for item in rawStorySubscriptions.items { + if !items.contains(where: { $0.peer.id == item.peer.id }) { + items.append(item) + } + } + self.orderedStorySubscriptions = EngineStorySubscriptions( + accountItem: rawStorySubscriptions.accountItem, + items: items, + hasMoreToken: rawStorySubscriptions.hasMoreToken + ) + self.fixedStorySubscriptionOrder = items.map(\.peer.id) + + let isEmpty = rawStorySubscriptions.items.isEmpty let transition: ContainedViewLayoutTransition if self.didAppear { @@ -1851,7 +1899,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController var chatListState = chatListState var peerStoryMapping: [EnginePeer.Id: Bool] = [:] - for item in storySubscriptions.items { + for item in rawStorySubscriptions.items { if item.peer.id == self.context.account.peerId { continue } @@ -2303,7 +2351,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController } } - func updateHeaderContent(layout: ContainerViewLayout, transition: ContainedViewLayoutTransition) -> (primaryContent: ChatListHeaderComponent.Content?, secondaryContent: ChatListHeaderComponent.Content?) { + func updateHeaderContent(layout: ContainerViewLayout) -> (primaryContent: ChatListHeaderComponent.Content?, secondaryContent: ChatListHeaderComponent.Content?) { var primaryContent: ChatListHeaderComponent.Content? if let primaryContext = self.primaryContext { var backTitle: String? @@ -2448,9 +2496,9 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController } if peer.id == self.context.account.peerId { - if let storySubscriptions = self.storySubscriptions { + if let rawStorySubscriptions = self.rawStorySubscriptions { var openCamera = false - if let accountItem = storySubscriptions.accountItem { + if let accountItem = rawStorySubscriptions.accountItem { openCamera = accountItem.storyCount == 0 } else { openCamera = true @@ -2463,7 +2511,8 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController } } - let storyContent = StoryContentContextImpl(context: self.context, isHidden: false, focusedPeerId: peer.id, singlePeer: false) + self.shouldFixStorySubscriptionOrder = true + let storyContent = StoryContentContextImpl(context: self.context, isHidden: false, focusedPeerId: peer.id, singlePeer: false, fixedOrder: self.fixedStorySubscriptionOrder) let _ = (storyContent.state |> take(1) |> deliverOnMainQueue).start(next: { [weak self] storyContentState in @@ -2584,7 +2633,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController let _ = self.context.engine.peers.togglePeerStoriesMuted(peerId: peer.id).start() }))) - items.append(.action(ContextMenuActionItem(text: "Archive", icon: { theme in + items.append(.action(ContextMenuActionItem(text: "Hide", icon: { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Archive"), color: theme.contextMenu.primaryColor) }, action: { [weak self] _, f in f(.dismissWithoutContent) diff --git a/submodules/ChatListUI/Sources/ChatListControllerNode.swift b/submodules/ChatListUI/Sources/ChatListControllerNode.swift index af67cc63fa..0b3bcb72e0 100644 --- a/submodules/ChatListUI/Sources/ChatListControllerNode.swift +++ b/submodules/ChatListUI/Sources/ChatListControllerNode.swift @@ -927,7 +927,7 @@ public final class ChatListContainerNode: ASDisplayNode, UIGestureRecognizerDele if itemNode.listNode.isTracking && !self.currentItemNode.startedScrollingAtUpperBound && self.tempTopInset == 0.0 { if case let .known(value) = offset { if value < -1.0 { - if let storySubscriptions = self.controller?.storySubscriptions, !storySubscriptions.items.isEmpty { + if let storySubscriptions = self.controller?.orderedStorySubscriptions, !storySubscriptions.items.isEmpty { self.currentItemNode.startedScrollingAtUpperBound = true self.tempTopInset = ChatListNavigationBar.storiesScrollHeight } @@ -958,7 +958,7 @@ public final class ChatListContainerNode: ASDisplayNode, UIGestureRecognizerDele } let tempTopInset: CGFloat if self.currentItemNode.startedScrollingAtUpperBound { - if let storySubscriptions = self.controller?.storySubscriptions, !storySubscriptions.items.isEmpty { + if let storySubscriptions = self.controller?.orderedStorySubscriptions, !storySubscriptions.items.isEmpty { tempTopInset = ChatListNavigationBar.storiesScrollHeight } else { tempTopInset = 0.0 @@ -1796,7 +1796,7 @@ final class ChatListControllerNode: ASDisplayNode, UIGestureRecognizerDelegate { return false } - if let storySubscriptions = controller.storySubscriptions, !storySubscriptions.items.isEmpty { + if let storySubscriptions = controller.orderedStorySubscriptions, !storySubscriptions.items.isEmpty { if let navigationBarComponentView = self.navigationBarView.view as? ChatListNavigationBar.View { if navigationBarComponentView.storiesUnlocked { return true @@ -1914,8 +1914,8 @@ final class ChatListControllerNode: ASDisplayNode, UIGestureRecognizerDelegate { } } - private func updateNavigationBar(layout: ContainerViewLayout, transition: ContainedViewLayoutTransition) -> (navigationHeight: CGFloat, storiesInset: CGFloat) { - let headerContent = self.controller?.updateHeaderContent(layout: layout, transition: transition) + private func updateNavigationBar(layout: ContainerViewLayout, deferScrollApplication: Bool, transition: Transition) -> (navigationHeight: CGFloat, storiesInset: CGFloat) { + let headerContent = self.controller?.updateHeaderContent(layout: layout) var tabsNode: ASDisplayNode? var tabsNodeIsSearch = false @@ -1928,7 +1928,7 @@ final class ChatListControllerNode: ASDisplayNode, UIGestureRecognizerDelegate { } let navigationBarSize = self.navigationBarView.update( - transition: Transition(transition), + transition: transition, component: AnyComponent(ChatListNavigationBar( context: self.context, theme: self.presentationData.theme, @@ -1939,7 +1939,7 @@ final class ChatListControllerNode: ASDisplayNode, UIGestureRecognizerDelegate { primaryContent: headerContent?.primaryContent, secondaryContent: headerContent?.secondaryContent, secondaryTransition: self.inlineStackContainerTransitionFraction, - storySubscriptions: self.controller?.storySubscriptions, + storySubscriptions: self.controller?.orderedStorySubscriptions, storiesIncludeHidden: false, uploadProgress: self.controller?.storyUploadProgress, tabsNode: tabsNode, @@ -1970,18 +1970,26 @@ final class ChatListControllerNode: ASDisplayNode, UIGestureRecognizerDelegate { return } controller.openStatusSetup(sourceView: sourceView) + }, + allowAutomaticOrder: { [weak self] in + guard let self, let controller = self.controller else { + return + } + controller.allowAutomaticOrder() } )), environment: {}, containerSize: layout.size ) if let navigationBarComponentView = self.navigationBarView.view as? ChatListNavigationBar.View { - navigationBarComponentView.deferScrollApplication = true + if deferScrollApplication { + navigationBarComponentView.deferScrollApplication = true + } if navigationBarComponentView.superview == nil { self.view.addSubview(navigationBarComponentView) } - transition.updateFrame(view: navigationBarComponentView, frame: CGRect(origin: CGPoint(), size: navigationBarSize)) + transition.setFrame(view: navigationBarComponentView, frame: CGRect(origin: CGPoint(), size: navigationBarSize)) return (navigationBarSize.height, 0.0) } else { @@ -2030,15 +2038,18 @@ final class ChatListControllerNode: ASDisplayNode, UIGestureRecognizerDelegate { } if let navigationBarComponentView = self.navigationBarView.view as? ChatListNavigationBar.View { - navigationBarComponentView.applyScroll(offset: offset, allowAvatarsExpansion: allowAvatarsExpansion, forceUpdate: false, transition: Transition(transition).withUserData(ChatListNavigationBar.AnimationHint(disableStoriesAnimations: self.tempDisableStoriesAnimations))) + navigationBarComponentView.applyScroll(offset: offset, allowAvatarsExpansion: allowAvatarsExpansion, forceUpdate: false, transition: Transition(transition).withUserData(ChatListNavigationBar.AnimationHint( + disableStoriesAnimations: self.tempDisableStoriesAnimations, + crossfadeStoryPeers: false + ))) } } - func requestNavigationBarLayout(transition: ContainedViewLayoutTransition) { + func requestNavigationBarLayout(transition: Transition) { guard let (layout, _, _, _, _) = self.containerLayout else { return } - let _ = self.updateNavigationBar(layout: layout, transition: transition) + let _ = self.updateNavigationBar(layout: layout, deferScrollApplication: false, transition: transition) } func scrollToStories(animated: Bool) { @@ -2046,7 +2057,7 @@ final class ChatListControllerNode: ASDisplayNode, UIGestureRecognizerDelegate { return } - if let storySubscriptions = self.controller?.storySubscriptions, !storySubscriptions.items.isEmpty { + if let storySubscriptions = self.controller?.orderedStorySubscriptions, !storySubscriptions.items.isEmpty { self.tempAllowAvatarExpansion = true self.tempDisableStoriesAnimations = !animated self.tempNavigationScrollingTransition = animated ? .animated(duration: 0.3, curve: .spring) : .immediate @@ -2055,12 +2066,6 @@ final class ChatListControllerNode: ASDisplayNode, UIGestureRecognizerDelegate { self.tempDisableStoriesAnimations = false tempNavigationScrollingTransition = nil } - - /*self.mainContainerNode.scrollToTop(animated: false) - self.mainContainerNode.ignoreStoryUnlockedScrolling = true - self.controller?.requestLayout(transition: .immediate) - self.mainContainerNode.scrollToTop(animated: false) - self.mainContainerNode.ignoreStoryUnlockedScrolling = false*/ } func containerLayoutUpdated(_ layout: ContainerViewLayout, navigationBarHeight: CGFloat, visualNavigationHeight: CGFloat, cleanNavigationBarHeight: CGFloat, storiesInset: CGFloat, transition: ContainedViewLayoutTransition) { @@ -2069,7 +2074,7 @@ final class ChatListControllerNode: ASDisplayNode, UIGestureRecognizerDelegate { var cleanNavigationBarHeight = cleanNavigationBarHeight var storiesInset = storiesInset - let navigationBarLayout = self.updateNavigationBar(layout: layout, transition: transition) + let navigationBarLayout = self.updateNavigationBar(layout: layout, deferScrollApplication: true, transition: Transition(transition)) self.mainContainerNode.initialScrollingOffset = ChatListNavigationBar.searchScrollHeight + navigationBarLayout.storiesInset navigationBarHeight = navigationBarLayout.navigationHeight @@ -2350,7 +2355,7 @@ final class ChatListControllerNode: ASDisplayNode, UIGestureRecognizerDelegate { } private func shouldStopScrolling(listView: ListView, velocity: CGFloat, isPrimary: Bool) -> Bool { - if abs(velocity) > 200.0 { + if abs(velocity) > 10.0 { return false } diff --git a/submodules/ContactListUI/Sources/ContactsControllerNode.swift b/submodules/ContactListUI/Sources/ContactsControllerNode.swift index e8887f722b..fd1819c371 100644 --- a/submodules/ContactListUI/Sources/ContactsControllerNode.swift +++ b/submodules/ContactListUI/Sources/ContactsControllerNode.swift @@ -451,6 +451,8 @@ final class ContactsControllerNode: ASDisplayNode, UIGestureRecognizerDelegate { self.contactListNode.activateSearch?() }, openStatusSetup: { _ in + }, + allowAutomaticOrder: { } )), environment: {}, diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Messages/Stories.swift b/submodules/TelegramCore/Sources/TelegramEngine/Messages/Stories.swift index ecb9b0ef22..b56e19912e 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Messages/Stories.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Messages/Stories.swift @@ -475,6 +475,9 @@ public final class EngineStorySubscriptions: Equatable { } public static func ==(lhs: Item, rhs: Item) -> Bool { + if lhs === rhs { + return true + } if lhs.peer != rhs.peer { return false } @@ -505,6 +508,9 @@ public final class EngineStorySubscriptions: Equatable { } public static func ==(lhs: EngineStorySubscriptions, rhs: EngineStorySubscriptions) -> Bool { + if lhs === rhs { + return true + } if lhs.accountItem != rhs.accountItem { return false } @@ -1065,7 +1071,7 @@ func _internal_markStoryAsSeen(account: Account, peerId: PeerId, id: Int32, asPi account.stateManager.injectStoryUpdates(updates: [.read(peerId: peerId, maxId: id)]) - #if DEBUG && false + #if DEBUG && true if "".isEmpty { return .complete() } diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Messages/TelegramEngineMessages.swift b/submodules/TelegramCore/Sources/TelegramEngine/Messages/TelegramEngineMessages.swift index 2546cf37f7..b23725faa9 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Messages/TelegramEngineMessages.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Messages/TelegramEngineMessages.swift @@ -828,12 +828,9 @@ public extension TelegramEngine { return self.account.postbox.combinedView(keys: additionalDataKeys) |> map { views -> [EngineMediaResource.Id: StoryPreloadInfo] in let _ = accountPeer - let _ = storySubscriptionsView let _ = storiesStateView - var nextPriority: Int = 0 - - var resultResources: [EngineMediaResource.Id: StoryPreloadInfo] = [:] + var sortedItems: [(peer: Peer, item: Stories.Item)] = [] for peerId in storySubscriptionsView.peerIds { guard let peerView = views.views[PostboxViewKey.basicPeer(peerId)] as? BasicPeerView else { @@ -858,36 +855,51 @@ public extension TelegramEngine { } } - if let peerReference = PeerReference(peer) { - if let nextItem = nextItem, case let .item(item) = nextItem, let media = item.media { - if let image = media as? TelegramMediaImage, let resource = image.representations.last?.resource { - let resource = MediaResourceReference.media(media: .story(peer: peerReference, id: item.id, media: media), resource: resource) - resultResources[EngineMediaResource.Id(resource.resource.id)] = StoryPreloadInfo( - resource: resource, - size: nil, - priority: .top(position: nextPriority) - ) - nextPriority += 1 - } else if let file = media as? TelegramMediaFile { - if let preview = file.previewRepresentations.last { - let resource = MediaResourceReference.media(media: .story(peer: peerReference, id: item.id, media: file), resource: preview.resource) - resultResources[EngineMediaResource.Id(resource.resource.id)] = StoryPreloadInfo( - resource: resource, - size: nil, - priority: .top(position: nextPriority) - ) - nextPriority += 1 - } - - let resource = MediaResourceReference.media(media: .story(peer: peerReference, id: item.id, media: file), resource: file.resource) - resultResources[EngineMediaResource.Id(resource.resource.id)] = StoryPreloadInfo( - resource: resource, - size: file.preloadSize, - priority: .top(position: nextPriority) - ) - nextPriority += 1 - } + if let nextItem = nextItem, case let .item(item) = nextItem { + sortedItems.append((peer, item)) + } + } + + sortedItems.sort(by: { lhs, rhs in + return lhs.item.timestamp > rhs.item.timestamp + }) + + var nextPriority: Int = 0 + var resultResources: [EngineMediaResource.Id: StoryPreloadInfo] = [:] + + for itemAndPeer in sortedItems.prefix(10) { + guard let peerReference = PeerReference(itemAndPeer.peer) else { + continue + } + guard let media = itemAndPeer.item.media else { + continue + } + if let image = media as? TelegramMediaImage, let resource = image.representations.last?.resource { + let resource = MediaResourceReference.media(media: .story(peer: peerReference, id: itemAndPeer.item.id, media: media), resource: resource) + resultResources[EngineMediaResource.Id(resource.resource.id)] = StoryPreloadInfo( + resource: resource, + size: nil, + priority: .top(position: nextPriority) + ) + nextPriority += 1 + } else if let file = media as? TelegramMediaFile { + if let preview = file.previewRepresentations.last { + let resource = MediaResourceReference.media(media: .story(peer: peerReference, id: itemAndPeer.item.id, media: file), resource: preview.resource) + resultResources[EngineMediaResource.Id(resource.resource.id)] = StoryPreloadInfo( + resource: resource, + size: nil, + priority: .top(position: nextPriority) + ) + nextPriority += 1 } + + let resource = MediaResourceReference.media(media: .story(peer: peerReference, id: itemAndPeer.item.id, media: file), resource: file.resource) + resultResources[EngineMediaResource.Id(resource.resource.id)] = StoryPreloadInfo( + resource: resource, + size: file.preloadSize, + priority: .top(position: nextPriority) + ) + nextPriority += 1 } } diff --git a/submodules/TelegramUI/Components/ChatListHeaderComponent/Sources/ChatListNavigationBar.swift b/submodules/TelegramUI/Components/ChatListHeaderComponent/Sources/ChatListNavigationBar.swift index 5019cf5fc3..d5d24278f7 100644 --- a/submodules/TelegramUI/Components/ChatListHeaderComponent/Sources/ChatListNavigationBar.swift +++ b/submodules/TelegramUI/Components/ChatListHeaderComponent/Sources/ChatListNavigationBar.swift @@ -13,9 +13,11 @@ import StoryPeerListComponent public final class ChatListNavigationBar: Component { public final class AnimationHint { let disableStoriesAnimations: Bool + let crossfadeStoryPeers: Bool - public init(disableStoriesAnimations: Bool) { + public init(disableStoriesAnimations: Bool, crossfadeStoryPeers: Bool) { self.disableStoriesAnimations = disableStoriesAnimations + self.crossfadeStoryPeers = crossfadeStoryPeers } } @@ -37,6 +39,7 @@ public final class ChatListNavigationBar: Component { public let accessoryPanelContainerHeight: CGFloat public let activateSearch: (NavigationBarSearchContentNode) -> Void public let openStatusSetup: (UIView) -> Void + public let allowAutomaticOrder: () -> Void public init( context: AccountContext, @@ -56,7 +59,8 @@ public final class ChatListNavigationBar: Component { accessoryPanelContainer: ASDisplayNode?, accessoryPanelContainerHeight: CGFloat, activateSearch: @escaping (NavigationBarSearchContentNode) -> Void, - openStatusSetup: @escaping (UIView) -> Void + openStatusSetup: @escaping (UIView) -> Void, + allowAutomaticOrder: @escaping () -> Void ) { self.context = context self.theme = theme @@ -76,6 +80,7 @@ public final class ChatListNavigationBar: Component { self.accessoryPanelContainerHeight = accessoryPanelContainerHeight self.activateSearch = activateSearch self.openStatusSetup = openStatusSetup + self.allowAutomaticOrder = allowAutomaticOrder } public static func ==(lhs: ChatListNavigationBar, rhs: ChatListNavigationBar) -> Bool { @@ -363,6 +368,9 @@ public final class ChatListNavigationBar: Component { } } } + if self.storiesUnlocked != storiesUnlocked, !storiesUnlocked { + component.allowAutomaticOrder() + } self.storiesUnlocked = storiesUnlocked let headerComponent = ChatListHeaderComponent( @@ -536,7 +544,8 @@ public final class ChatListNavigationBar: Component { accessoryPanelContainer: component.accessoryPanelContainer, accessoryPanelContainerHeight: component.accessoryPanelContainerHeight, activateSearch: component.activateSearch, - openStatusSetup: component.openStatusSetup + openStatusSetup: component.openStatusSetup, + allowAutomaticOrder: component.allowAutomaticOrder ) if let currentLayout = self.currentLayout, let headerComponent = self.currentHeaderComponent { let headerComponent = ChatListHeaderComponent( @@ -572,10 +581,14 @@ public final class ChatListNavigationBar: Component { let themeUpdated = self.component?.theme !== component.theme var uploadProgressUpdated = false + var storySubscriptionsUpdated = false if let previousComponent = self.component { if previousComponent.uploadProgress != component.uploadProgress { uploadProgressUpdated = true } + if previousComponent.storySubscriptions != component.storySubscriptions { + storySubscriptionsUpdated = true + } } self.component = component @@ -614,7 +627,7 @@ public final class ChatListNavigationBar: Component { self.hasDeferredScrollOffset = true - if uploadProgressUpdated { + if uploadProgressUpdated || storySubscriptionsUpdated { if let rawScrollOffset = self.rawScrollOffset { self.applyScroll(offset: rawScrollOffset, allowAvatarsExpansion: self.currentAllowAvatarsExpansion, forceUpdate: true, transition: transition) } diff --git a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryContentCaptionComponent.swift b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryContentCaptionComponent.swift index 32194ca7ad..ea0aefb6bd 100644 --- a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryContentCaptionComponent.swift +++ b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryContentCaptionComponent.swift @@ -397,6 +397,8 @@ final class StoryContentCaptionComponent: Component { } textNode.textNode.view.addGestureRecognizer(recognizer) } + + textNode.visibilityRect = CGRect(origin: CGPoint(), size: CGSize(width: 100000.0, height: 100000.0)) } textNode.textNode.frame = CGRect(origin: CGPoint(x: sideInset, y: availableSize.height - visibleTextHeight - verticalInset), size: textLayout.0.size) diff --git a/submodules/TelegramUI/Components/Stories/StoryContentComponent/Sources/StoryChatContent.swift b/submodules/TelegramUI/Components/Stories/StoryContentComponent/Sources/StoryChatContent.swift index ea418bc009..165db2a6a8 100644 --- a/submodules/TelegramUI/Components/Stories/StoryContentComponent/Sources/StoryChatContent.swift +++ b/submodules/TelegramUI/Components/Stories/StoryContentComponent/Sources/StoryChatContent.swift @@ -403,13 +403,15 @@ public final class StoryContentContextImpl: StoryContentContext { context: AccountContext, isHidden: Bool, focusedPeerId: EnginePeer.Id?, - singlePeer: Bool + singlePeer: Bool, + fixedOrder: [EnginePeer.Id] = [] ) { self.context = context self.isHidden = isHidden if let focusedPeerId { self.focusedItem = (focusedPeerId, nil) } + self.fixedSubscriptionOrder = fixedOrder if singlePeer { guard let focusedPeerId else {