From 76ae11fff39ae80fa559d0dc3ffdb1cc6ab39008 Mon Sep 17 00:00:00 2001 From: Philippe Weidmann Date: Fri, 16 Oct 2026 13:41:28 +0200 Subject: [PATCH 1/3] fix(OAuthAuthenticator): Callback failure when no refresh token --- Sources/InfomaniakCore/Networking/ApiFetcher.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sources/InfomaniakCore/Networking/ApiFetcher.swift b/Sources/InfomaniakCore/Networking/ApiFetcher.swift index dd25e3e..e13ef72 100644 --- a/Sources/InfomaniakCore/Networking/ApiFetcher.swift +++ b/Sources/InfomaniakCore/Networking/ApiFetcher.swift @@ -259,7 +259,7 @@ open class OAuthAuthenticator: Authenticator { public weak var refreshTokenDelegate: RefreshTokenDelegate? - public init(refreshTokenDelegate: RefreshTokenDelegate) { + public init(refreshTokenDelegate: RefreshTokenDelegate?) { self.refreshTokenDelegate = refreshTokenDelegate } @@ -284,6 +284,9 @@ open class OAuthAuthenticator: Authenticator { if let error = error as NSError?, error.domain == "invalid_grant" { self.refreshTokenDelegate?.didFailRefreshToken(credential) completion(.failure(error)) + } else if let loginError = error as? InfomaniakLoginError, + case .noRefreshToken = loginError { + completion(.failure(loginError)) } else { // Couldn't refresh the token, keep the old token and fetch it later. Maybe because of bad network ? completion(.success(credential)) From 202a1069e073687147fa1d4d4e2c4420b714285f Mon Sep 17 00:00:00 2001 From: Philippe Weidmann Date: Fri, 16 Oct 2026 15:03:07 +0200 Subject: [PATCH 2/3] ci: Target correct Simulator --- .github/workflows/ci.yml | 6 +++--- Package.resolved | 23 ++++++++++++----------- Package.swift | 2 +- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f8b3261..015ee38 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,13 +17,13 @@ jobs: - name: Checkout uses: actions/checkout@v6 - name: Build - run: xcodebuild -scheme InfomaniakCore build -destination "platform=iOS Simulator,name=iPhone 17 Pro,OS=latest" + run: xcodebuild -scheme InfomaniakCore build -destination "platform=iOS Simulator,name=${{ vars.LATEST_IPHONE_SIMULATOR }},OS=latest" - name: Test - run: Scripts/prepareForTesting.sh && xcodebuild -scheme InfomaniakCore-Package test -destination "platform=iOS Simulator,name=iPhone 17 Pro,OS=latest" -enableCodeCoverage YES -resultBundlePath ResultBundle.xcresult + run: Scripts/prepareForTesting.sh && xcodebuild -scheme InfomaniakCore-Package test -destination "platform=iOS Simulator,name=${{ vars.LATEST_IPHONE_SIMULATOR }},OS=latest" -enableCodeCoverage YES -resultBundlePath ResultBundle.xcresult - name: Convert Coverage Report run: ./Scripts/xccov-to-generic.sh ResultBundle.xcresult > coverage.xml - name: SonarQube Scan - uses: SonarSource/sonarqube-scan-action@fd88b7d7ccbaefd23d8f36f73b59db7a3d246602 #6.0.0 + uses: SonarSource/sonarqube-scan-action@d209202bc7d53ff1cc128f7f907dac145c9d6ae9 #8.3.0 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/Package.resolved b/Package.resolved index d40a588..c3d2811 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,12 +1,13 @@ { + "originHash" : "26842370aeada01ba90f750b0e6e1bb71e57c721ccc78e0a38d0348920641ed8", "pins" : [ { "identity" : "alamofire", "kind" : "remoteSourceControl", "location" : "https://github.com/Alamofire/Alamofire", "state" : { - "revision" : "7595cbcf59809f9977c5f6378500de2ad73b7ddb", - "version" : "5.12.0" + "revision" : "bda9ed57d72988a3a2ada33d824583541f86eac6", + "version" : "5.12.2" } }, { @@ -23,8 +24,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/Infomaniak/ios-login", "state" : { - "revision" : "b53d08cd0830cfed227ce1b79dbaccd29827b81d", - "version" : "7.8.1" + "revision" : "8296f4575d7568bb3c30c8acb4672b45a16bf481", + "version" : "7.9.0" } }, { @@ -41,8 +42,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/realm/realm-core.git", "state" : { - "revision" : "4cc46f8607516226e5465062fdacd088fbd94552", - "version" : "20.1.4" + "revision" : "b4192c46305570577c4d08df790fddec5ab3aa04", + "version" : "20.1.5" } }, { @@ -50,8 +51,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/realm/realm-swift", "state" : { - "revision" : "600e187711e5fa4e8e2c0429cacee27e8e44f112", - "version" : "20.0.4" + "revision" : "a40ced79265b644a896e393b0f3a37e7916e7de3", + "version" : "20.0.6" } }, { @@ -59,8 +60,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/getsentry/sentry-cocoa", "state" : { - "revision" : "e6d00b6171c0c055debdf278554db035ae958926", - "version" : "9.16.1" + "revision" : "4f135c52afeeb1d6937eb93824c7ec1cddcaa372", + "version" : "9.30.1" } }, { @@ -73,5 +74,5 @@ } } ], - "version" : 2 + "version" : 3 } diff --git a/Package.swift b/Package.swift index 6dbf7b8..4f4b4b9 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.7 +// swift-tools-version:5.10 // The swift-tools-version declares the minimum version of Swift required to build this package. import Foundation From 415d083cb0636cb2ae6a5c6b8e2e68da2817c2e5 Mon Sep 17 00:00:00 2001 From: Philippe Weidmann Date: Mon, 19 Oct 2026 14:33:47 +0200 Subject: [PATCH 3/3] test: Disable writing to appgroup - Only works on iOS --- .../InfomaniakCoreTests/DeviceAssociation/UTDeviceManager.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Tests/InfomaniakCoreTests/DeviceAssociation/UTDeviceManager.swift b/Tests/InfomaniakCoreTests/DeviceAssociation/UTDeviceManager.swift index b2854ee..5cbd0b2 100644 --- a/Tests/InfomaniakCoreTests/DeviceAssociation/UTDeviceManager.swift +++ b/Tests/InfomaniakCoreTests/DeviceAssociation/UTDeviceManager.swift @@ -208,6 +208,7 @@ struct UTDeviceManager_getOrCreateCurrentDevice { @Test("get a userDevice from the public interface and check stability", arguments: [Int.random(in: 1 ... 100), Int.random(in: 1 ... 100)]) func currentDevice(userId: Int) async throws { + #if os(iOS) // GIVEN let deviceManager = DeviceManager(appGroupIdentifier: "group.infomaniak.deviceassociation", appMarketingVersion: "1.0.0", @@ -226,5 +227,6 @@ struct UTDeviceManager_getOrCreateCurrentDevice { } catch { Issue.record("unable to fetch current device twice: \(error)") } + #endif } }