Fixed issue where error message dialogs were only flashed on the screen.
This commit is contained in:
parent
31ba612a95
commit
50822700c0
@ -17,6 +17,7 @@ protocol AddContainerViewControllerChild: UIViewController {
|
|||||||
protocol AddContainerViewControllerChildDelegate: UIViewController {
|
protocol AddContainerViewControllerChildDelegate: UIViewController {
|
||||||
func readyToAdd(state: Bool)
|
func readyToAdd(state: Bool)
|
||||||
func processingDidBegin()
|
func processingDidBegin()
|
||||||
|
func processingDidCancel()
|
||||||
func processingDidEnd()
|
func processingDidEnd()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,11 +77,14 @@ extension AddContainerViewController: AddContainerViewControllerChildDelegate {
|
|||||||
activityIndicatorView.startAnimating()
|
activityIndicatorView.startAnimating()
|
||||||
}
|
}
|
||||||
|
|
||||||
func processingDidEnd() {
|
func processingDidCancel() {
|
||||||
addButton.isEnabled = true
|
addButton.isEnabled = true
|
||||||
typeSelectorSegmentedControl.isEnabled = true
|
typeSelectorSegmentedControl.isEnabled = true
|
||||||
activityIndicatorView.isHidden = true
|
activityIndicatorView.isHidden = true
|
||||||
activityIndicatorView.stopAnimating()
|
activityIndicatorView.stopAnimating()
|
||||||
|
}
|
||||||
|
|
||||||
|
func processingDidEnd() {
|
||||||
dismiss(animated: true)
|
dismiss(animated: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ class AddFeedViewController: UITableViewController, AddContainerViewControllerCh
|
|||||||
|
|
||||||
func cancel() {
|
func cancel() {
|
||||||
userCancelled = true
|
userCancelled = true
|
||||||
delegate?.processingDidEnd()
|
delegate?.processingDidCancel()
|
||||||
}
|
}
|
||||||
|
|
||||||
func add() {
|
func add() {
|
||||||
@ -65,7 +65,7 @@ class AddFeedViewController: UITableViewController, AddContainerViewControllerCh
|
|||||||
let normalizedURLString = (urlString as NSString).rs_normalizedURL()
|
let normalizedURLString = (urlString as NSString).rs_normalizedURL()
|
||||||
|
|
||||||
guard !normalizedURLString.isEmpty, let url = URL(string: normalizedURLString) else {
|
guard !normalizedURLString.isEmpty, let url = URL(string: normalizedURLString) else {
|
||||||
delegate?.processingDidEnd()
|
delegate?.processingDidCancel()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,17 +134,17 @@ extension AddFeedViewController: FeedFinderDelegate {
|
|||||||
if let error = feedFinder.initialDownloadError {
|
if let error = feedFinder.initialDownloadError {
|
||||||
if feedFinder.initialDownloadStatusCode == 404 {
|
if feedFinder.initialDownloadStatusCode == 404 {
|
||||||
showNoFeedsErrorMessage()
|
showNoFeedsErrorMessage()
|
||||||
delegate?.processingDidEnd()
|
delegate?.processingDidCancel()
|
||||||
} else {
|
} else {
|
||||||
showInitialDownloadError(error)
|
showInitialDownloadError(error)
|
||||||
delegate?.processingDidEnd()
|
delegate?.processingDidCancel()
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
guard let bestFeedSpecifier = FeedSpecifier.bestFeed(in: feedSpecifiers) else {
|
guard let bestFeedSpecifier = FeedSpecifier.bestFeed(in: feedSpecifiers) else {
|
||||||
showNoFeedsErrorMessage()
|
showNoFeedsErrorMessage()
|
||||||
delegate?.processingDidEnd()
|
delegate?.processingDidCancel()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,8 +158,8 @@ extension AddFeedViewController: FeedFinderDelegate {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Shouldn't happen.
|
// Shouldn't happen.
|
||||||
delegate?.processingDidEnd()
|
|
||||||
showNoFeedsErrorMessage()
|
showNoFeedsErrorMessage()
|
||||||
|
delegate?.processingDidCancel()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -195,19 +195,19 @@ private extension AddFeedViewController {
|
|||||||
|
|
||||||
guard let account = userEnteredAccount else {
|
guard let account = userEnteredAccount else {
|
||||||
assertionFailure("Expected account.")
|
assertionFailure("Expected account.")
|
||||||
delegate?.processingDidEnd()
|
delegate?.processingDidCancel()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
guard let feedURLString = foundFeedURLString else {
|
guard let feedURLString = foundFeedURLString else {
|
||||||
assertionFailure("Expected feedURLString.")
|
assertionFailure("Expected feedURLString.")
|
||||||
delegate?.processingDidEnd()
|
delegate?.processingDidCancel()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if account.hasFeed(withURL: feedURLString) {
|
if account.hasFeed(withURL: feedURLString) {
|
||||||
showAlreadySubscribedError()
|
showAlreadySubscribedError()
|
||||||
delegate?.processingDidEnd()
|
delegate?.processingDidCancel()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,4 +228,3 @@ private extension AddFeedViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user