Skip to content

Commit

Permalink
Merge branch 'fix-warnings-introduced-by-xcode-16-ios-741'
Browse files Browse the repository at this point in the history
  • Loading branch information
buggmagnet committed Jan 14, 2025
2 parents d2949b4 + e71db0c commit ed0b9cd
Show file tree
Hide file tree
Showing 304 changed files with 1,143 additions and 911 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/ios-build-xcode-16.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@ jobs:
with:
go-version: 1.21.13

- name: Set up yeetd to workaround XCode being slow in CI
run: |
wget https://github.com/biscuitehh/yeetd/releases/download/1.0/yeetd-normal.pkg
sudo installer -pkg yeetd-normal.pkg -target /
yeetd &
- name: Configure Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/ios-screenshots-creation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ permissions: {}
jobs:
test:
name: Take screenshots
runs-on: macos-13-xlarge
runs-on: macos-15-xlarge
env:
SOURCE_PACKAGES_PATH: .spm
TEST_ACCOUNT: ${{ secrets.IOS_TEST_ACCOUNT_NUMBER }}
Expand All @@ -28,15 +28,10 @@ jobs:
with:
go-version: 1.21.13

- name: Set up yeetd to workaround XCode being slow in CI
run: |
wget https://github.com/biscuitehh/yeetd/releases/download/1.0/yeetd-normal.pkg
sudo installer -pkg yeetd-normal.pkg -target /
yeetd &
- name: Configure Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.0.1'
xcode-version: '16.1'
- name: Configure Rust
run: |
rustup default stable
Expand Down
11 changes: 3 additions & 8 deletions .github/workflows/ios-screenshots-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
test:
if: github.event.pull_request.merged || github.event_name == 'workflow_dispatch'
name: Screenshot tests
runs-on: macos-13-xlarge
runs-on: macos-15-xlarge
env:
SOURCE_PACKAGES_PATH: .spm
TEST_ACCOUNT: ${{ secrets.IOS_TEST_ACCOUNT_NUMBER }}
Expand All @@ -40,15 +40,10 @@ jobs:
with:
go-version: 1.21.13

- name: Set up yeetd to workaround XCode being slow in CI
run: |
wget https://github.com/biscuitehh/yeetd/releases/download/1.0/yeetd-normal.pkg
sudo installer -pkg yeetd-normal.pkg -target /
yeetd &
- name: Configure Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.0.1'
xcode-version: '16.1'
- name: Configure Rust
run: |
rustup default stable
Expand Down Expand Up @@ -84,7 +79,7 @@ jobs:
-project MullvadVPN.xcodeproj \
-scheme MullvadVPN \
-testPlan MullvadVPNScreenshots \
-destination "platform=iOS Simulator,name=iPhone 15" \
-destination "platform=iOS Simulator,name=iPhone 16" \
-clonedSourcePackagesDirPath "$SOURCE_PACKAGES_PATH" \
-disableAutomaticPackageResolution \
-resultBundlePath xcode-test-report \
Expand Down
15 changes: 5 additions & 10 deletions .github/workflows/ios-validate-build-schemas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
test:
if: github.event.pull_request.merged == true
name: Validate build schemas
runs-on: macos-13-xlarge
runs-on: macos-15-xlarge
env:
SOURCE_PACKAGES_PATH: .spm
steps:
Expand All @@ -41,15 +41,10 @@ jobs:
with:
go-version: 1.21.13

- name: Set up yeetd to workaround XCode being slow in CI
run: |
wget https://github.com/biscuitehh/yeetd/releases/download/1.0/yeetd-normal.pkg
sudo installer -pkg yeetd-normal.pkg -target /
yeetd &
- name: Configure Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.0.1'
xcode-version: '16.1'
- name: Configure Rust
run: |
rustup default stable
Expand Down Expand Up @@ -82,23 +77,23 @@ jobs:
-project MullvadVPN.xcodeproj \
-scheme MullvadVPN \
-configuration MockRelease \
-destination "platform=iOS Simulator,name=iPhone 15" \
-destination "platform=iOS Simulator,name=iPhone 16" \
-clonedSourcePackagesDirPath "$SOURCE_PACKAGES_PATH" \
-disableAutomaticPackageResolution \
build
set -o pipefail && env NSUnbufferedIO=YES xcodebuild \
-project MullvadVPN.xcodeproj \
-scheme MullvadVPN \
-configuration Staging \
-destination "platform=iOS Simulator,name=iPhone 15" \
-destination "platform=iOS Simulator,name=iPhone 16" \
-clonedSourcePackagesDirPath "$SOURCE_PACKAGES_PATH" \
-disableAutomaticPackageResolution \
build
set -o pipefail && env NSUnbufferedIO=YES xcodebuild \
-project MullvadVPN.xcodeproj \
-scheme MullvadVPNUITests \
-configuration Debug \
-destination "platform=iOS Simulator,name=iPhone 15" \
-destination "platform=iOS Simulator,name=iPhone 16" \
-clonedSourcePackagesDirPath "$SOURCE_PACKAGES_PATH" \
-disableAutomaticPackageResolution \
build
Expand Down
15 changes: 5 additions & 10 deletions .github/workflows/ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ permissions: {}
jobs:
check-formatting:
name: Check formatting
runs-on: macos-13
runs-on: macos-15
steps:
- name: Install SwiftFormat
run: |
Expand All @@ -33,7 +33,7 @@ jobs:

swiftlint:
name: Run swiftlint
runs-on: macos-13
runs-on: macos-15
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -47,7 +47,7 @@ jobs:

test:
name: Unit tests
runs-on: macos-13-xlarge
runs-on: macos-15-xlarge
env:
SOURCE_PACKAGES_PATH: .spm
steps:
Expand Down Expand Up @@ -77,15 +77,10 @@ jobs:
brew update
brew install protobuf
- name: Set up yeetd to workaround XCode being slow in CI
run: |
wget https://github.com/biscuitehh/yeetd/releases/download/1.0/yeetd-normal.pkg
sudo installer -pkg yeetd-normal.pkg -target /
yeetd &
- name: Configure Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.0.1'
xcode-version: '16.1'
- name: Configure Rust
# Since the https://github.com/actions/runner-images/releases/tag/macos-13-arm64%2F20240721.1 release
# Brew does not install tools at the correct location anymore
Expand Down Expand Up @@ -115,7 +110,7 @@ jobs:
-project MullvadVPN.xcodeproj \
-scheme MullvadVPN \
-testPlan MullvadVPNCI \
-destination "platform=iOS Simulator,name=iPhone 15" \
-destination "platform=iOS Simulator,name=iPhone 16" \
-clonedSourcePackagesDirPath "$SOURCE_PACKAGES_PATH" \
-disableAutomaticPackageResolution \
-resultBundlePath xcode-test-report \
Expand Down
2 changes: 1 addition & 1 deletion ios/MullvadLogging/LogFileOutputStream.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import MullvadTypes
/// the first place, or when writing to it.
private let reopenFileLogInterval: Duration = .seconds(5)

class LogFileOutputStream: TextOutputStream {
class LogFileOutputStream: TextOutputStream, @unchecked Sendable {
private let queue = DispatchQueue(label: "LogFileOutputStreamQueue", qos: .utility)

private let baseFileURL: URL
Expand Down
2 changes: 1 addition & 1 deletion ios/MullvadLogging/OSLogHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public struct OSLogHandler: LogHandler {
let category: String
}

private static var osLogRegistry: [RegistryKey: OSLog] = [:]
nonisolated(unsafe) private static var osLogRegistry: [RegistryKey: OSLog] = [:]
private static let registryLock = NSLock()

private static func getOSLog(subsystem: String, category: String) -> OSLog {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Combine
import MullvadSettings

public struct AccessMethodRepositoryStub: AccessMethodRepositoryDataSource {
public struct AccessMethodRepositoryStub: AccessMethodRepositoryDataSource, @unchecked Sendable {
public var directAccess: PersistentAccessMethod

public var accessMethodsPublisher: AnyPublisher<[PersistentAccessMethod], Never> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation
import MullvadREST
import MullvadTypes

struct RESTRequestExecutorStub<Success>: RESTRequestExecutor {
struct RESTRequestExecutorStub<Success: Sendable>: RESTRequestExecutor {
var success: (() -> Success)?

func execute(completionHandler: @escaping (Result<Success, Error>) -> Void) -> Cancellable {
Expand Down
4 changes: 2 additions & 2 deletions ios/MullvadREST/ApiHandlers/APIAvailabilityTestRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation
import MullvadTypes

extension REST {
public struct APIAvailabilityTestRequest {
public struct APIAvailabilityTestRequest: Sendable {
let transport: RESTTransport

public init(transport: RESTTransport) {
Expand All @@ -21,7 +21,7 @@ extension REST {
///
/// - Parameter completion: Completes with `nil` if the request was successful, and `Error` otherwise.
/// - Returns: A cancellable token to cancel the request inflight.
public func makeRequest(completion: @escaping (Swift.Error?) -> Void) -> Cancellable {
public func makeRequest(completion: @escaping @Sendable (Swift.Error?) -> Void) -> Cancellable {
do {
let factory = RequestFactory(
hostname: defaultAPIHostname,
Expand Down
2 changes: 1 addition & 1 deletion ios/MullvadREST/ApiHandlers/AddressCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import MullvadLogging
import MullvadTypes

extension REST {
public final class AddressCache {
public final class AddressCache: @unchecked Sendable {
/// Logger.
private let logger = Logger(label: "AddressCache")

Expand Down
32 changes: 16 additions & 16 deletions ios/MullvadREST/ApiHandlers/RESTAPIProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ import Foundation
import MullvadTypes
import WireGuardKitTypes

public protocol APIQuerying {
public protocol APIQuerying: Sendable {
func getAddressList(
retryStrategy: REST.RetryStrategy,
completionHandler: @escaping ProxyCompletionHandler<[AnyIPEndpoint]>
completionHandler: @escaping @Sendable ProxyCompletionHandler<[AnyIPEndpoint]>
) -> Cancellable

func getRelays(
etag: String?,
retryStrategy: REST.RetryStrategy,
completionHandler: @escaping ProxyCompletionHandler<REST.ServerRelaysCacheResponse>
completionHandler: @escaping @Sendable ProxyCompletionHandler<REST.ServerRelaysCacheResponse>
) -> Cancellable

func createApplePayment(
Expand All @@ -30,19 +30,19 @@ public protocol APIQuerying {
func sendProblemReport(
_ body: REST.ProblemReportRequest,
retryStrategy: REST.RetryStrategy,
completionHandler: @escaping ProxyCompletionHandler<Void>
completionHandler: @escaping @Sendable ProxyCompletionHandler<Void>
) -> Cancellable

func submitVoucher(
voucherCode: String,
accountNumber: String,
retryStrategy: REST.RetryStrategy,
completionHandler: @escaping ProxyCompletionHandler<REST.SubmitVoucherResponse>
completionHandler: @escaping @Sendable ProxyCompletionHandler<REST.SubmitVoucherResponse>
) -> Cancellable
}

extension REST {
public final class APIProxy: Proxy<AuthProxyConfiguration>, APIQuerying {
public final class APIProxy: Proxy<AuthProxyConfiguration>, APIQuerying, @unchecked Sendable {
public init(configuration: AuthProxyConfiguration) {
super.init(
name: "APIProxy",
Expand All @@ -57,7 +57,7 @@ extension REST {

public func getAddressList(
retryStrategy: REST.RetryStrategy,
completionHandler: @escaping ProxyCompletionHandler<[AnyIPEndpoint]>
completionHandler: @escaping @Sendable ProxyCompletionHandler<[AnyIPEndpoint]>
) -> Cancellable {
let requestHandler = AnyRequestHandler { endpoint in
try self.requestFactory.createRequest(
Expand All @@ -84,7 +84,7 @@ extension REST {
public func getRelays(
etag: String?,
retryStrategy: REST.RetryStrategy,
completionHandler: @escaping ProxyCompletionHandler<ServerRelaysCacheResponse>
completionHandler: @escaping @Sendable ProxyCompletionHandler<ServerRelaysCacheResponse>
) -> Cancellable {
let requestHandler = AnyRequestHandler { endpoint in
var requestBuilder = try self.requestFactory.createRequestBuilder(
Expand Down Expand Up @@ -240,7 +240,7 @@ extension REST {
voucherCode: String,
accountNumber: String,
retryStrategy: REST.RetryStrategy,
completionHandler: @escaping ProxyCompletionHandler<SubmitVoucherResponse>
completionHandler: @escaping @Sendable ProxyCompletionHandler<SubmitVoucherResponse>
) -> Cancellable {
let requestHandler = AnyRequestHandler(
createURLRequest: { endpoint, authorization in
Expand Down Expand Up @@ -283,16 +283,16 @@ extension REST {

// MARK: - Response types

public enum ServerRelaysCacheResponse {
public enum ServerRelaysCacheResponse: Sendable {
case notModified
case newContent(_ etag: String?, _ rawData: Data)
}

private struct CreateApplePaymentRequest: Encodable {
private struct CreateApplePaymentRequest: Encodable, Sendable {
let receiptString: Data
}

public enum CreateApplePaymentResponse {
public enum CreateApplePaymentResponse: Sendable {
case noTimeAdded(_ expiry: Date)
case timeAdded(_ timeAdded: Int, _ newExpiry: Date)

Expand Down Expand Up @@ -322,12 +322,12 @@ extension REST {
}
}

private struct CreateApplePaymentRawResponse: Decodable {
private struct CreateApplePaymentRawResponse: Decodable, Sendable {
let timeAdded: Int
let newExpiry: Date
}

public struct ProblemReportRequest: Encodable {
public struct ProblemReportRequest: Encodable, Sendable {
public let address: String
public let message: String
public let log: String
Expand All @@ -341,11 +341,11 @@ extension REST {
}
}

private struct SubmitVoucherRequest: Encodable {
private struct SubmitVoucherRequest: Encodable, Sendable {
let voucherCode: String
}

public struct SubmitVoucherResponse: Decodable {
public struct SubmitVoucherResponse: Decodable, Sendable {
public let timeAdded: Int
public let newExpiry: Date

Expand Down
8 changes: 4 additions & 4 deletions ios/MullvadREST/ApiHandlers/RESTAccessTokenManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ import MullvadLogging
import MullvadTypes
import Operations

public protocol RESTAccessTokenManagement {
public protocol RESTAccessTokenManagement: Sendable {
func getAccessToken(
accountNumber: String,
completionHandler: @escaping ProxyCompletionHandler<REST.AccessTokenData>
completionHandler: @escaping @Sendable ProxyCompletionHandler<REST.AccessTokenData>
) -> Cancellable

func invalidateAllTokens()
}

extension REST {
public final class AccessTokenManager: RESTAccessTokenManagement {
public final class AccessTokenManager: RESTAccessTokenManagement, @unchecked Sendable {
private let logger = Logger(label: "REST.AccessTokenManager")
private let operationQueue = AsyncOperationQueue.makeSerial()
private let dispatchQueue = DispatchQueue(label: "REST.AccessTokenManager.dispatchQueue")
Expand All @@ -34,7 +34,7 @@ extension REST {

public func getAccessToken(
accountNumber: String,
completionHandler: @escaping ProxyCompletionHandler<REST.AccessTokenData>
completionHandler: @escaping @Sendable ProxyCompletionHandler<REST.AccessTokenData>
) -> Cancellable {
let operation =
ResultBlockOperation<REST.AccessTokenData>(dispatchQueue: dispatchQueue) { finish -> Cancellable in
Expand Down
Loading

0 comments on commit ed0b9cd

Please sign in to comment.