Make has(feed) a Container protocol method.

This commit is contained in:
Brent Simmons 2019-08-21 21:05:47 -07:00
parent edd9b1cc91
commit fe2d329301
3 changed files with 10 additions and 5 deletions

View File

@ -615,10 +615,6 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
} }
} }
public func has(_ feed: Feed) -> Bool {
return flattenedFeeds().contains(feed)
}
// MARK: - Container // MARK: - Container
public func flattenedFeeds() -> Set<Feed> { public func flattenedFeeds() -> Set<Feed> {
@ -653,6 +649,10 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
postChildrenDidChangeNotification() postChildrenDidChangeNotification()
} }
public func has(_ feed: Feed) -> Bool {
return flattenedFeeds().contains(feed)
}
// MARK: - Debug // MARK: - Debug
public func debugDropConditionalGetInfo() { public func debugDropConditionalGetInfo() {

View File

@ -33,6 +33,7 @@ public protocol Container: class {
//Recursive  checks subfolders //Recursive  checks subfolders
func flattenedFeeds() -> Set<Feed> func flattenedFeeds() -> Set<Feed>
func has(_ feed: Feed) -> Bool
func hasFeed(with feedID: String) -> Bool func hasFeed(with feedID: String) -> Bool
func hasFeed(withURL url: String) -> Bool func hasFeed(withURL url: String) -> Bool
func existingFeed(with feedID: String) -> Feed? func existingFeed(with feedID: String) -> Feed?

View File

@ -102,6 +102,10 @@ public final class Folder: DisplayNameProvider, Renamable, Container, UnreadCoun
postChildrenDidChangeNotification() postChildrenDidChangeNotification()
} }
public func has(_ feed: Feed) -> Bool {
return flattenedFeeds().contains(feed)
}
// MARK: - Hashable // MARK: - Hashable
public func hash(into hasher: inout Hasher) { public func hash(into hasher: inout Hasher) {