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

@@ -152,9 +152,14 @@ public final class WebFeed: Feed, Renamable, Hashable {
public var isArticleExtractorAlwaysOn: Bool? {
get {
if isFeedProvider == true { return false } // not an option for FeedProviders
return metadata.isArticleExtractorAlwaysOn
}
set {
if isFeedProvider == true {
metadata.isArticleExtractorAlwaysOn = false
return
}
metadata.isArticleExtractorAlwaysOn = newValue
}
}
@@ -220,6 +225,16 @@ public final class WebFeed: Feed, Renamable, Hashable {
postUnreadCountDidChangeNotification()
}
}
// MARK: - Feed Provider
public var isFeedProvider: Bool {
get {
if FeedProviderManager.shared.best(for: URLComponents(url: URL(string: url)!, resolvingAgainstBaseURL: false)!) == nil {
return false
}
return true
}
}
var metadata: WebFeedMetadata