diff --git a/Frameworks/Account/Account.swift b/Frameworks/Account/Account.swift index 74c165694..0eaa2e854 100644 --- a/Frameworks/Account/Account.swift +++ b/Frameworks/Account/Account.swift @@ -662,7 +662,7 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container, database.ensureStatuses(articleIDs, statusKey, flag) } } - + // MARK: - Container public func flattenedFeeds() -> Set { diff --git a/Frameworks/Account/Container.swift b/Frameworks/Account/Container.swift index c37cf2bfe..610ee69b8 100644 --- a/Frameworks/Account/Container.swift +++ b/Frameworks/Account/Container.swift @@ -33,6 +33,7 @@ public protocol Container: class { //Recursive — checks subfolders func flattenedFeeds() -> Set + func has(_ feed: Feed) -> Bool func hasFeed(with feedID: String) -> Bool func hasFeed(withURL url: String) -> Bool func existingFeed(with feedID: String) -> Feed? @@ -94,6 +95,10 @@ public extension Container { return existingFeed(withURL: url) != nil } + func has(_ feed: Feed) -> Bool { + return flattenedFeeds().contains(feed) + } + func existingFeed(with feedID: String) -> Feed? { for feed in flattenedFeeds() { if feed.feedID == feedID { diff --git a/Frameworks/Account/Folder.swift b/Frameworks/Account/Folder.swift index 6d164a28c..bdfe13118 100644 --- a/Frameworks/Account/Folder.swift +++ b/Frameworks/Account/Folder.swift @@ -101,7 +101,7 @@ public final class Folder: DisplayNameProvider, Renamable, Container, UnreadCoun topLevelFeeds.remove(feed) postChildrenDidChangeNotification() } - + // MARK: - Hashable public func hash(into hasher: inout Hasher) { diff --git a/Mac/MainWindow/Timeline/TimelineViewController.swift b/Mac/MainWindow/Timeline/TimelineViewController.swift index 26750287d..913d7c0b2 100644 --- a/Mac/MainWindow/Timeline/TimelineViewController.swift +++ b/Mac/MainWindow/Timeline/TimelineViewController.swift @@ -67,6 +67,9 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr var articles = ArticleArray() { didSet { + defer { + updateUnreadCount() + } if articles == oldValue { return } @@ -76,13 +79,11 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr // Just reload visible cells in this case: don’t call reloadData. articleRowMap = [String: Int]() reloadVisibleCells() - updateUnreadCount() return } updateShowAvatars() articleRowMap = [String: Int]() tableView.reloadData() - updateUnreadCount() } } @@ -168,6 +169,7 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr NotificationCenter.default.addObserver(self, selector: #selector(accountDidDownloadArticles(_:)), name: .AccountDidDownloadArticles, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(accountStateDidChange(_:)), name: .AccountStateDidChange, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(accountsDidChange(_:)), name: .AccountsDidChange, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(containerChildrenDidChange(_:)), name: .ChildrenDidChange, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(userDefaultsDidChange(_:)), name: UserDefaults.didChangeNotification, object: nil) DistributedNotificationCenter.default.addObserver(self, selector: #selector(appleInterfaceThemeChanged), name: .AppleInterfaceThemeChangedNotification, object: nil) @@ -540,6 +542,12 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr } } + @objc func containerChildrenDidChange(_ note: Notification) { + if representedObjectsContainsAnyPseudoFeed() || representedObjectsContainAnyFolder() { + fetchAndReplaceArticlesAsync() + } + } + @objc func userDefaultsDidChange(_ note: Notification) { self.fontSize = AppDefaults.timelineFontSize @@ -982,7 +990,6 @@ private extension TimelineViewController { } func replaceArticles(with unsortedArticles: Set
) { - let sortedArticles = Array(unsortedArticles).sortedByDate(sortDirection) if articles != sortedArticles { articles = sortedArticles @@ -1062,7 +1069,11 @@ private extension TimelineViewController { func representedObjectsContainsTodayFeed() -> Bool { return representedObjects?.contains(where: { $0 === SmartFeedsController.shared.todayFeed }) ?? false } - + + func representedObjectsContainAnyFolder() -> Bool { + return representedObjects?.contains(where: { $0 is Folder }) ?? false + } + func representedObjectsContainsAnyFeed(_ feeds: Set) -> Bool { // Return true if there’s a match or if a folder contains (recursively) one of feeds diff --git a/Mac/Resources/Info.plist b/Mac/Resources/Info.plist index 6f5769077..230c42b35 100644 --- a/Mac/Resources/Info.plist +++ b/Mac/Resources/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 5.0b4 + 5.0b5 CFBundleURLTypes @@ -33,7 +33,7 @@ CFBundleVersion - 2606 + 2607 LSApplicationCategoryType public.app-category.news LSMinimumSystemVersion diff --git a/Technotes/HelpBook.opml b/Technotes/HelpBook.opml deleted file mode 100644 index b26f00e3a..000000000 --- a/Technotes/HelpBook.opml +++ /dev/null @@ -1,51 +0,0 @@ - - - - HelpBook - Sun, 17 Feb 2019 22:26:12 GMT - 24,27 - 10 - 207 - 46 - 983 - 910 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Technotes/HelpBook/5.0/en/README.md b/Technotes/HelpBook/5.0/en/README.md deleted file mode 100644 index 25c2297c8..000000000 --- a/Technotes/HelpBook/5.0/en/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# About the NetNewsWire 5 Help Book - -The Help book goes here. Text files go at the top level, and images go in the images directory. - -Text files are markdown files. A script ([wildcat](https://github.com/brentsimmons/wildcat)) will turn this into a web site that will appear at [https://ranchero.com/netnewswire/help/mac/5.0/en/](https://ranchero.com/netnewswire/help/mac/5.0/en/). (The /en/ directory because we hope to have localized versions.) - -If you’d like to write or edit the Help book, or help with screenshots, please bring it up on the [NetNewsWire Slack](https://netnewswire.slack.com/join/shared_invite/enQtNjM4MDA1MjQzMDkzLTNlNjBhOWVhYzdhYjA4ZWFhMzQ1MTUxYjU0NTE5ZGY0YzYwZWJhNjYwNTNmNTg2NjIwYWY4YzhlYzk5NmU3ZTc) group. We’ll coordinate there. - -**NOTE:** It’s not a good idea to take screenshots yet! The UI is still subject to change. That won’t be true for too much longer, but it’s true for now. diff --git a/Technotes/HelpBook/5.0/en/images/websitediagram.png b/Technotes/HelpBook/5.0/en/images/websitediagram.png deleted file mode 100644 index 70496c1df..000000000 Binary files a/Technotes/HelpBook/5.0/en/images/websitediagram.png and /dev/null differ diff --git a/Technotes/HelpBook/5.0/en/index.markdown b/Technotes/HelpBook/5.0/en/index.markdown deleted file mode 100644 index 25a61e109..000000000 --- a/Technotes/HelpBook/5.0/en/index.markdown +++ /dev/null @@ -1,77 +0,0 @@ -@title NetNewsWire 5 Help - -## Getting Started - -[What is RSS? What are feeds?](what-is-rss.html) - - - -## Reading Feeds - -[How to go through your articles](reading-articles.html) - -[How to sort the timeline](sorting-the-timeline.html) - -Tour of the built-in smart feeds: Today, All Unread, Starred - -[Keyboard shortcuts](keyboard-shortcuts.html) - -Sharing to other apps, including MarsEdit and Micro.blog - - - -## Managing Feeds - -[How to add a feed](adding-feeds.html) - -[Installing and using the Safari Extension to add feeds](safari-extension.html) - -[How to delete feeds and folders](deleting-feeds-folders.html) - -How to add special Micro.blog feeds - -How to rename feeds and folders - -How to get and copy feed information - - - -## Accounts - -Accounts overview - -[About the On My Mac account](on-my-mac.html) - -[How to add a syncing account](syncing-accounts.html) - - - -## NetNewsWire Data - -[Where NetNewsWire data is stored](userdata-location.html) - -[How to import OPML](import-opml.html) - -[How to export OPML](export-opml.html) - - - -## The NetNewsWire Project - -[How to Update NetNewsWire](updating.html) - -[How to get NetNewsWire news](netnewswire-news.html) - -[NetNewsWire and your privacy](privacy.html) - -[How to contribute to NetNewsWire](contributing.html) - - - -## Other ideas? Add them here. - - - ---- - -Credits: The Help book was written by [Brent Simmons](https://inessential.com/), [Ryan Dotson](https://nostodnayr.net), your name here, etc. diff --git a/Technotes/HelpBook/5.0/en/what-is-rss.markdown b/Technotes/HelpBook/5.0/en/what-is-rss.markdown deleted file mode 100644 index 4dba0366c..000000000 --- a/Technotes/HelpBook/5.0/en/what-is-rss.markdown +++ /dev/null @@ -1,29 +0,0 @@ -@title What is RSS? What are feeds? - -# What is RSS? What are feeds? - -Lots of websites have news or updates of some kind. - -They also have a bunch of other things — a header at the top of the page, and maybe links and ads and widgets on the left or right (or both). And then some more stuff at the bottom of the page. - -Like this imaginary squished-down web page: - -Website diagram that shows the good part — where RSS comes from - -The good part is the part in the middle — that’s the part with the news. That’s the part that you read. That’s the part you’re interested in. - -And that’s what RSS is — it’s just that part, minus the rest of the stuff. - -#### Details - -That “good part” is actually made available as a *feed.* A feed is just a specially-formatted text file that readers like NetNewsWire can read. The files look weird — they kind of look like the source behind web pages, with angle brackets and everything. - -The important thing is: it’s NetNewsWire’s job to know how to read the feed. And it’s NetNewsWire’s job to show you what articles you haven’t read yet. - -By doing this — by running NetNewsWire — you can let NetNewsWire find out when there’s something new. You don’t have to go to the websites and check to see if there’s something new. You can save time, and not have to rely on your memory. - -#### Types of feeds - -People often talk or write about RSS — but sometimes they mention Atom, too. Atom does the same thing as RSS. Sometimes they mention the JSON Feed format, which does the same thing as RSS too. - -If you see RSS or Atom or JSON Feed, just know that NetNewsWire handles all these, no problem. \ No newline at end of file