diff --git a/Multiplatform/Shared/SceneModel.swift b/Multiplatform/Shared/SceneModel.swift index d7db42236..a6b2fc57a 100644 --- a/Multiplatform/Shared/SceneModel.swift +++ b/Multiplatform/Shared/SceneModel.swift @@ -56,8 +56,8 @@ final class SceneModel: ObservableObject { /// Goes to the next unread item found in Sidebar and Timeline order, top to bottom func goToNextUnread() { if !timelineModel.goToNextUnread() { + timelineModel.isSelectNextUnread = true sidebarModel.goToNextUnread() - timelineModel.goToNextUnread() } } diff --git a/Multiplatform/Shared/Timeline/TimelineModel.swift b/Multiplatform/Shared/Timeline/TimelineModel.swift index e6c079fec..a5efdad4e 100644 --- a/Multiplatform/Shared/Timeline/TimelineModel.swift +++ b/Multiplatform/Shared/Timeline/TimelineModel.swift @@ -44,6 +44,9 @@ class TimelineModel: ObservableObject, UndoableCommandRunner { } } + // I don't like this flag and feel like it is a hack. Maybe there is a better way to do this using Combine. + var isSelectNextUnread = false + var undoManager: UndoManager? var undoableCommands = [UndoableCommand]() @@ -510,6 +513,12 @@ private extension TimelineModel { selectedArticleIDs = Set() selectedArticleID = nil + + if isSelectNextUnread { + goToNextUnread() + isSelectNextUnread = false + } + // TODO: Update unread counts and other item done in didSet on AppKit }