Restore fixed story order

This commit is contained in:
Ali 2023-07-17 18:53:28 +04:00
parent 5524498835
commit 36901229a9
3 changed files with 18 additions and 7 deletions

View File

@ -3663,10 +3663,23 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
if let componentView = self.chatListHeaderView(), let storyPeerListView = componentView.storyPeerListView() { if let componentView = self.chatListHeaderView(), let storyPeerListView = componentView.storyPeerListView() {
let _ = 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( StoryContainerScreen.openPeerStoriesCustom(
context: self.context, context: self.context,
peerId: peerId, peerId: peerId,
isHidden: self.location == .chatList(groupId: .archive), isHidden: self.location == .chatList(groupId: .archive),
initialOrder: initialOrder,
singlePeer: false, singlePeer: false,
parentController: self, parentController: self,
transitionIn: { [weak self] in transitionIn: { [weak self] in

View File

@ -1170,7 +1170,10 @@ func _internal_markStoryAsSeen(account: Account, peerId: PeerId, id: Int32, asPi
).postboxRepresentation) ).postboxRepresentation)
} }
#if DEBUG && true
#else
_internal_addSynchronizeViewStoriesOperation(peerId: peerId, storyId: id, transaction: transaction) _internal_addSynchronizeViewStoriesOperation(peerId: peerId, storyId: id, transaction: transaction)
#endif
return transaction.getPeer(peerId).flatMap(apiInputUser) 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)]) account.stateManager.injectStoryUpdates(updates: [.read(peerId: peerId, maxId: id)])
return .complete() return .complete()
/*return account.network.request(Api.functions.stories.readStories(userId: inputUser, maxId: id))
|> `catch` { _ -> Signal<[Int32], NoError> in
return .single([])
}
|> ignoreValues*/
} }
} }
} }

View File

@ -158,6 +158,7 @@ public extension StoryContainerScreen {
context: AccountContext, context: AccountContext,
peerId: EnginePeer.Id, peerId: EnginePeer.Id,
isHidden: Bool, isHidden: Bool,
initialOrder: [EnginePeer.Id] = [],
singlePeer: Bool, singlePeer: Bool,
parentController: ViewController, parentController: ViewController,
transitionIn: @escaping () -> StoryContainerScreen.TransitionIn?, transitionIn: @escaping () -> StoryContainerScreen.TransitionIn?,
@ -165,7 +166,7 @@ public extension StoryContainerScreen {
setFocusedItem: @escaping (Signal<StoryId?, NoError>) -> Void, setFocusedItem: @escaping (Signal<StoryId?, NoError>) -> Void,
setProgress: @escaping (Signal<Never, 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 let signal = storyContent.state
|> take(1) |> take(1)
|> mapToSignal { state -> Signal<StoryContentContextState, NoError> in |> mapToSignal { state -> Signal<StoryContentContextState, NoError> in