From ce189d759d7500df29e565898059e629151c6549 Mon Sep 17 00:00:00 2001 From: Marat Al Date: Tue, 4 Jul 2023 18:12:30 +0200 Subject: [PATCH 01/29] Upgraded Nimble for compatibility with Xcode 14.3 --- Cartfile.private | 2 +- Cartfile.resolved | 2 +- Test/Tests/AuthTests.swift | 2 +- Test/Tests/RealtimeClientChannelTests.swift | 6 +++--- Test/Tests/RealtimeClientPresenceTests.swift | 12 ++++++------ Test/Tests/RealtimeClientTests.swift | 2 +- Test/Tests/RestClientPresenceTests.swift | 20 +++++++++----------- Test/Tests/RestClientTests.swift | 4 ++-- 8 files changed, 24 insertions(+), 26 deletions(-) diff --git a/Cartfile.private b/Cartfile.private index baf8b7405..2c4874479 100644 --- a/Cartfile.private +++ b/Cartfile.private @@ -1 +1 @@ -github "Quick/Nimble" == 9.2.1 \ No newline at end of file +github "Quick/Nimble" == 11.2.2 \ No newline at end of file diff --git a/Cartfile.resolved b/Cartfile.resolved index 7d5ae0308..0eff4ee92 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,3 +1,3 @@ -github "Quick/Nimble" "v9.2.1" +github "Quick/Nimble" "v11.2.2" github "ably/delta-codec-cocoa" "1.3.3" github "rvi/msgpack-objective-C" "0.4.0" diff --git a/Test/Tests/AuthTests.swift b/Test/Tests/AuthTests.swift index 8fe2dc92b..1b1d96817 100644 --- a/Test/Tests/AuthTests.swift +++ b/Test/Tests/AuthTests.swift @@ -3740,7 +3740,7 @@ class AuthTests: XCTestCase { realtime.auth.authorize(callback) } - expect(didCancelAuthorization).to(be(true)) + XCTAssertTrue(didCancelAuthorization) XCTAssertTrue(realtime.auth.tokenDetails === tokenDetailsLast) XCTAssertEqual(realtime.auth.tokenDetails?.token, tokenDetailsLast?.token) diff --git a/Test/Tests/RealtimeClientChannelTests.swift b/Test/Tests/RealtimeClientChannelTests.swift index d79fcd85b..e65a20415 100644 --- a/Test/Tests/RealtimeClientChannelTests.swift +++ b/Test/Tests/RealtimeClientChannelTests.swift @@ -213,11 +213,11 @@ class RealtimeClientChannelTests: XCTestCase { } expect(channel1.internal.presenceMap.members).toEventually(haveCount(2), timeout: testTimeout) - expect(channel1.internal.presenceMap.members.keys).to(allPass { $0!.hasPrefix("\(channel1.internal.connectionId):Client") || $0!.hasPrefix("\(channel2.internal.connectionId):Client") }) - expect(channel1.internal.presenceMap.members.values).to(allPass { $0!.action == .present }) + expect(channel1.internal.presenceMap.members.keys).to(allPass { $0.hasPrefix("\(channel1.internal.connectionId):Client") || $0.hasPrefix("\(channel2.internal.connectionId):Client") }) + expect(channel1.internal.presenceMap.members.values).to(allPass { $0.action == .present }) expect(channel2.internal.presenceMap.members).toEventually(haveCount(2), timeout: testTimeout) - expect(channel2.internal.presenceMap.members.keys).to(allPass { $0!.hasPrefix("\(channel1.internal.connectionId):Client") || $0!.hasPrefix("\(channel2.internal.connectionId):Client") }) + expect(channel2.internal.presenceMap.members.keys).to(allPass { $0.hasPrefix("\(channel1.internal.connectionId):Client") || $0.hasPrefix("\(channel2.internal.connectionId):Client") }) XCTAssertEqual(channel2.internal.presenceMap.members["\(channel1.internal.connectionId):Client 1"]!.action, ARTPresenceAction.present) XCTAssertEqual(channel2.internal.presenceMap.members["\(channel2.internal.connectionId):Client 2"]!.action, ARTPresenceAction.present) } diff --git a/Test/Tests/RealtimeClientPresenceTests.swift b/Test/Tests/RealtimeClientPresenceTests.swift index ddb4c3d99..f3b001f21 100644 --- a/Test/Tests/RealtimeClientPresenceTests.swift +++ b/Test/Tests/RealtimeClientPresenceTests.swift @@ -3296,8 +3296,8 @@ class RealtimeClientPresenceTests: XCTestCase { } expect(members!.first).to(beAnInstanceOf(ARTPresenceMessage.self)) expect(members).to(allPass { member in - NSRegularExpression.match(member!.clientId, pattern: "^user(\\d+)$") - && (member!.data as? String) == expectedData + NSRegularExpression.match(member.clientId, pattern: "^user(\\d+)$") + && (member.data as? String) == expectedData }) done() } @@ -3812,8 +3812,8 @@ class RealtimeClientPresenceTests: XCTestCase { let members = membersPage.items expect(members).to(allPass { member in - NSRegularExpression.match(member!.clientId, pattern: expectedPattern) - && (member!.data as! [String]) == expectedData + NSRegularExpression.match(member.clientId, pattern: expectedPattern) + && (member.data as! [String]) == expectedData }) XCTAssertTrue(membersPage.hasNext) @@ -3829,8 +3829,8 @@ class RealtimeClientPresenceTests: XCTestCase { let members = nextPage.items expect(members).to(allPass { member in - NSRegularExpression.match(member!.clientId, pattern: expectedPattern) - && (member!.data as! [String]) == expectedData + NSRegularExpression.match(member.clientId, pattern: expectedPattern) + && (member.data as! [String]) == expectedData }) XCTAssertFalse(nextPage.hasNext) diff --git a/Test/Tests/RealtimeClientTests.swift b/Test/Tests/RealtimeClientTests.swift index 9a2af6076..f3dac4dce 100644 --- a/Test/Tests/RealtimeClientTests.swift +++ b/Test/Tests/RealtimeClientTests.swift @@ -225,7 +225,7 @@ class RealtimeClientTests: XCTestCase { /** Test that replacing query string default values in ARTClientOptions works properly */ - expect(absoluteString.components(separatedBy: "v=").count).to(be(2)) + XCTAssertEqual(absoluteString.components(separatedBy: "v=").count, 2) } else { XCTFail("Expected webSocketTransport.websocketURL?.absoluteString to be non-nil") } diff --git a/Test/Tests/RestClientPresenceTests.swift b/Test/Tests/RestClientPresenceTests.swift index 9cecc05bb..25bfb14f8 100644 --- a/Test/Tests/RestClientPresenceTests.swift +++ b/Test/Tests/RestClientPresenceTests.swift @@ -37,8 +37,8 @@ class RestClientPresenceTests: XCTestCase { let members = membersPage.items expect(members).to(allPass { member in - NSRegularExpression.match(member!.clientId, pattern: expectedPattern) - && (member!.data as? String) == expectedData + NSRegularExpression.match(member.clientId, pattern: expectedPattern) + && (member.data as? String) == expectedData }) XCTAssertTrue(membersPage.hasNext) @@ -52,8 +52,8 @@ class RestClientPresenceTests: XCTestCase { let members = nextPage.items expect(members).to(allPass { member in - NSRegularExpression.match(member!.clientId, pattern: expectedPattern) - && (member!.data as? String) == expectedData + NSRegularExpression.match(member.clientId, pattern: expectedPattern) + && (member.data as? String) == expectedData }) XCTAssertFalse(nextPage.hasNext) @@ -151,7 +151,6 @@ class RestClientPresenceTests: XCTestCase { XCTAssertFalse(membersPage!.hasNext) XCTAssertTrue(membersPage!.isLast) expect(membersPage!.items).to(allPass { member in - let member = member! return NSRegularExpression.match(member.clientId, pattern: "^user(7|8|9)") }) done() @@ -189,8 +188,8 @@ class RestClientPresenceTests: XCTestCase { let members = membersPage.items expect(members).to(allPass { member in - NSRegularExpression.match(member!.clientId, pattern: expectedPattern) - && (member!.data as? String) == expectedData + NSRegularExpression.match(member.clientId, pattern: expectedPattern) + && (member.data as? String) == expectedData }) XCTAssertTrue(membersPage.hasNext) @@ -206,8 +205,8 @@ class RestClientPresenceTests: XCTestCase { let members = nextPage.items expect(members).to(allPass { member in - NSRegularExpression.match(member!.clientId, pattern: expectedPattern) - && (member!.data as? String) == expectedData + NSRegularExpression.match(member.clientId, pattern: expectedPattern) + && (member.data as? String) == expectedData }) XCTAssertFalse(nextPage.hasNext) @@ -350,8 +349,7 @@ class RestClientPresenceTests: XCTestCase { XCTAssertFalse(membersPage!.hasNext) XCTAssertTrue(membersPage!.isLast) expect(membersPage!.items).to(allPass { member in - let member = member - return NSRegularExpression.match(member!.clientId, pattern: "^user(7|8|9)") + return NSRegularExpression.match(member.clientId, pattern: "^user(7|8|9)") }) done() } diff --git a/Test/Tests/RestClientTests.swift b/Test/Tests/RestClientTests.swift index 9a8212583..4893010d4 100644 --- a/Test/Tests/RestClientTests.swift +++ b/Test/Tests/RestClientTests.swift @@ -1507,7 +1507,7 @@ class RestClientTests: XCTestCase { $0.allHTTPHeaderFields!["Host"] == $0.url?.host } - expect(fallbackRequests.count).to(be(fallbackRequestsWithHostHeader.count)) + XCTAssertEqual(fallbackRequests.count, fallbackRequestsWithHostHeader.count) } func test__073__RestClient__Host_Fallback__retry_hosts_in_random_order__if_an_empty_array_of_fallback_hosts_is_provided__then_fallback_host_functionality_is_disabled() { @@ -2144,7 +2144,7 @@ class RestClientTests: XCTestCase { } expect(fallbackRequests).toNot(beEmpty()) - expect(fallbackRequests).to(allPass { extractURLQueryValue($0?.url, key: "request_id") == requestId }) + expect(fallbackRequests).to(allPass { extractURLQueryValue($0.url, key: "request_id") == requestId }) } func test__097__RestClient__request_IDs__ErrorInfo_should_have__requestId__property() { From 6f7cf23603591e6a32e0c3e000f7d1a0b9f44142 Mon Sep 17 00:00:00 2001 From: Marat Al Date: Sat, 8 Jul 2023 23:43:36 +0200 Subject: [PATCH 02/29] Excluded watchOS from Makefile --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 3506b8a7d..4d0960816 100644 --- a/Makefile +++ b/Makefile @@ -91,7 +91,7 @@ carthage_package: # https://github.com/Carthage/Carthage#archive-prebuilt-frameworks-into-one-zip-file # From `carthage help build` we are told that `--archive` implies `--no-skip-current`. - ./Scripts/carthage-with-workaround-for-issue-3019.sh build --archive --no-use-binaries + ./Scripts/carthage-with-workaround-for-issue-3019.sh build --archive --no-use-binaries --platform iOS,macOS,tvOS # Add LICENSE files (ours and SocketRocket’s). ./Scripts/add-licenses-to-carthage-output.sh @@ -105,7 +105,7 @@ carthage_clean: update_carthage_dependencies: $(info Updating Carthage dependencies for all platforms…) - carthage update --use-xcframeworks --no-use-binaries + carthage update --use-xcframeworks --platform iOS,macOS,tvOS --no-use-binaries ## [Carthage] Update dependencies for just iOS update_carthage_dependencies_ios: From 9b31fe50dab8dc8cf4c226c92e87ae8f570dbfe9 Mon Sep 17 00:00:00 2001 From: Marat Al Date: Sat, 8 Jul 2023 21:52:45 +0200 Subject: [PATCH 03/29] Updated EXCLUDED_ARCHS in carthage workaround script for Xcode 14 --- Scripts/carthage-with-workaround-for-issue-3019.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Scripts/carthage-with-workaround-for-issue-3019.sh b/Scripts/carthage-with-workaround-for-issue-3019.sh index 265d24049..3d883844f 100755 --- a/Scripts/carthage-with-workaround-for-issue-3019.sh +++ b/Scripts/carthage-with-workaround-for-issue-3019.sh @@ -10,8 +10,8 @@ trap 'rm -f "$xcconfig"' INT TERM HUP EXIT # For Xcode 13 make sure EXCLUDED_ARCHS is set to arm architectures otherwise # the build will fail on lipo due to duplicate architectures. -echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1300 = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig -echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_arm64__XCODE_1300 = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig +echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1400 = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig +echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_arm64__XCODE_1400 = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig echo 'EXCLUDED_ARCHS = $(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT)__XCODE_$(XCODE_VERSION_MAJOR))' >> $xcconfig export XCODE_XCCONFIG_FILE="$xcconfig" From 5fb8f1c7e8f75cac3c00e0760f3ad4de8e2f254a Mon Sep 17 00:00:00 2001 From: Marat Al Date: Sat, 8 Jul 2023 19:32:46 +0200 Subject: [PATCH 04/29] Explicit switch to macOS 13 and Xcode 14.2 --- .github/workflows/check-pod.yaml | 6 +++--- .github/workflows/docs.yml | 4 ++-- .github/workflows/integration-test-iOS16_2.yaml | 8 +++++++- .github/workflows/integration-test-macOS.yaml | 8 +++++++- .github/workflows/integration-test-tvOS16_1.yaml | 8 +++++++- 5 files changed, 26 insertions(+), 8 deletions(-) diff --git a/.github/workflows/check-pod.yaml b/.github/workflows/check-pod.yaml index f8019fcbd..2e82b5e07 100644 --- a/.github/workflows/check-pod.yaml +++ b/.github/workflows/check-pod.yaml @@ -8,13 +8,13 @@ on: jobs: check: - runs-on: macos-latest + runs-on: macos-13 steps: - uses: actions/checkout@v2 - - name: Select Specific Xcode Version (13.4.1) + - name: Select Specific Xcode Version (14.2) run: | - sudo xcode-select -s /Applications/Xcode_13.4.1.app + sudo xcode-select -s /Applications/Xcode_14.2.app echo "Selected Xcode version:" xcodebuild -version diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index cb5a39c6b..dbb97b27f 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -10,7 +10,7 @@ on: jobs: build: - runs-on: macos-latest + runs-on: macos-13 permissions: deployments: write @@ -21,7 +21,7 @@ jobs: - name: Select Specific Xcode Version run: | - sudo xcode-select -s /Applications/Xcode_13.2.app + sudo xcode-select -s /Applications/Xcode_14.2.app echo "Selected Xcode version:" xcodebuild -version diff --git a/.github/workflows/integration-test-iOS16_2.yaml b/.github/workflows/integration-test-iOS16_2.yaml index 918a11621..6429823fd 100644 --- a/.github/workflows/integration-test-iOS16_2.yaml +++ b/.github/workflows/integration-test-iOS16_2.yaml @@ -12,7 +12,7 @@ on: jobs: check: - runs-on: macos-latest + runs-on: macos-13 env: LC_CTYPE: en_US.UTF-8 @@ -22,6 +22,12 @@ jobs: steps: - name: Check out SDK repo uses: actions/checkout@v2 + + - name: Select Specific Xcode Version (14.2) + run: | + sudo xcode-select -s /Applications/Xcode_14.2.app + echo "Selected Xcode version:" + xcodebuild -version - name: Log environment information run: ./Scripts/log-environment-information.sh diff --git a/.github/workflows/integration-test-macOS.yaml b/.github/workflows/integration-test-macOS.yaml index a456ff7f1..d1ccca6ea 100644 --- a/.github/workflows/integration-test-macOS.yaml +++ b/.github/workflows/integration-test-macOS.yaml @@ -12,7 +12,7 @@ on: jobs: check: - runs-on: macos-latest + runs-on: macos-13 env: LC_CTYPE: en_US.UTF-8 @@ -22,6 +22,12 @@ jobs: steps: - name: Check out SDK repo uses: actions/checkout@v2 + + - name: Select Specific Xcode Version (14.2) + run: | + sudo xcode-select -s /Applications/Xcode_14.2.app + echo "Selected Xcode version:" + xcodebuild -version - name: Log environment information run: ./Scripts/log-environment-information.sh diff --git a/.github/workflows/integration-test-tvOS16_1.yaml b/.github/workflows/integration-test-tvOS16_1.yaml index f8827137a..5d9d2f299 100644 --- a/.github/workflows/integration-test-tvOS16_1.yaml +++ b/.github/workflows/integration-test-tvOS16_1.yaml @@ -12,7 +12,7 @@ on: jobs: check: - runs-on: macos-latest + runs-on: macos-13 env: LC_CTYPE: en_US.UTF-8 @@ -22,6 +22,12 @@ jobs: steps: - name: Check out SDK repo uses: actions/checkout@v2 + + - name: Select Specific Xcode Version (14.2) + run: | + sudo xcode-select -s /Applications/Xcode_14.2.app + echo "Selected Xcode version:" + xcodebuild -version - name: Log environment information run: ./Scripts/log-environment-information.sh From e337bdd1e7bfca5cad0c0b09f9c8eb158352dc46 Mon Sep 17 00:00:00 2001 From: Marat Al Date: Sat, 8 Jul 2023 18:38:31 +0200 Subject: [PATCH 05/29] Updated workflows for Xcode 14.3 --- ...on-test-iOS16_2.yaml => integration-test-iOS16_4.yaml} | 8 ++++---- ...-test-tvOS16_1.yaml => integration-test-tvOS16_4.yaml} | 8 ++++---- fastlane/Fastfile | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) rename .github/workflows/{integration-test-iOS16_2.yaml => integration-test-iOS16_4.yaml} (95%) rename .github/workflows/{integration-test-tvOS16_1.yaml => integration-test-tvOS16_4.yaml} (95%) diff --git a/.github/workflows/integration-test-iOS16_2.yaml b/.github/workflows/integration-test-iOS16_4.yaml similarity index 95% rename from .github/workflows/integration-test-iOS16_2.yaml rename to .github/workflows/integration-test-iOS16_4.yaml index 6429823fd..058a55745 100644 --- a/.github/workflows/integration-test-iOS16_2.yaml +++ b/.github/workflows/integration-test-iOS16_4.yaml @@ -1,4 +1,4 @@ -name: "Integration Test: iOS 16.2" +name: "Integration Test: iOS 16.4" on: pull_request: @@ -60,7 +60,7 @@ jobs: make submodules bundle install make update_carthage_dependencies_ios - bundle exec fastlane test_iOS16_2 + bundle exec fastlane test_iOS16_4 - name: Check Static Analyzer Output id: analyzer-output @@ -76,7 +76,7 @@ jobs: if: ${{ failure() && steps.analyzer-output.outcome == 'failure' }} uses: actions/upload-artifact@v2 with: - name: static-analyzer-reports-test_iOS16_2 + name: static-analyzer-reports-test_iOS16_4 path: ./derived_data/**/report-*.html - name: Run Examples Tests @@ -84,7 +84,7 @@ jobs: run: | pod repo update pod install - bundle exec fastlane scan -s Tests --output-directory "fastlane/test_output/examples/test_iOS16_2" + bundle exec fastlane scan -s Tests --output-directory "fastlane/test_output/examples/test_iOS16_4" - name: Build APNS Example Project working-directory: ./Examples/AblyPush diff --git a/.github/workflows/integration-test-tvOS16_1.yaml b/.github/workflows/integration-test-tvOS16_4.yaml similarity index 95% rename from .github/workflows/integration-test-tvOS16_1.yaml rename to .github/workflows/integration-test-tvOS16_4.yaml index 5d9d2f299..1dd249ad6 100644 --- a/.github/workflows/integration-test-tvOS16_1.yaml +++ b/.github/workflows/integration-test-tvOS16_4.yaml @@ -1,4 +1,4 @@ -name: "Integration Test: tvOS 16.1" +name: "Integration Test: tvOS 16.4" on: pull_request: @@ -60,7 +60,7 @@ jobs: make submodules bundle install make update_carthage_dependencies_tvos - bundle exec fastlane test_tvOS16_1 + bundle exec fastlane test_tvOS16_4 - name: Check Static Analyzer Output id: analyzer-output @@ -76,7 +76,7 @@ jobs: if: ${{ failure() && steps.analyzer-output.outcome == 'failure' }} uses: actions/upload-artifact@v2 with: - name: static-analyzer-reports-test_tvOS16_1 + name: static-analyzer-reports-test_tvOS16_4 path: ./derived_data/**/report-*.html - name: Run Examples Tests @@ -84,7 +84,7 @@ jobs: run: | pod repo update pod install - bundle exec fastlane scan -s Tests --output-directory "fastlane/test_output/examples/test_tvOS_16_1" + bundle exec fastlane scan -s Tests --output-directory "fastlane/test_output/examples/test_tvOS_16_4" - name: Xcodebuild Logs Artifact if: always() diff --git a/fastlane/Fastfile b/fastlane/Fastfile index dd04241bb..fa6c3d2e9 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -22,8 +22,8 @@ end platform :ios do LANE_CONFIGS = [ - LaneConfig.new(:test_iOS16_2, "Ably-iOS", ["iPhone 14 (16.2)"]), - LaneConfig.new(:test_tvOS16_1, "Ably-tvOS", ["Apple TV 4K (2nd generation) (16.1)"]), + LaneConfig.new(:test_iOS16_4, "Ably-iOS", ["iPhone 14 (16.4)"]), + LaneConfig.new(:test_tvOS16_4, "Ably-tvOS", ["Apple TV 4K (3rd generation) (16.4)"]), LaneConfig.new(:test_macOS, "Ably-macOS") ] From ba76c502e3cb59b9872823fdb3081bb1f360c265 Mon Sep 17 00:00:00 2001 From: Marat Al Date: Sat, 8 Jul 2023 22:33:35 +0200 Subject: [PATCH 06/29] Explicit switch to macOS 13 and Xcode 14.3 --- .github/workflows/check-pod.yaml | 4 ++-- .github/workflows/docs.yml | 4 ++-- .github/workflows/integration-test-iOS16_4.yaml | 4 ++-- ...ration-test-macOS.yaml => integration-test-macOS13.yaml} | 6 +++--- .github/workflows/integration-test-tvOS16_4.yaml | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) rename .github/workflows/{integration-test-macOS.yaml => integration-test-macOS13.yaml} (95%) diff --git a/.github/workflows/check-pod.yaml b/.github/workflows/check-pod.yaml index 2e82b5e07..2045d0294 100644 --- a/.github/workflows/check-pod.yaml +++ b/.github/workflows/check-pod.yaml @@ -12,9 +12,9 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Select Specific Xcode Version (14.2) + - name: Select Specific Xcode Version (14.3) run: | - sudo xcode-select -s /Applications/Xcode_14.2.app + sudo xcode-select -s /Applications/Xcode_14.3.app echo "Selected Xcode version:" xcodebuild -version diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index dbb97b27f..3948ece95 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -19,9 +19,9 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Select Specific Xcode Version + - name: Select Specific Xcode Version (14.3) run: | - sudo xcode-select -s /Applications/Xcode_14.2.app + sudo xcode-select -s /Applications/Xcode_14.3.app echo "Selected Xcode version:" xcodebuild -version diff --git a/.github/workflows/integration-test-iOS16_4.yaml b/.github/workflows/integration-test-iOS16_4.yaml index 058a55745..cb7466515 100644 --- a/.github/workflows/integration-test-iOS16_4.yaml +++ b/.github/workflows/integration-test-iOS16_4.yaml @@ -23,9 +23,9 @@ jobs: - name: Check out SDK repo uses: actions/checkout@v2 - - name: Select Specific Xcode Version (14.2) + - name: Select Specific Xcode Version (14.3) run: | - sudo xcode-select -s /Applications/Xcode_14.2.app + sudo xcode-select -s /Applications/Xcode_14.3.app echo "Selected Xcode version:" xcodebuild -version diff --git a/.github/workflows/integration-test-macOS.yaml b/.github/workflows/integration-test-macOS13.yaml similarity index 95% rename from .github/workflows/integration-test-macOS.yaml rename to .github/workflows/integration-test-macOS13.yaml index d1ccca6ea..46107ed02 100644 --- a/.github/workflows/integration-test-macOS.yaml +++ b/.github/workflows/integration-test-macOS13.yaml @@ -1,4 +1,4 @@ -name: "Integration Test: macOS Latest" +name: "Integration Test: macOS 13" on: pull_request: @@ -23,9 +23,9 @@ jobs: - name: Check out SDK repo uses: actions/checkout@v2 - - name: Select Specific Xcode Version (14.2) + - name: Select Specific Xcode Version (14.3) run: | - sudo xcode-select -s /Applications/Xcode_14.2.app + sudo xcode-select -s /Applications/Xcode_14.3.app echo "Selected Xcode version:" xcodebuild -version diff --git a/.github/workflows/integration-test-tvOS16_4.yaml b/.github/workflows/integration-test-tvOS16_4.yaml index 1dd249ad6..de7662466 100644 --- a/.github/workflows/integration-test-tvOS16_4.yaml +++ b/.github/workflows/integration-test-tvOS16_4.yaml @@ -23,9 +23,9 @@ jobs: - name: Check out SDK repo uses: actions/checkout@v2 - - name: Select Specific Xcode Version (14.2) + - name: Select Specific Xcode Version (14.3) run: | - sudo xcode-select -s /Applications/Xcode_14.2.app + sudo xcode-select -s /Applications/Xcode_14.3.app echo "Selected Xcode version:" xcodebuild -version From 94f71bcf8beacc26de2c15c63e1f76aef987c0a8 Mon Sep 17 00:00:00 2001 From: Marat Al Date: Thu, 31 Aug 2023 18:51:12 +0200 Subject: [PATCH 07/29] Set unique timeout value to check if it waits here. --- Test/Test Utilities/TestUtilities.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Test/Test Utilities/TestUtilities.swift b/Test/Test Utilities/TestUtilities.swift index 54842fe34..b781b35cd 100644 --- a/Test/Test Utilities/TestUtilities.swift +++ b/Test/Test Utilities/TestUtilities.swift @@ -572,7 +572,7 @@ func getTestTokenDetails(for test: Test, key: String? = nil, clientId: String? = } func getTestTokenDetails(for test: Test, key: String? = nil, clientId: String? = nil, capability: String? = nil, ttl: TimeInterval? = nil, queryTime: Bool? = nil, file: FileString = #file, line: UInt = #line) throws -> ARTTokenDetails { - let result = try AblyTests.waitFor(timeout: testTimeout, file: file, line: line) { value in + let result = try AblyTests.waitFor(timeout: DispatchTimeInterval.seconds(33), file: file, line: line) { value in getTestTokenDetails(for: test, key: key, clientId: clientId, capability: capability, ttl: ttl, queryTime: queryTime) { result in value(result) } From 4875be989a8217d8bbf939515c4eef8e2093240e Mon Sep 17 00:00:00 2001 From: Marat Al Date: Thu, 31 Aug 2023 19:29:51 +0200 Subject: [PATCH 08/29] Revert "Set unique timeout value to check if it waits here." This reverts commit 94f71bcf8beacc26de2c15c63e1f76aef987c0a8. --- Test/Test Utilities/TestUtilities.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Test/Test Utilities/TestUtilities.swift b/Test/Test Utilities/TestUtilities.swift index b781b35cd..54842fe34 100644 --- a/Test/Test Utilities/TestUtilities.swift +++ b/Test/Test Utilities/TestUtilities.swift @@ -572,7 +572,7 @@ func getTestTokenDetails(for test: Test, key: String? = nil, clientId: String? = } func getTestTokenDetails(for test: Test, key: String? = nil, clientId: String? = nil, capability: String? = nil, ttl: TimeInterval? = nil, queryTime: Bool? = nil, file: FileString = #file, line: UInt = #line) throws -> ARTTokenDetails { - let result = try AblyTests.waitFor(timeout: DispatchTimeInterval.seconds(33), file: file, line: line) { value in + let result = try AblyTests.waitFor(timeout: testTimeout, file: file, line: line) { value in getTestTokenDetails(for: test, key: key, clientId: clientId, capability: capability, ttl: ttl, queryTime: queryTime) { result in value(result) } From 2294ca2f93c66ea3208bcd85bdac2392c319a1eb Mon Sep 17 00:00:00 2001 From: Marat Al Date: Fri, 1 Sep 2023 17:43:18 +0200 Subject: [PATCH 09/29] Passing error reason to auth cancel block. --- Source/ARTAuth.m | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Source/ARTAuth.m b/Source/ARTAuth.m index 16ab57a08..52195de88 100644 --- a/Source/ARTAuth.m +++ b/Source/ARTAuth.m @@ -566,6 +566,7 @@ - (void)authorize:(ARTTokenParams *)tokenParams NSString *authorizeId = [[NSUUID new] UUIDString]; __block BOOL hasBeenExplicitlyCanceled = NO; + __block ARTErrorInfo *explicitlyCanceledError = nil; // Request always a new token ARTLogVerbose(self.logger, @"RS:%p ARTAuthInternal [authorize.%@, delegate=%@]: requesting new token", _rest, authorizeId, lastDelegate ? @"YES" : @"NO"); NSObject *task; @@ -587,10 +588,10 @@ - (void)authorize:(ARTTokenParams *)tokenParams } }; - void (^const canceledCallbackBlock)(void) = ^{ + void (^const canceledCallbackBlock)(NSError *) = ^(NSError *error) { ARTLogVerbose(self.logger, @"RS:%p ARTAuthInternal [authorize.%@]: canceled callback", self->_rest, authorizeId); if (callback) { - callback(nil, [ARTErrorInfo createWithCode:kCFURLErrorCancelled message:@"Authorization has been canceled"]); + callback(nil, error); } }; @@ -601,7 +602,7 @@ - (void)authorize:(ARTTokenParams *)tokenParams } if (hasBeenExplicitlyCanceled) { - canceledCallbackBlock(); + canceledCallbackBlock(explicitlyCanceledError); return; } @@ -618,7 +619,7 @@ - (void)authorize:(ARTTokenParams *)tokenParams switch (state) { case ARTAuthorizationSucceeded: if (hasBeenExplicitlyCanceled) { - canceledCallbackBlock(); + canceledCallbackBlock(explicitlyCanceledError); return; } successCallbackBlock(); @@ -631,7 +632,7 @@ - (void)authorize:(ARTTokenParams *)tokenParams break; case ARTAuthorizationCancelled: { ARTLogDebug(self.logger, @"RS:%p authorization cancelled but the request token has already completed", self->_rest); - canceledCallbackBlock(); + canceledCallbackBlock(explicitlyCanceledError); break; } } @@ -644,6 +645,7 @@ - (void)authorize:(ARTTokenParams *)tokenParams [_cancelationEventEmitter once:^(ARTErrorInfo * _Nullable error) { hasBeenExplicitlyCanceled = YES; + explicitlyCanceledError = error; [task cancel]; }]; From 4f9a52c09ffa41e49aac6530f763729e12cf59a9 Mon Sep 17 00:00:00 2001 From: Marat Al Date: Fri, 1 Sep 2023 18:44:07 +0200 Subject: [PATCH 10/29] Set default error in case of empty original error. --- Source/ARTAuth.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/ARTAuth.m b/Source/ARTAuth.m index 52195de88..428268adf 100644 --- a/Source/ARTAuth.m +++ b/Source/ARTAuth.m @@ -591,7 +591,7 @@ - (void)authorize:(ARTTokenParams *)tokenParams void (^const canceledCallbackBlock)(NSError *) = ^(NSError *error) { ARTLogVerbose(self.logger, @"RS:%p ARTAuthInternal [authorize.%@]: canceled callback", self->_rest, authorizeId); if (callback) { - callback(nil, error); + callback(nil, error ?: [ARTErrorInfo createWithCode:kCFURLErrorCancelled message:@"Authorization has been canceled"]); } }; From cde319757dd99d9fb75e1b6eb003c3b2a5d39ea9 Mon Sep 17 00:00:00 2001 From: Marat Al Date: Fri, 1 Sep 2023 21:31:43 +0200 Subject: [PATCH 11/29] Added temporary error for closed connection. --- Source/ARTRealtime.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/ARTRealtime.m b/Source/ARTRealtime.m index 9350bd4d4..09fa97449 100644 --- a/Source/ARTRealtime.m +++ b/Source/ARTRealtime.m @@ -650,7 +650,7 @@ - (ARTEventListener *)performTransitionWithStateChange:(ARTConnectionStateChange _connection.id = nil; _transport = nil; self.rest.prioritizedHost = nil; - [self.auth cancelAuthorization:nil]; + [self.auth cancelAuthorization:[ARTErrorInfo createWithCode:kCFURLErrorUnknown message:@"Connection was closed."]]; [self failPendingMessages:[ARTStatus state:ARTStateError info:[ARTErrorInfo createWithCode:ARTErrorConnectionClosed message:@"connection broken before receiving publishing acknowledgment"]]]; break; case ARTRealtimeFailed: { From 488d61477ee815768183e869a5b4281472efd09e Mon Sep 17 00:00:00 2001 From: Marat Al Date: Fri, 1 Sep 2023 22:30:39 +0200 Subject: [PATCH 12/29] Pass artificial error for all states. --- Source/ARTRealtime.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/ARTRealtime.m b/Source/ARTRealtime.m index 09fa97449..2af64759f 100644 --- a/Source/ARTRealtime.m +++ b/Source/ARTRealtime.m @@ -650,7 +650,7 @@ - (ARTEventListener *)performTransitionWithStateChange:(ARTConnectionStateChange _connection.id = nil; _transport = nil; self.rest.prioritizedHost = nil; - [self.auth cancelAuthorization:[ARTErrorInfo createWithCode:kCFURLErrorUnknown message:@"Connection was closed."]]; + [self.auth cancelAuthorization:stateChange.reason ?: [ARTErrorInfo createWithCode:kCFURLErrorUnknown message:@"Connection was closed."]]; [self failPendingMessages:[ARTStatus state:ARTStateError info:[ARTErrorInfo createWithCode:ARTErrorConnectionClosed message:@"connection broken before receiving publishing acknowledgment"]]]; break; case ARTRealtimeFailed: { @@ -659,7 +659,7 @@ - (ARTEventListener *)performTransitionWithStateChange:(ARTConnectionStateChange errorInfo:status.errorInfo]; [self abortAndReleaseTransport:status]; self.rest.prioritizedHost = nil; - [self.auth cancelAuthorization:stateChange.reason]; + [self.auth cancelAuthorization:stateChange.reason ?: [ARTErrorInfo createWithCode:kCFURLErrorUnknown message:@"Connection was failed."]]; [self failPendingMessages:[ARTStatus state:ARTStateError info:[ARTErrorInfo createWithCode:ARTErrorConnectionFailed message:@"connection broken before receiving publishing acknowledgment"]]]; break; } @@ -699,7 +699,7 @@ - (ARTEventListener *)performTransitionWithStateChange:(ARTConnectionStateChange case ARTRealtimeSuspended: { [_connectionRetryFromDisconnectedListener stopTimer]; _connectionRetryFromDisconnectedListener = nil; - [self.auth cancelAuthorization:nil]; + [self.auth cancelAuthorization:stateChange.reason ?: [ARTErrorInfo createWithCode:kCFURLErrorUnknown message:@"Connection was suspended."]]; [self closeAndReleaseTransport]; [stateChange setRetryIn:self.options.suspendedRetryTimeout]; stateChangeEventListener = [self unlessStateChangesBefore:stateChange.retryIn do:^{ From 207f35f17a1329db94aeac63f2edb6d92926404d Mon Sep 17 00:00:00 2001 From: Marat Al Date: Fri, 1 Sep 2023 22:31:16 +0200 Subject: [PATCH 13/29] Fix message for "test__056...". --- Test/Tests/RealtimeClientConnectionTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Test/Tests/RealtimeClientConnectionTests.swift b/Test/Tests/RealtimeClientConnectionTests.swift index 4a4e9d62e..bce769507 100644 --- a/Test/Tests/RealtimeClientConnectionTests.swift +++ b/Test/Tests/RealtimeClientConnectionTests.swift @@ -2167,7 +2167,7 @@ class RealtimeClientConnectionTests: XCTestCase { } XCTAssertEqual(reason.code, ARTErrorCode.tokenExpired.intValue) XCTAssertEqual(reason.statusCode, 401) - expect(reason.message).to(contain("Key/token status changed (expire)")) + expect(reason.message).to(contain("Token expired")) partialDone() } client.connect() From 87bf8a129ded4f5b3a45b1a1a0635d53833f05f8 Mon Sep 17 00:00:00 2001 From: Marat Al Date: Fri, 1 Sep 2023 23:27:17 +0200 Subject: [PATCH 14/29] Changed local error message. --- Source/ARTAuth.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/ARTAuth.m b/Source/ARTAuth.m index 428268adf..61c970529 100644 --- a/Source/ARTAuth.m +++ b/Source/ARTAuth.m @@ -591,7 +591,7 @@ - (void)authorize:(ARTTokenParams *)tokenParams void (^const canceledCallbackBlock)(NSError *) = ^(NSError *error) { ARTLogVerbose(self.logger, @"RS:%p ARTAuthInternal [authorize.%@]: canceled callback", self->_rest, authorizeId); if (callback) { - callback(nil, error ?: [ARTErrorInfo createWithCode:kCFURLErrorCancelled message:@"Authorization has been canceled"]); + callback(nil, error ?: [ARTErrorInfo createWithCode:kCFURLErrorCancelled message:@"Authorization has been canceled."]); } }; From 04348247a9adaaaa865d63fb53e2f6e906ce6c06 Mon Sep 17 00:00:00 2001 From: Marat Al Date: Sat, 2 Sep 2023 00:02:15 +0200 Subject: [PATCH 15/29] Pass artificial error in cancelAuthorization. --- Source/ARTAuth.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/ARTAuth.m b/Source/ARTAuth.m index 61c970529..a5b40f9a3 100644 --- a/Source/ARTAuth.m +++ b/Source/ARTAuth.m @@ -654,7 +654,7 @@ - (void)authorize:(ARTTokenParams *)tokenParams - (void)cancelAuthorization:(nullable ARTErrorInfo *)error { ARTLogDebug(self.logger, @"RS:%p authorization cancelled with %@", self->_rest, error); - [_cancelationEventEmitter emit:nil with:error]; + [_cancelationEventEmitter emit:nil with:[ARTErrorInfo createWithCode:kCFURLErrorCancelled message:@"Authorization has been canceled..."]]; } - (void)createTokenRequest:(void (^)(ARTTokenRequest *, NSError *))callback { From 1fe30b5c1fbedac6fbbbdb57be3cef0a69dbd05e Mon Sep 17 00:00:00 2001 From: Marat Al Date: Sat, 2 Sep 2023 00:43:36 +0200 Subject: [PATCH 16/29] Revert "Pass artificial error in cancelAuthorization." This reverts commit 04348247a9adaaaa865d63fb53e2f6e906ce6c06. --- Source/ARTAuth.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/ARTAuth.m b/Source/ARTAuth.m index a5b40f9a3..61c970529 100644 --- a/Source/ARTAuth.m +++ b/Source/ARTAuth.m @@ -654,7 +654,7 @@ - (void)authorize:(ARTTokenParams *)tokenParams - (void)cancelAuthorization:(nullable ARTErrorInfo *)error { ARTLogDebug(self.logger, @"RS:%p authorization cancelled with %@", self->_rest, error); - [_cancelationEventEmitter emit:nil with:[ARTErrorInfo createWithCode:kCFURLErrorCancelled message:@"Authorization has been canceled..."]]; + [_cancelationEventEmitter emit:nil with:error]; } - (void)createTokenRequest:(void (^)(ARTTokenRequest *, NSError *))callback { From fcec6f46594327ce3deff962b2a1f91c08f3392a Mon Sep 17 00:00:00 2001 From: Marat Al Date: Sat, 2 Sep 2023 00:44:13 +0200 Subject: [PATCH 17/29] Pass artificial error in cancelationEventEmitter. --- Source/ARTAuth.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/ARTAuth.m b/Source/ARTAuth.m index 61c970529..054987fe3 100644 --- a/Source/ARTAuth.m +++ b/Source/ARTAuth.m @@ -645,7 +645,7 @@ - (void)authorize:(ARTTokenParams *)tokenParams [_cancelationEventEmitter once:^(ARTErrorInfo * _Nullable error) { hasBeenExplicitlyCanceled = YES; - explicitlyCanceledError = error; + explicitlyCanceledError = [ARTErrorInfo createWithCode:kCFURLErrorCancelled message:@"Authorization has been canceled.."]; [task cancel]; }]; From e686fb6929525d2806a5e28568e419864df2f62b Mon Sep 17 00:00:00 2001 From: Marat Al Date: Sat, 2 Sep 2023 01:32:05 +0200 Subject: [PATCH 18/29] Pass artificial error in from other places. --- Source/ARTAuth.m | 2 +- Source/ARTRealtime.m | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/ARTAuth.m b/Source/ARTAuth.m index 054987fe3..2101b2cfb 100644 --- a/Source/ARTAuth.m +++ b/Source/ARTAuth.m @@ -632,7 +632,7 @@ - (void)authorize:(ARTTokenParams *)tokenParams break; case ARTAuthorizationCancelled: { ARTLogDebug(self.logger, @"RS:%p authorization cancelled but the request token has already completed", self->_rest); - canceledCallbackBlock(explicitlyCanceledError); + canceledCallbackBlock(error ?: [ARTErrorInfo createWithCode:kCFURLErrorCancelled message:@"Authorization has been canceled..."]); break; } } diff --git a/Source/ARTRealtime.m b/Source/ARTRealtime.m index 2af64759f..142ed57c5 100644 --- a/Source/ARTRealtime.m +++ b/Source/ARTRealtime.m @@ -255,13 +255,13 @@ - (void)auth:(ARTAuthInternal *)auth didAuthorize:(ARTTokenDetails *)tokenDetail completion(ARTAuthorizationFailed, error); break; case ARTRealtimeSuspended: - completion(ARTAuthorizationFailed, [ARTErrorInfo createWithCode:ARTStateAuthorizationFailed message:@"Connection has been suspended"]); + completion(ARTAuthorizationFailed, error ?: [ARTErrorInfo createWithCode:ARTStateAuthorizationFailed message:@"Connection has been suspended"]); break; case ARTRealtimeClosed: - completion(ARTAuthorizationFailed, [ARTErrorInfo createWithCode:ARTStateAuthorizationFailed message:@"Connection has been closed"]); + completion(ARTAuthorizationFailed, error ?: [ARTErrorInfo createWithCode:ARTStateAuthorizationFailed message:@"Connection has been closed"]); break; case ARTRealtimeDisconnected: - completion(ARTAuthorizationCancelled, nil); + completion(ARTAuthorizationCancelled, error ?: [ARTErrorInfo createWithCode:ARTStateAuthorizationFailed message:@"Connection has been disconnected"]); break; case ARTRealtimeInitialized: case ARTRealtimeConnecting: From 5a3472d91272d80525c676071cb27ae8928cb80b Mon Sep 17 00:00:00 2001 From: Marat Al Date: Sat, 2 Sep 2023 02:26:09 +0200 Subject: [PATCH 19/29] Revert "Pass artificial error in from other places." This reverts commit e686fb6929525d2806a5e28568e419864df2f62b. --- Source/ARTAuth.m | 2 +- Source/ARTRealtime.m | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/ARTAuth.m b/Source/ARTAuth.m index 2101b2cfb..054987fe3 100644 --- a/Source/ARTAuth.m +++ b/Source/ARTAuth.m @@ -632,7 +632,7 @@ - (void)authorize:(ARTTokenParams *)tokenParams break; case ARTAuthorizationCancelled: { ARTLogDebug(self.logger, @"RS:%p authorization cancelled but the request token has already completed", self->_rest); - canceledCallbackBlock(error ?: [ARTErrorInfo createWithCode:kCFURLErrorCancelled message:@"Authorization has been canceled..."]); + canceledCallbackBlock(explicitlyCanceledError); break; } } diff --git a/Source/ARTRealtime.m b/Source/ARTRealtime.m index 142ed57c5..2af64759f 100644 --- a/Source/ARTRealtime.m +++ b/Source/ARTRealtime.m @@ -255,13 +255,13 @@ - (void)auth:(ARTAuthInternal *)auth didAuthorize:(ARTTokenDetails *)tokenDetail completion(ARTAuthorizationFailed, error); break; case ARTRealtimeSuspended: - completion(ARTAuthorizationFailed, error ?: [ARTErrorInfo createWithCode:ARTStateAuthorizationFailed message:@"Connection has been suspended"]); + completion(ARTAuthorizationFailed, [ARTErrorInfo createWithCode:ARTStateAuthorizationFailed message:@"Connection has been suspended"]); break; case ARTRealtimeClosed: - completion(ARTAuthorizationFailed, error ?: [ARTErrorInfo createWithCode:ARTStateAuthorizationFailed message:@"Connection has been closed"]); + completion(ARTAuthorizationFailed, [ARTErrorInfo createWithCode:ARTStateAuthorizationFailed message:@"Connection has been closed"]); break; case ARTRealtimeDisconnected: - completion(ARTAuthorizationCancelled, error ?: [ARTErrorInfo createWithCode:ARTStateAuthorizationFailed message:@"Connection has been disconnected"]); + completion(ARTAuthorizationCancelled, nil); break; case ARTRealtimeInitialized: case ARTRealtimeConnecting: From b94d363244a953d98cad0b1a11d3da45724102c1 Mon Sep 17 00:00:00 2001 From: Marat Al Date: Sat, 2 Sep 2023 02:28:19 +0200 Subject: [PATCH 20/29] Pass error from ARTAuthDelegate.ARTRealtimeDisconnected event. --- Source/ARTAuth.m | 2 +- Source/ARTRealtime.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/ARTAuth.m b/Source/ARTAuth.m index 054987fe3..93db67228 100644 --- a/Source/ARTAuth.m +++ b/Source/ARTAuth.m @@ -632,7 +632,7 @@ - (void)authorize:(ARTTokenParams *)tokenParams break; case ARTAuthorizationCancelled: { ARTLogDebug(self.logger, @"RS:%p authorization cancelled but the request token has already completed", self->_rest); - canceledCallbackBlock(explicitlyCanceledError); + canceledCallbackBlock(error); break; } } diff --git a/Source/ARTRealtime.m b/Source/ARTRealtime.m index 2af64759f..f0cefb30d 100644 --- a/Source/ARTRealtime.m +++ b/Source/ARTRealtime.m @@ -261,7 +261,7 @@ - (void)auth:(ARTAuthInternal *)auth didAuthorize:(ARTTokenDetails *)tokenDetail completion(ARTAuthorizationFailed, [ARTErrorInfo createWithCode:ARTStateAuthorizationFailed message:@"Connection has been closed"]); break; case ARTRealtimeDisconnected: - completion(ARTAuthorizationCancelled, nil); + completion(ARTAuthorizationCancelled, error); break; case ARTRealtimeInitialized: case ARTRealtimeConnecting: From 9a6a77aed15def64f383a43c650fe02b55738ea0 Mon Sep 17 00:00:00 2001 From: Marat Al Date: Sat, 2 Sep 2023 12:57:50 +0200 Subject: [PATCH 21/29] Added assert messages. --- Test/Tests/RealtimeClientChannelTests.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Test/Tests/RealtimeClientChannelTests.swift b/Test/Tests/RealtimeClientChannelTests.swift index e65a20415..ad72a9dc8 100644 --- a/Test/Tests/RealtimeClientChannelTests.swift +++ b/Test/Tests/RealtimeClientChannelTests.swift @@ -2451,7 +2451,7 @@ class RealtimeClientChannelTests: XCTestCase { waitUntil(timeout: testTimeout) { done in rtl6c2TestsChannel.attach { error in - XCTAssertNil(error) + XCTAssertNil(error, "Attach failed.") done() } rtl6c2TestsClient.connect() @@ -2461,7 +2461,7 @@ class RealtimeClientChannelTests: XCTestCase { let tokenParams = ARTTokenParams() tokenParams.ttl = 5.0 rtl6c2TestsClient.auth.authorize(tokenParams, options: nil) { tokenDetails, error in - XCTAssertNil(error) + XCTAssertNil(error, "Authorize failed.") XCTAssertNotNil(tokenDetails) done() } From 0b81033217b0167ae480c5dc2f5c9cb45bb98ed6 Mon Sep 17 00:00:00 2001 From: Marat Al Date: Sat, 2 Sep 2023 14:31:29 +0200 Subject: [PATCH 22/29] Increased ttl of a token. --- Test/Tests/RealtimeClientChannelTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Test/Tests/RealtimeClientChannelTests.swift b/Test/Tests/RealtimeClientChannelTests.swift index ad72a9dc8..3381ab694 100644 --- a/Test/Tests/RealtimeClientChannelTests.swift +++ b/Test/Tests/RealtimeClientChannelTests.swift @@ -2459,7 +2459,7 @@ class RealtimeClientChannelTests: XCTestCase { waitUntil(timeout: testTimeout) { done in let tokenParams = ARTTokenParams() - tokenParams.ttl = 5.0 + tokenParams.ttl = 15.0 rtl6c2TestsClient.auth.authorize(tokenParams, options: nil) { tokenDetails, error in XCTAssertNil(error, "Authorize failed.") XCTAssertNotNil(tokenDetails) From f62c85bf93098362a2d8d8b4dc9b375ce143c387 Mon Sep 17 00:00:00 2001 From: Marat Al Date: Sat, 2 Sep 2023 15:29:00 +0200 Subject: [PATCH 23/29] Increased ttl of a token in all failed tests. --- Test/Tests/RealtimeClientChannelTests.swift | 4 ++-- Test/Tests/RealtimeClientConnectionTests.swift | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Test/Tests/RealtimeClientChannelTests.swift b/Test/Tests/RealtimeClientChannelTests.swift index 3381ab694..1baeb6031 100644 --- a/Test/Tests/RealtimeClientChannelTests.swift +++ b/Test/Tests/RealtimeClientChannelTests.swift @@ -501,7 +501,7 @@ class RealtimeClientChannelTests: XCTestCase { func test__011__Channel__EventEmitter__channel_states_and_events__ChannelStateChange_will_contain_a_resumed_boolean_attribute_with_value__true__if_the_bit_flag_RESUMED_was_included() throws { let test = Test() let options = try AblyTests.commonAppSetup(for: test) - options.tokenDetails = try getTestTokenDetails(for: test, ttl: 5.0) + options.tokenDetails = try getTestTokenDetails(for: test, ttl: 15.0) let client = ARTRealtime(options: options) defer { client.dispose(); client.close() } let channel = client.channels.get(test.uniqueChannelName()) @@ -993,7 +993,7 @@ class RealtimeClientChannelTests: XCTestCase { func test__016__Channel__connection_state__if_the_connection_state_enters_the_DISCONNECTED_state__it_will_have_no_effect_on_the_channel_states() throws { let test = Test() let options = try AblyTests.commonAppSetup(for: test) - options.token = try getTestToken(for: test, ttl: 5.0) + options.token = try getTestToken(for: test, ttl: 15.0) let client = ARTRealtime(options: options) defer { client.dispose(); client.close() } diff --git a/Test/Tests/RealtimeClientConnectionTests.swift b/Test/Tests/RealtimeClientConnectionTests.swift index bce769507..73d625f09 100644 --- a/Test/Tests/RealtimeClientConnectionTests.swift +++ b/Test/Tests/RealtimeClientConnectionTests.swift @@ -1022,7 +1022,7 @@ class RealtimeClientConnectionTests: XCTestCase { let test = Test() let options = try AblyTests.commonAppSetup(for: test) options.clientId = "tester" - options.tokenDetails = try getTestTokenDetails(for: test, key: options.key!, clientId: options.clientId, ttl: 5.0) + options.tokenDetails = try getTestTokenDetails(for: test, key: options.key!, clientId: options.clientId, ttl: 15.0) let client = AblyTests.newRealtime(options).client defer { client.dispose(); client.close() } @@ -2051,7 +2051,7 @@ class RealtimeClientConnectionTests: XCTestCase { options.authCallback = { tokenParams, callback in getTestTokenDetails(for: test, key: options.key, capability: tokenParams.capability, ttl: tokenParams.ttl as! TimeInterval?, completion: callback) } - let tokenTtl = 3.0 + let tokenTtl = 13.0 options.token = try getTestToken(for: test, key: options.key, ttl: tokenTtl) options.testOptions.transportFactory = TestProxyTransportFactory() @@ -2140,7 +2140,7 @@ class RealtimeClientConnectionTests: XCTestCase { let options = try AblyTests.commonAppSetup(for: test) options.autoConnect = false options.testOptions.transportFactory = TestProxyTransportFactory() - let tokenTtl = 3.0 + let tokenTtl = 13.0 let tokenDetails = try getTestTokenDetails(for: test, key: options.key, capability: nil, ttl: tokenTtl) options.token = tokenDetails.token options.authCallback = { _, callback in @@ -3138,7 +3138,7 @@ class RealtimeClientConnectionTests: XCTestCase { let key = options.key // set the key to nil so that the client can't sign further token requests options.key = nil - let tokenTtl = 3.0 + let tokenTtl = 13.0 let tokenDetails = try getTestTokenDetails(for: test, key: key, ttl: tokenTtl) options.token = tokenDetails.token let client = ARTRealtime(options: options) @@ -4361,7 +4361,7 @@ class RealtimeClientConnectionTests: XCTestCase { func test__108__Connection__Operating_System_events_for_network_internet_connectivity_changes__re_authenticate_and_resume_the_connection_when_the_client_is_forcibly_disconnected_following_a_DISCONNECTED_message_containing_an_error_code_greater_than_or_equal_to_40140_and_less_than_40150() throws { let test = Test() let options = try AblyTests.commonAppSetup(for: test) - options.token = try getTestToken(for: test, key: options.key!, ttl: 5.0) + options.token = try getTestToken(for: test, key: options.key!, ttl: 15.0) let client = ARTRealtime(options: options) defer { client.dispose(); client.close() } From dd7aaa21f758dcbce57ea4e4e01be6f9ef0a9584 Mon Sep 17 00:00:00 2001 From: Marat Al Date: Sat, 2 Sep 2023 16:05:36 +0200 Subject: [PATCH 24/29] Revert "Fix message for "test__056..."." This reverts commit 207f35f17a1329db94aeac63f2edb6d92926404d. --- Test/Tests/RealtimeClientConnectionTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Test/Tests/RealtimeClientConnectionTests.swift b/Test/Tests/RealtimeClientConnectionTests.swift index 73d625f09..04c899d51 100644 --- a/Test/Tests/RealtimeClientConnectionTests.swift +++ b/Test/Tests/RealtimeClientConnectionTests.swift @@ -2167,7 +2167,7 @@ class RealtimeClientConnectionTests: XCTestCase { } XCTAssertEqual(reason.code, ARTErrorCode.tokenExpired.intValue) XCTAssertEqual(reason.statusCode, 401) - expect(reason.message).to(contain("Token expired")) + expect(reason.message).to(contain("Key/token status changed (expire)")) partialDone() } client.connect() From a96ad055278e5735c6809c7474e566557e6f7940 Mon Sep 17 00:00:00 2001 From: Marat Al Date: Sat, 2 Sep 2023 16:40:39 +0200 Subject: [PATCH 25/29] Increased waiting timeout. --- Test/Tests/RealtimeClientChannelTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Test/Tests/RealtimeClientChannelTests.swift b/Test/Tests/RealtimeClientChannelTests.swift index 1baeb6031..0d1599d45 100644 --- a/Test/Tests/RealtimeClientChannelTests.swift +++ b/Test/Tests/RealtimeClientChannelTests.swift @@ -2467,7 +2467,7 @@ class RealtimeClientChannelTests: XCTestCase { } } - waitUntil(timeout: testTimeout) { done in + waitUntil(timeout: testTimeout.multiplied(by: 2)) { done in rtl6c2TestsClient.connection.once(.disconnected) { _ in done() } From 0c103a5dc7c7f1617b2fdf259a9c692d634bed95 Mon Sep 17 00:00:00 2001 From: Marat Al Date: Sat, 2 Sep 2023 17:53:18 +0200 Subject: [PATCH 26/29] Increased waiting timeout more. --- Test/Tests/RealtimeClientChannelTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Test/Tests/RealtimeClientChannelTests.swift b/Test/Tests/RealtimeClientChannelTests.swift index 0d1599d45..59c9f673a 100644 --- a/Test/Tests/RealtimeClientChannelTests.swift +++ b/Test/Tests/RealtimeClientChannelTests.swift @@ -2467,7 +2467,7 @@ class RealtimeClientChannelTests: XCTestCase { } } - waitUntil(timeout: testTimeout.multiplied(by: 2)) { done in + waitUntil(timeout: testTimeout.multiplied(by: 3)) { done in rtl6c2TestsClient.connection.once(.disconnected) { _ in done() } From 50eb19841443bf7a4b8217e77777f9b66b8e6738 Mon Sep 17 00:00:00 2001 From: Marat Al Date: Sat, 2 Sep 2023 19:32:49 +0200 Subject: [PATCH 27/29] Play with ttl time. --- Test/Tests/RealtimeClientChannelTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Test/Tests/RealtimeClientChannelTests.swift b/Test/Tests/RealtimeClientChannelTests.swift index 59c9f673a..1ca360b01 100644 --- a/Test/Tests/RealtimeClientChannelTests.swift +++ b/Test/Tests/RealtimeClientChannelTests.swift @@ -2459,7 +2459,7 @@ class RealtimeClientChannelTests: XCTestCase { waitUntil(timeout: testTimeout) { done in let tokenParams = ARTTokenParams() - tokenParams.ttl = 15.0 + tokenParams.ttl = 10.0 rtl6c2TestsClient.auth.authorize(tokenParams, options: nil) { tokenDetails, error in XCTAssertNil(error, "Authorize failed.") XCTAssertNotNil(tokenDetails) From e8ca8358dfc78944e41653d396aa68a8ebe6aa74 Mon Sep 17 00:00:00 2001 From: Marat Al Date: Sat, 2 Sep 2023 23:23:57 +0200 Subject: [PATCH 28/29] Reverted ttl and timeout. --- Test/Tests/RealtimeClientChannelTests.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Test/Tests/RealtimeClientChannelTests.swift b/Test/Tests/RealtimeClientChannelTests.swift index 1ca360b01..f51f0626c 100644 --- a/Test/Tests/RealtimeClientChannelTests.swift +++ b/Test/Tests/RealtimeClientChannelTests.swift @@ -2459,7 +2459,7 @@ class RealtimeClientChannelTests: XCTestCase { waitUntil(timeout: testTimeout) { done in let tokenParams = ARTTokenParams() - tokenParams.ttl = 10.0 + tokenParams.ttl = 5.0 rtl6c2TestsClient.auth.authorize(tokenParams, options: nil) { tokenDetails, error in XCTAssertNil(error, "Authorize failed.") XCTAssertNotNil(tokenDetails) @@ -2467,7 +2467,7 @@ class RealtimeClientChannelTests: XCTestCase { } } - waitUntil(timeout: testTimeout.multiplied(by: 3)) { done in + waitUntil(timeout: testTimeout) { done in rtl6c2TestsClient.connection.once(.disconnected) { _ in done() } From 245d77a35d3ef7907c20ac7a47749db71e4ad824 Mon Sep 17 00:00:00 2001 From: Marat Al Date: Fri, 8 Sep 2023 21:03:36 +0200 Subject: [PATCH 29/29] Made "test__081..." similar to "test__080..." and do what its title says. --- Test/Tests/RealtimeClientChannelTests.swift | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Test/Tests/RealtimeClientChannelTests.swift b/Test/Tests/RealtimeClientChannelTests.swift index f51f0626c..c85540d90 100644 --- a/Test/Tests/RealtimeClientChannelTests.swift +++ b/Test/Tests/RealtimeClientChannelTests.swift @@ -2449,6 +2449,23 @@ class RealtimeClientChannelTests: XCTestCase { let test = Test() try beforeEach__Channel__publish__Connection_state_conditions__the_message(for: test, channelName: test.uniqueChannelName()) + rtl6c2TestsClient.connect() + expect(rtl6c2TestsClient.connection.state).toEventually(equal(ARTRealtimeConnectionState.connected), timeout: testTimeout) + expect(rtl6c2TestsChannel.state).toEventually(equal(ARTRealtimeChannelState.attached), timeout: testTimeout) + + waitUntil(timeout: testTimeout) { done in + rtl16c2TestsPublish(done) + XCTAssertEqual(rtl6c2TestsClient.internal.queuedMessages.count, 0) + XCTAssertEqual((rtl6c2TestsClient.internal.transport as! TestProxyTransport).protocolMessagesSent.filter { $0.action == .message }.count, 1) + } + + afterEach__Channel__publish__Connection_state_conditions__the_message() + } + + func skip_test__081__Channel__publish__Connection_state_conditions__the_message__should_NOT_be_queued_instead_it_should_be_published_if_the_channel_is__ATTACHED() throws { + let test = Test() + try beforeEach__Channel__publish__Connection_state_conditions__the_message(for: test, channelName: test.uniqueChannelName()) + waitUntil(timeout: testTimeout) { done in rtl6c2TestsChannel.attach { error in XCTAssertNil(error, "Attach failed.")