mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Stories
This commit is contained in:
@@ -475,6 +475,7 @@ public final class EngineStorySubscriptions: Equatable {
|
||||
public let peer: EnginePeer
|
||||
public let hasUnseen: Bool
|
||||
public let hasUnseenCloseFriends: Bool
|
||||
public let hasPending: Bool
|
||||
public let storyCount: Int
|
||||
public let unseenCount: Int
|
||||
public let lastTimestamp: Int32
|
||||
@@ -483,6 +484,7 @@ public final class EngineStorySubscriptions: Equatable {
|
||||
peer: EnginePeer,
|
||||
hasUnseen: Bool,
|
||||
hasUnseenCloseFriends: Bool,
|
||||
hasPending: Bool,
|
||||
storyCount: Int,
|
||||
unseenCount: Int,
|
||||
lastTimestamp: Int32
|
||||
@@ -490,6 +492,7 @@ public final class EngineStorySubscriptions: Equatable {
|
||||
self.peer = peer
|
||||
self.hasUnseen = hasUnseen
|
||||
self.hasUnseenCloseFriends = hasUnseenCloseFriends
|
||||
self.hasPending = hasPending
|
||||
self.storyCount = storyCount
|
||||
self.unseenCount = unseenCount
|
||||
self.lastTimestamp = lastTimestamp
|
||||
|
||||
@@ -645,6 +645,7 @@ public extension TelegramEngine {
|
||||
|
||||
additionalDataKeys.append(PostboxViewKey.storyItems(peerId: self.account.peerId))
|
||||
additionalDataKeys.append(PostboxViewKey.storiesState(key: .peer(self.account.peerId)))
|
||||
additionalDataKeys.append(PostboxViewKey.storiesState(key: .local))
|
||||
|
||||
var subscriptionPeerIds = storySubscriptionsView.peerIds.filter { $0 != self.account.peerId }
|
||||
if !debugTimer {
|
||||
@@ -680,6 +681,7 @@ public extension TelegramEngine {
|
||||
peer: EnginePeer(accountPeer),
|
||||
hasUnseen: false,
|
||||
hasUnseenCloseFriends: false,
|
||||
hasPending: false,
|
||||
storyCount: 0,
|
||||
unseenCount: 0,
|
||||
lastTimestamp: 0
|
||||
@@ -696,14 +698,17 @@ public extension TelegramEngine {
|
||||
var hasUnseen = false
|
||||
var hasUnseenCloseFriends = false
|
||||
var unseenCount = 0
|
||||
var hasPending = false
|
||||
if let peerState = peerState {
|
||||
hasUnseen = peerState.maxReadId < lastEntry.id
|
||||
|
||||
for item in itemsView.items {
|
||||
if item.id > peerState.maxReadId {
|
||||
unseenCount += 1
|
||||
|
||||
if case let .item(item) = item.value.get(Stories.StoredItem.self) {
|
||||
}
|
||||
|
||||
if case let .item(item) = item.value.get(Stories.StoredItem.self) {
|
||||
if item.id > peerState.maxReadId {
|
||||
if item.isCloseFriends {
|
||||
hasUnseenCloseFriends = true
|
||||
}
|
||||
@@ -712,10 +717,17 @@ public extension TelegramEngine {
|
||||
}
|
||||
}
|
||||
|
||||
if let view = views.views[PostboxViewKey.storiesState(key: .local)] as? StoryStatesView, let localState = view.value?.get(Stories.LocalState.self) {
|
||||
if !localState.items.isEmpty {
|
||||
hasPending = true
|
||||
}
|
||||
}
|
||||
|
||||
let item = EngineStorySubscriptions.Item(
|
||||
peer: EnginePeer(accountPeer),
|
||||
hasUnseen: hasUnseen,
|
||||
hasUnseenCloseFriends: hasUnseenCloseFriends,
|
||||
hasPending: hasPending,
|
||||
storyCount: itemsView.items.count,
|
||||
unseenCount: unseenCount,
|
||||
lastTimestamp: lastEntry.timestamp
|
||||
@@ -766,6 +778,7 @@ public extension TelegramEngine {
|
||||
peer: EnginePeer(peer),
|
||||
hasUnseen: hasUnseen,
|
||||
hasUnseenCloseFriends: hasUnseenCloseFriends,
|
||||
hasPending: false,
|
||||
storyCount: itemsView.items.count,
|
||||
unseenCount: unseenCount,
|
||||
lastTimestamp: lastEntry.timestamp
|
||||
|
||||
Reference in New Issue
Block a user