Disable Reader View

This commit:
- adds a `isFeedProvider: Bool` property to `WebFeed`
- if `isFeedProvider` is `true`, the article extractor is disabled on the inspector, hidden from the context menu, and the toolbar button is disabled. Additionally, if `isFeedProvider` is `true`, `isArticleExtractorAlwaysOn` returns `false` and cannot be set to `true`.
This commit is contained in:
Stuart Breckenridge
2021-04-09 07:47:14 +08:00
parent aae5be9cd8
commit 4e517a6db4
4 changed files with 49 additions and 7 deletions

View File

@@ -1061,6 +1061,7 @@ private extension MainWindowController {
return false
}
if #available(macOS 11.0, *) {
guard let toolbarItem = item as? NSToolbarItem, let toolbarButton = toolbarItem.view as? ArticleExtractorButton else {
@@ -1069,6 +1070,15 @@ private extension MainWindowController {
}
return currentLink != nil
}
if let webfeed = currentTimelineViewController?.selectedArticles.first?.webFeed {
if webfeed.isFeedProvider {
toolbarButton.isEnabled = false
return false
} else {
toolbarButton.isEnabled = true
}
}
guard let state = articleExtractor?.state else {
toolbarButton.buttonState = .off
@@ -1093,6 +1103,15 @@ private extension MainWindowController {
return currentLink != nil
}
if let webfeed = currentTimelineViewController?.selectedArticles.first?.webFeed {
if webfeed.isFeedProvider {
toolbarButton.isEnabled = false
return false
} else {
toolbarButton.isEnabled = true
}
}
toolbarButton.state = isShowingExtractedArticle ? .on : .off
guard let state = articleExtractor?.state else {