Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

import Foundation
import WireFoundation

Check warning on line 21 in WireNetwork/Sources/WireNetwork/APIs/Rest/AuthenticationAPI/AuthenticationAPIV0.swift

View workflow job for this annotation

GitHub Actions / Test Results

Non-final class 'AuthenticationAPIV0' cannot conform to 'Sendable'; use '@unchecked Sendable'; this is an error in the Swift 6 language mode

Non-final class 'AuthenticationAPIV0' cannot conform to 'Sendable'; use '@unchecked Sendable'; this is an error in the Swift 6 language mode

Check warning on line 21 in WireNetwork/Sources/WireNetwork/APIs/Rest/AuthenticationAPI/AuthenticationAPIV0.swift

View workflow job for this annotation

GitHub Actions / Test Results

Non-final class 'AuthenticationAPIV0' cannot conform to 'Sendable'; use '@unchecked Sendable'; this is an error in the Swift 6 language mode

Non-final class 'AuthenticationAPIV0' cannot conform to 'Sendable'; use '@unchecked Sendable'; this is an error in the Swift 6 language mode
class AuthenticationAPIV0: AuthenticationAPI, VersionedAPI {

Check warning on line 23 in WireNetwork/Sources/WireNetwork/APIs/Rest/AuthenticationAPI/AuthenticationAPIV0.swift

View workflow job for this annotation

GitHub Actions / Test Results

Stored property 'networkService' of 'Sendable'-conforming class 'AuthenticationAPIV0' has non-sendable type 'any NetworkServiceProtocol'; this is an error in the Swift 6 language mode

Stored property 'networkService' of 'Sendable'-conforming class 'AuthenticationAPIV0' has non-sendable type 'any NetworkServiceProtocol'; this is an error in the Swift 6 language mode

Check warning on line 23 in WireNetwork/Sources/WireNetwork/APIs/Rest/AuthenticationAPI/AuthenticationAPIV0.swift

View workflow job for this annotation

GitHub Actions / Test Results

Stored property 'networkService' of 'Sendable'-conforming class 'AuthenticationAPIV0' has non-sendable type 'any NetworkServiceProtocol'; this is an error in the Swift 6 language mode

Stored property 'networkService' of 'Sendable'-conforming class 'AuthenticationAPIV0' has non-sendable type 'any NetworkServiceProtocol'; this is an error in the Swift 6 language mode
let networkService: any NetworkServiceProtocol

init(networkService: any NetworkServiceProtocol) {
Expand Down Expand Up @@ -213,8 +213,7 @@
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
}
Expand All @@ -239,7 +238,7 @@
.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,
Expand Down Expand Up @@ -271,9 +270,9 @@
.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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -142,7 +142,7 @@ public actor AuthenticationManager: AuthenticationManagerProtocol {
private func makeRenewTokenTask(
lastKnownToken: AccessToken?
) -> Task<AccessToken, any Error> {
Task {
Task { @Sendable [cookieStorage, networkService, clientID] in
let cookies = try await cookieStorage.fetchCookies()

var requestBuilder = try URLRequestBuilder(path: "/access")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
6 changes: 3 additions & 3 deletions wire-ios/WireUITests/Helper/UserHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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 = []
Expand Down
Loading