Change Feed Provider interface to make it work better with refreshing WebFeeds.
This commit is contained in:
parent
eb02568409
commit
b3afee0252
|
@ -19,15 +19,15 @@ public enum FeedProviderAbility {
|
|||
public protocol FeedProvider {
|
||||
|
||||
/// Informs the caller of the ability for this feed provider to service the given URL
|
||||
func ability(_ url: URLComponents, forUsername: String?) -> FeedProviderAbility
|
||||
func ability(_ urlComponents: URLComponents, forUsername: String?) -> FeedProviderAbility
|
||||
|
||||
/// Provide the iconURL of the given URL
|
||||
func iconURL(_ url: URLComponents, completion: @escaping (Result<String, Error>) -> Void)
|
||||
func iconURL(_ urlComponents: URLComponents, completion: @escaping (Result<String, Error>) -> Void)
|
||||
|
||||
/// Construct a ParsedFeed that can be used to create and store a new Feed
|
||||
func provide(_ url: URLComponents, completion: @escaping (Result<ParsedFeed, Error>) -> Void)
|
||||
func provide(_ urlComponents: URLComponents, completion: @escaping (Result<ParsedFeed, Error>) -> Void)
|
||||
|
||||
/// Refresh all the article entries (ParsedItems)
|
||||
func refresh(_ url: URLComponents, completion: @escaping (Result<Set<ParsedItem>, Error>) -> Void)
|
||||
func refresh(_ webFeed: WebFeed, completion: @escaping (Result<Set<ParsedItem>, Error>) -> Void)
|
||||
|
||||
}
|
||||
|
|
|
@ -84,16 +84,16 @@ public struct TwitterFeedProvider: FeedProvider {
|
|||
return .available
|
||||
}
|
||||
|
||||
public func iconURL(_ url: URLComponents, completion: @escaping (Result<String, Error>) -> Void) {
|
||||
let screenName = extractScreenName(url)
|
||||
public func iconURL(_ urlComponents: URLComponents, completion: @escaping (Result<String, Error>) -> Void) {
|
||||
let screenName = extractScreenName(urlComponents)
|
||||
fetchIconURL(screenName: screenName, completion: completion)
|
||||
}
|
||||
|
||||
public func provide(_ url: URLComponents, completion: @escaping (Result<ParsedFeed, Error>) -> Void) {
|
||||
public func provide(_ urlComponents: URLComponents, completion: @escaping (Result<ParsedFeed, Error>) -> Void) {
|
||||
// TODO: Finish implementation
|
||||
}
|
||||
|
||||
public func refresh(_ url: URLComponents, completion: @escaping (Result<Set<ParsedItem>, Error>) -> Void) {
|
||||
public func refresh(_ webFeed: WebFeed, completion: @escaping (Result<Set<ParsedItem>, Error>) -> Void) {
|
||||
// TODO: Finish implementation
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue