From fe2b81b47b5051dfc2850d5d9c97903b80567e32 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Sun, 19 Jul 2020 15:50:01 -0500 Subject: [PATCH] Put hack in to select next unread item. WIP --- Multiplatform/Shared/SceneModel.swift | 2 +- Multiplatform/Shared/Timeline/TimelineModel.swift | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) 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 }