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() {
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

View File

@ -1170,7 +1170,10 @@ func _internal_markStoryAsSeen(account: Account, peerId: PeerId, id: Int32, asPi
).postboxRepresentation)
}
#if DEBUG && true
#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*/
}
}
}

View File

@ -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