make slight change to how not modified responses are handled

This commit is contained in:
Maurice Parker 2019-05-06 05:28:02 -05:00
parent dd8d3ec87a
commit 51a1562e4b
4 changed files with 7 additions and 19 deletions

View File

@ -285,7 +285,7 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
delegate.refreshAll(for: self, completionHandler: completion)
}
public func update(_ feed: Feed, with parsedFeed: ParsedFeed, _ completion: @escaping RSVoidCompletionBlock) {
public func update(_ feed: Feed, with parsedFeed: ParsedFeed, _ completion: @escaping (() -> Void)) {
feed.takeSettings(from: parsedFeed)

View File

@ -47,7 +47,7 @@ final class FeedbinAPICaller: NSObject {
}
func retrieveTags(completionHandler completion: @escaping (Result<[FeedbinTag], Error>) -> Void) {
func retrieveTags(completionHandler completion: @escaping (Result<[FeedbinTag]?, Error>) -> Void) {
let callURL = feedbinBaseURL.appendingPathComponent("tags.json")
let conditionalGet = accountMetadata?.conditionalGetInfo[AccountMetadata.ConditionalGetKeys.tags]

View File

@ -85,13 +85,15 @@ private extension FeedbinAccountDelegate {
self?.syncFolders(account, tags)
completion(.success(()))
case .failure(let error):
self?.checkErrorOrNotModified(error, completion: completion)
completion(.failure(error))
}
}
}
func syncFolders(_ account: Account, _ tags: [FeedbinTag]) {
func syncFolders(_ account: Account, _ tags: [FeedbinTag]?) {
guard let tags = tags else { return }
let tagNames = tags.map { $0.name }
@ -121,18 +123,4 @@ private extension FeedbinAccountDelegate {
}
func checkErrorOrNotModified(_ error: Error, completion: @escaping (Result<Void, Error>) -> Void) {
switch error {
case TransportError.httpError(let status):
if status == HTTPResponseCode.notModified {
completion(.success(()))
} else {
completion(.failure(error))
}
default:
completion(.failure(error))
}
}
}

@ -1 +1 @@
Subproject commit cb3910180cd6af904b02b08f4044416326074844
Subproject commit 903f6dae0a91f382e310a30aa690eb12569cfff4