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
ca8555c070
commit
ff9157fef4
@ -265,6 +265,7 @@
|
||||
|
||||
"PUSH_STORY_NOTEXT" = "%1$@|posted a story";
|
||||
"PUSH_MESSAGE_STORY" = "%1$@|shared a story with you";
|
||||
"PUSH_MESSAGE_STORY_MENTION" = "%1$@|mentioned you in a story";
|
||||
"PUSH_CHANNEL_MESSAGE_STORY" = "%1$@|shared a story";
|
||||
"PUSH_CHAT_MESSAGE_STORY" = "%2$@|%1$@ shared a story to the group";
|
||||
|
||||
|
@ -629,7 +629,8 @@ public extension TelegramEngine {
|
||||
}).start()
|
||||
}
|
||||
|
||||
public func storySubscriptions(isHidden: Bool) -> Signal<EngineStorySubscriptions, NoError> {
|
||||
public func storySubscriptions(isHidden: Bool, tempKeepNewlyArchived: Bool = false) -> Signal<EngineStorySubscriptions, NoError> {
|
||||
return `deferred` { () -> Signal<EngineStorySubscriptions, NoError> in
|
||||
let debugTimerSignal: Signal<Bool, NoError>
|
||||
#if DEBUG && false
|
||||
debugTimerSignal = Signal<Bool, NoError>.single(true)
|
||||
@ -646,6 +647,8 @@ public extension TelegramEngine {
|
||||
debugTimerSignal = .single(true)
|
||||
#endif
|
||||
|
||||
let previousIdList = Atomic<Set<PeerId>>(value: Set())
|
||||
|
||||
let subscriptionsKey: PostboxStorySubscriptionsKey = isHidden ? .hidden : .filtered
|
||||
|
||||
let basicPeerKey = PostboxViewKey.basicPeer(self.account.peerId)
|
||||
@ -678,6 +681,19 @@ public extension TelegramEngine {
|
||||
subscriptionPeerIds.removeAll()
|
||||
}
|
||||
|
||||
if tempKeepNewlyArchived {
|
||||
let updatedList = previousIdList.modify { list in
|
||||
var list = list
|
||||
list.formUnion(subscriptionPeerIds)
|
||||
return list
|
||||
}
|
||||
for id in updatedList {
|
||||
if !subscriptionPeerIds.contains(id) {
|
||||
subscriptionPeerIds.append(id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
additionalDataKeys.append(contentsOf: subscriptionPeerIds.map { peerId -> PostboxViewKey in
|
||||
return PostboxViewKey.storyItems(peerId: peerId)
|
||||
})
|
||||
@ -847,6 +863,7 @@ public extension TelegramEngine {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func preloadStorySubscriptions(isHidden: Bool) -> Signal<[EngineMedia.Id: StoryPreloadInfo], NoError> {
|
||||
let basicPeerKey = PostboxViewKey.basicPeer(self.account.peerId)
|
||||
|
@ -553,7 +553,7 @@ public final class StoryContentContextImpl: StoryContentContext {
|
||||
self.updatePeerContexts()
|
||||
})
|
||||
} else {
|
||||
self.storySubscriptionsDisposable = (context.engine.messages.storySubscriptions(isHidden: isHidden)
|
||||
self.storySubscriptionsDisposable = (context.engine.messages.storySubscriptions(isHidden: isHidden, tempKeepNewlyArchived: true)
|
||||
|> deliverOnMainQueue).start(next: { [weak self] storySubscriptions in
|
||||
guard let self else {
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user