Fix unpinned story indices

This commit is contained in:
Ali 2023-07-28 00:08:01 +04:00
parent d5561c092a
commit 1cee5070f8

View File

@ -1169,7 +1169,7 @@ public final class PeerStoryListContentContextImpl: StoryContentContext {
if let current = self.focusedId {
if let index = state.items.firstIndex(where: { $0.id == current }) {
focusedIndex = index
} else if let index = state.items.firstIndex(where: { $0.id >= current }) {
} else if let index = state.items.firstIndex(where: { $0.id <= current }) {
focusedIndex = index
} else if !state.items.isEmpty {
focusedIndex = 0
@ -1179,7 +1179,7 @@ public final class PeerStoryListContentContextImpl: StoryContentContext {
} else if let initialId = initialId {
if let index = state.items.firstIndex(where: { $0.id == initialId }) {
focusedIndex = index
} else if let index = state.items.firstIndex(where: { $0.id >= initialId }) {
} else if let index = state.items.firstIndex(where: { $0.id <= initialId }) {
focusedIndex = index
} else {
focusedIndex = nil