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
|
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)
|
let feed = account.createFeed(with: nil, url: url.absoluteString, feedID: url.absoluteString, homePageURL: nil)
|
||||||
InitialFeedDownloader.download(url) { [weak self] parsedFeed in
|
InitialFeedDownloader.download(url) { [weak self] parsedFeed in
|
||||||
if let parsedFeed = parsedFeed {
|
if let parsedFeed = parsedFeed {
|
||||||
|
|
|
@ -93,24 +93,21 @@ class AddFeedViewController: UITableViewController, AddContainerViewControllerCh
|
||||||
account!.createFeed(url: url.absoluteString) { [weak self] result in
|
account!.createFeed(url: url.absoluteString) { [weak self] result in
|
||||||
|
|
||||||
switch result {
|
switch result {
|
||||||
case .success(let createFeedResult):
|
case .success(let feed):
|
||||||
switch createFeedResult {
|
|
||||||
case .created(let feed):
|
|
||||||
self?.processFeed(feed, account: account!, folder: folder, url: url, title: title)
|
self?.processFeed(feed, account: account!, folder: folder, url: url, title: title)
|
||||||
case .multipleChoice(let feedChoices):
|
case .failure(let error):
|
||||||
print()
|
switch error {
|
||||||
self?.delegate?.processingDidCancel()
|
case AccountError.createErrorAlreadySubscribed:
|
||||||
case .alreadySubscribed:
|
|
||||||
self?.showAlreadySubscribedError()
|
self?.showAlreadySubscribedError()
|
||||||
self?.delegate?.processingDidCancel()
|
self?.delegate?.processingDidCancel()
|
||||||
case .notFound:
|
case AccountError.createErrorNotFound:
|
||||||
self?.showNoFeedsErrorMessage()
|
self?.showNoFeedsErrorMessage()
|
||||||
self?.delegate?.processingDidCancel()
|
self?.delegate?.processingDidCancel()
|
||||||
}
|
default:
|
||||||
case .failure(let error):
|
|
||||||
self?.presentError(error)
|
self?.presentError(error)
|
||||||
self?.delegate?.processingDidCancel()
|
self?.delegate?.processingDidCancel()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue