Stop skipping the Today feed when finding next unread and looping around

This commit is contained in:
Maurice Parker 2020-07-27 21:21:11 -05:00
parent ecefe59a5e
commit ff829c0e59
1 changed files with 4 additions and 8 deletions

View File

@ -271,23 +271,19 @@ private extension SidebarModel {
if let feedID = nextUnread(sidebarItems: sidebarItems, startingAt: startFeed) {
return feedID
} else {
if let firstFeed = sidebarItems.first?.children.first?.feed {
return nextUnread(sidebarItems: sidebarItems, startingAt: firstFeed)
return nextUnread(sidebarItems: sidebarItems, startingAt: nil)
}
}
return nil
}
@discardableResult
func nextUnread(sidebarItems: [SidebarItem], startingAt: Feed) -> FeedIdentifier? {
var foundStartFeed = false
func nextUnread(sidebarItems: [SidebarItem], startingAt: Feed?) -> FeedIdentifier? {
var foundStartFeed = startingAt == nil ? true : false
var nextSidebarItem: SidebarItem? = nil
for section in sidebarItems {
if nextSidebarItem == nil {
section.visit { sidebarItem in
if !foundStartFeed && sidebarItem.feed?.feedID == startingAt.feedID {
if !foundStartFeed && sidebarItem.feed?.feedID == startingAt?.feedID {
foundStartFeed = true
return false
}