Skip to content

Commit 6254e20

Browse files
Bump protocol version to v6 and add plugin compatibility checks
This implements the protocol-version-bumping process proposed in the pinned plugin-support commit. Note that all of the v6 changes are LiveObjects-related, hence no other changes in ably-cocoa. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 14d2661 commit 6254e20

File tree

10 files changed

+21
-11
lines changed

10 files changed

+21
-11
lines changed

Package.resolved

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ let package = Package(
1919
.package(name: "msgpack", url: "https://github.com/rvi/msgpack-objective-C", from: "0.4.0"),
2020
.package(name: "AblyDeltaCodec", url: "https://github.com/ably/delta-codec-cocoa", from: "1.3.5"),
2121
.package(name: "Nimble", url: "https://github.com/quick/nimble", from: "11.2.2"),
22-
.package(name: "ably-cocoa-plugin-support", url: "https://github.com/ably/ably-cocoa-plugin-support", from: "1.0.0")
22+
// TODO: Unpin before release
23+
.package(name: "ably-cocoa-plugin-support", url: "https://github.com/ably/ably-cocoa-plugin-support", .revision("c20f969"))
2324
],
2425
targets: [
2526
.target(

Source/ARTClientOptions.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,10 @@ - (NSString *)host:(NSString *)host forEnvironment:(NSString *)environment {
251251
return nil;
252252
}
253253

254-
return [publicPlugin internalPlugin];
254+
id<APLiveObjectsInternalPluginProtocol> plugin = [publicPlugin internalPlugin];
255+
NSAssert(plugin.compatibleWithProtocolV6,
256+
@"This version of ably-cocoa requires a LiveObjects plugin compatible with protocol v6.");
257+
return plugin;
255258
}
256259
#endif
257260

Source/ARTDefault.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#import "ARTNSArray+ARTFunctional.h"
44
#import "ARTClientInformation+Private.h"
55

6-
static NSString *const ARTDefault_apiVersion = @"5"; // CSV2
6+
static NSString *const ARTDefault_apiVersion = @"6"; // CSV2
77

88
NSString *const ARTDefaultProduction = @"production";
99

Source/ARTPluginAPI.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ static ARTLogLevel _convertPluginLogLevel(APLogLevel pluginLogLevel) {
9393

9494
@implementation ARTPluginAPI
9595

96+
- (BOOL)usesLiveObjectsProtocolV6 {
97+
return YES;
98+
}
99+
96100
+ (void)registerSelf {
97101
static dispatch_once_t onceToken;
98102
dispatch_once(&onceToken, ^{

Test/AblyTests/Tests/ARTDefaultTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Ably.ARTDefault // System under Test
55
class ARTDefaultTests: XCTestCase {
66

77
func testVersions() {
8-
XCTAssertEqual(ARTDefault.apiVersion(), "5")
8+
XCTAssertEqual(ARTDefault.apiVersion(), "6")
99
XCTAssertEqual(ARTDefault.libraryVersion(), "1.2.58")
1010
}
1111
}

Test/AblyTests/Tests/PluginAPITests.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ class PluginAPITests: XCTestCase {
1515
}
1616

1717
class MockInternalLiveObjectsPlugin: NSObject, _AblyPluginSupportPrivate.LiveObjectsInternalPluginProtocol {
18+
var compatibleWithProtocolV6: Bool { true }
19+
1820
internal var receivedConnectionDetails: [(connectionDetails: (any ConnectionDetailsProtocol)?, channel: any RealtimeChannel)] = []
1921

2022
func nosync_prepare(_ channel: any RealtimeChannel, client: any RealtimeClient) {

Test/AblyTests/Tests/RealtimeClientConnectionTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ class RealtimeClientConnectionTests: XCTestCase {
342342

343343
// This test should not directly validate version against ARTDefault.version(), as
344344
// ultimately the version header has been derived from that value.
345-
expect(webSocketTransport.websocketURL?.query).to(haveParam("v", withValue: "5"))
345+
expect(webSocketTransport.websocketURL?.query).to(haveParam("v", withValue: "6"))
346346

347347
done()
348348
}

Test/AblyTests/Tests/RealtimeClientTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class RealtimeClientTests: XCTestCase {
5050

5151
// This test should not directly validate version against ARTDefault.version(), as
5252
// ultimately the version header has been derived from that value.
53-
expect(transport.lastUrl!.query).to(haveParam("v", withValue: "5"))
53+
expect(transport.lastUrl!.query).to(haveParam("v", withValue: "6"))
5454

5555
done()
5656
}

Test/AblyTests/Tests/RestClientTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ class RestClientTests: XCTestCase {
163163

164164
// This test should not directly validate version against ARTDefault.version(), as
165165
// ultimately the version header has been derived from that value.
166-
XCTAssertEqual(version, "5")
166+
XCTAssertEqual(version, "6")
167167

168168
done()
169169
}
@@ -1744,7 +1744,7 @@ class RestClientTests: XCTestCase {
17441744

17451745
// This test should not directly validate version against ARTDefault.version(), as
17461746
// ultimately the version header has been derived from that value.
1747-
XCTAssertEqual(headerAblyVersion, "5")
1747+
XCTAssertEqual(headerAblyVersion, "6")
17481748

17491749
done()
17501750
}

0 commit comments

Comments
 (0)