diff --git a/WireNetwork/Sources/WireNetwork/APIs/Rest/AuthenticationAPI/AuthenticationAPIV0.swift b/WireNetwork/Sources/WireNetwork/APIs/Rest/AuthenticationAPI/AuthenticationAPIV0.swift index 36cf6a7d1ef..d21ac3107cd 100644 --- a/WireNetwork/Sources/WireNetwork/APIs/Rest/AuthenticationAPI/AuthenticationAPIV0.swift +++ b/WireNetwork/Sources/WireNetwork/APIs/Rest/AuthenticationAPI/AuthenticationAPIV0.swift @@ -213,8 +213,7 @@ class AuthenticationAPIV0: AuthenticationAPI, VersionedAPI { let (data, response) = try await networkService.executeRequest(request) guard - let responseURL = response.url, - let responseHeaders = response.allHeaderFields as? [String: String] + response.allHeaderFields is [String: String] else { throw AuthenticationAPIError.invalidResponse } @@ -239,7 +238,7 @@ class AuthenticationAPIV0: AuthenticationAPI, VersionedAPI { .withBody(body, contentType: .json) .build() - let (data, response) = try await networkService.executeRequest(request) + let (_, response) = try await networkService.executeRequest(request) guard let responseURL = response.url, @@ -271,9 +270,9 @@ class AuthenticationAPIV0: AuthenticationAPI, VersionedAPI { .withBody(body, contentType: .json) .build() - let (data, response) = try await networkService.executeRequest(request) + let (_, _) = try await networkService.executeRequest(request) - try ResponseParser() + _ = ResponseParser() .success(code: .ok) .failure(code: .badRequest, label: "bad-request", error: AuthenticationAPIError.invalidEmail) } diff --git a/WireNetwork/Sources/WireNetwork/Authentication/AuthenticationManager.swift b/WireNetwork/Sources/WireNetwork/Authentication/AuthenticationManager.swift index 02b5bf2a75c..c8ed01deb74 100644 --- a/WireNetwork/Sources/WireNetwork/Authentication/AuthenticationManager.swift +++ b/WireNetwork/Sources/WireNetwork/Authentication/AuthenticationManager.swift @@ -45,14 +45,14 @@ public actor AuthenticationManager: AuthenticationManagerProtocol { private var currentToken: CurrentToken? private let clientID: String? - private let cookieStorage: any CookieStorageProtocol - private let networkService: any NetworkServiceProtocol + private let cookieStorage: any CookieStorageProtocol & Sendable + private let networkService: any NetworkServiceProtocol & Sendable private let onAuthenticationFailure: () -> Void public init( clientID: String?, - cookieStorage: any CookieStorageProtocol, - networkService: any NetworkServiceProtocol, + cookieStorage: any CookieStorageProtocol & Sendable, + networkService: any NetworkServiceProtocol & Sendable, onAuthenticationFailure: @escaping () -> Void ) { self.clientID = clientID @@ -142,7 +142,7 @@ public actor AuthenticationManager: AuthenticationManagerProtocol { private func makeRenewTokenTask( lastKnownToken: AccessToken? ) -> Task { - Task { + Task { @Sendable [cookieStorage, networkService, clientID] in let cookies = try await cookieStorage.fetchCookies() var requestBuilder = try URLRequestBuilder(path: "/access") diff --git a/WireNetwork/Sources/WireNetwork/Network/NetworkStack/NetworkStack.swift b/WireNetwork/Sources/WireNetwork/Network/NetworkStack/NetworkStack.swift index b8d7929696b..5ab4f0a4a44 100644 --- a/WireNetwork/Sources/WireNetwork/Network/NetworkStack/NetworkStack.swift +++ b/WireNetwork/Sources/WireNetwork/Network/NetworkStack/NetworkStack.swift @@ -68,11 +68,8 @@ public actor NetworkStack { proxyCredentials: proxyCredentials ) self.state = .ready(services) - } catch .proxyCredentialsRequired { - self.state = .awaitingProxyCredentials } catch { - // Xcode warns that this case will never be executed, but if - // we take it away, it complains that not all errors are handled. + self.state = .awaitingProxyCredentials } } diff --git a/wire-ios/WireUITests/Helper/UserHelper.swift b/wire-ios/WireUITests/Helper/UserHelper.swift index a74cab591e3..9967b1f72f8 100644 --- a/wire-ios/WireUITests/Helper/UserHelper.swift +++ b/wire-ios/WireUITests/Helper/UserHelper.swift @@ -81,7 +81,7 @@ class UserHelper { email: user.email, password: user.password ) - cookieStorage.cookies = cookies + try await cookieStorage.storeCookies(cookies) // Get activation code let (activationCode, activationKey) = try await authenticationAPI.getActivationCode( @@ -306,8 +306,8 @@ enum FilterConversationsByCriteria { case conversationType(ConversationType?) } -private final class MockCookieStorage: CookieStorageProtocol { - var cookies: [HTTPCookie] +private actor MockCookieStorage: CookieStorageProtocol { + private var cookies: [HTTPCookie] init() { self.cookies = []