Add already subscribed error to LocalAccountDelegate and updated iOS to work with latest Account API
This commit is contained in:
parent
fe70723eb4
commit
fd8a973084
|
@ -152,6 +152,11 @@ extension LocalAccountDelegate: FeedFinderDelegate {
|
|||
return
|
||||
}
|
||||
|
||||
if account.hasFeed(withURL: bestFeedSpecifier.urlString) {
|
||||
createFeedCompletion!(.failure(AccountError.createErrorAlreadySubscribed))
|
||||
return
|
||||
}
|
||||
|
||||
let feed = account.createFeed(with: nil, url: url.absoluteString, feedID: url.absoluteString, homePageURL: nil)
|
||||
InitialFeedDownloader.download(url) { [weak self] parsedFeed in
|
||||
if let parsedFeed = parsedFeed {
|
||||
|
|
|
@ -93,23 +93,20 @@ class AddFeedViewController: UITableViewController, AddContainerViewControllerCh
|
|||
account!.createFeed(url: url.absoluteString) { [weak self] result in
|
||||
|
||||
switch result {
|
||||
case .success(let createFeedResult):
|
||||
switch createFeedResult {
|
||||
case .created(let feed):
|
||||
self?.processFeed(feed, account: account!, folder: folder, url: url, title: title)
|
||||
case .multipleChoice(let feedChoices):
|
||||
print()
|
||||
self?.delegate?.processingDidCancel()
|
||||
case .alreadySubscribed:
|
||||
case .success(let feed):
|
||||
self?.processFeed(feed, account: account!, folder: folder, url: url, title: title)
|
||||
case .failure(let error):
|
||||
switch error {
|
||||
case AccountError.createErrorAlreadySubscribed:
|
||||
self?.showAlreadySubscribedError()
|
||||
self?.delegate?.processingDidCancel()
|
||||
case .notFound:
|
||||
case AccountError.createErrorNotFound:
|
||||
self?.showNoFeedsErrorMessage()
|
||||
self?.delegate?.processingDidCancel()
|
||||
default:
|
||||
self?.presentError(error)
|
||||
self?.delegate?.processingDidCancel()
|
||||
}
|
||||
case .failure(let error):
|
||||
self?.presentError(error)
|
||||
self?.delegate?.processingDidCancel()
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue