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

View File

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

View File

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