allow cancelling of network requests

This commit is contained in:
Jonathan Bennett 2019-11-20 16:33:56 -05:00
parent 93595ab745
commit 85d54c17cc
2 changed files with 6 additions and 2 deletions

View File

@ -28,6 +28,10 @@ final class FeedWranglerAPICaller: NSObject {
self.transport = transport self.transport = transport
} }
func cancelAll() {
transport.cancelAll()
}
func validateCredentials(completion: @escaping (Result<Credentials?, Error>) -> Void) { func validateCredentials(completion: @escaping (Result<Credentials?, Error>) -> Void) {
let url = FeedWranglerConfig.clientURL.appendingPathComponent("users/authorize") let url = FeedWranglerConfig.clientURL.appendingPathComponent("users/authorize")
let username = self.credentials?.username ?? "" let username = self.credentials?.username ?? ""

View File

@ -57,7 +57,7 @@ final class FeedWranglerAccountDelegate: AccountDelegate {
} }
func accountWillBeDeleted(_ account: Account) { func accountWillBeDeleted(_ account: Account) {
fatalError() // noop
} }
func refreshAll(for account: Account, completion: @escaping (Result<Void, Error>) -> Void) { func refreshAll(for account: Account, completion: @escaping (Result<Void, Error>) -> Void) {
@ -122,7 +122,7 @@ final class FeedWranglerAccountDelegate: AccountDelegate {
} }
func cancelAll(for account: Account) { func cancelAll(for account: Account) {
fatalError() caller.cancelAll()
} }
func refreshCredentials(for account: Account, completion: @escaping (() -> Void)) { func refreshCredentials(for account: Account, completion: @escaping (() -> Void)) {