make slight change to how not modified responses are handled
This commit is contained in:
parent
dd8d3ec87a
commit
51a1562e4b
@ -285,7 +285,7 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
|
|||||||
delegate.refreshAll(for: self, completionHandler: completion)
|
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)
|
feed.takeSettings(from: parsedFeed)
|
||||||
|
|
||||||
|
@ -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 callURL = feedbinBaseURL.appendingPathComponent("tags.json")
|
||||||
let conditionalGet = accountMetadata?.conditionalGetInfo[AccountMetadata.ConditionalGetKeys.tags]
|
let conditionalGet = accountMetadata?.conditionalGetInfo[AccountMetadata.ConditionalGetKeys.tags]
|
||||||
|
@ -85,13 +85,15 @@ private extension FeedbinAccountDelegate {
|
|||||||
self?.syncFolders(account, tags)
|
self?.syncFolders(account, tags)
|
||||||
completion(.success(()))
|
completion(.success(()))
|
||||||
case .failure(let error):
|
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 }
|
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
|
Loading…
x
Reference in New Issue
Block a user