Skip to content

Commit dd41f6f

Browse files
Update for renamed AblyPlugin -> _AblyPluginSupportPrivate
TODO I think some stuff got messed up in the rename; e.g. method names
1 parent 1ae1dee commit dd41f6f

38 files changed

+141
-141
lines changed

.cursor/rules/swift.mdc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ When writing Swift:
1414
- When writing a JSON string, favour using Swift raw string literals instead of escaping double quotes.
1515
- When you need to import the following modules inside the AblyLiveObjects library code (that is, in non-test code), do so in the following way:
1616
- Ably: use `import Ably`
17-
- AblyPlugin: use `internal import AblyPlugin`
17+
- _AblyPluginSupportPrivate: use `internal import _AblyPluginSupportPrivate`
1818
- When writing an array literal that starts with an initializer expression, start the initializer expression on the line after the opening square bracket of the array literal. That is, instead of writing:
1919
```swift
2020
objectMessages: [InboundObjectMessage(

.cursor/rules/testing.mdc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ When writing tests:
1414
- When you need to import the following modules in the tests, do so in the following way:
1515
- Ably: use `import Ably`
1616
- AblyLiveObjects: use `@testable import AblyLiveObjects`
17-
- AblyPlugin: use `import AblyPlugin`; _do not_ do `internal import`
17+
- _AblyPluginSupportPrivate: use `import _AblyPluginSupportPrivate`; _do not_ do `internal import`
1818
- When you need to pass a logger to internal components in the tests, pass `TestLogger()`.
1919
- When you need to unwrap an optional value in the tests, favour using `#require` instead of `guard let`.
2020
- When creating `testsOnly_` property declarations, do not write generic comments of the form "Test-only access to the private createOperationIsMerged property"; the meaning of these properties is already well understood.

AblyLiveObjects.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ let package = Package(
4747
package: "ably-cocoa",
4848
),
4949
.product(
50-
name: "AblyPlugin",
50+
name: "_AblyPluginSupportPrivate",
5151
package: "ably-cocoa",
5252
),
5353
],
@@ -61,7 +61,7 @@ let package = Package(
6161
package: "ably-cocoa",
6262
),
6363
.product(
64-
name: "AblyPlugin",
64+
name: "_AblyPluginSupportPrivate",
6565
package: "ably-cocoa",
6666
),
6767
],

Sources/AblyLiveObjects/Internal/ARTClientOptions+Objects.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
internal import AblyPlugin
1+
internal import _AblyPluginSupportPrivate
22

33
internal extension ARTClientOptions {
44
private class Box<T> {

Sources/AblyLiveObjects/Internal/CoreSDK.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
internal import _AblyPluginSupportPrivate
12
import Ably
2-
internal import AblyPlugin
33

44
/// The API that the internal components of the SDK (that is, `DefaultLiveObjects` and down) use to interact with our core SDK (i.e. ably-cocoa).
55
///
6-
/// This provides us with a mockable interface to ably-cocoa, and it also allows internal components and their tests not to need to worry about some of the boring details of how we bridge Swift types to AblyPlugin's Objective-C API (i.e. boxing).
6+
/// This provides us with a mockable interface to ably-cocoa, and it also allows internal components and their tests not to need to worry about some of the boring details of how we bridge Swift types to _AblyPluginSupportPrivate's Objective-C API (i.e. boxing).
77
internal protocol CoreSDK: AnyObject, Sendable {
88
/// Implements the internal `#publish` method of RTO15.
99
func publish(objectMessages: [OutboundObjectMessage]) async throws(InternalError)
@@ -21,10 +21,10 @@ internal final class DefaultCoreSDK: CoreSDK {
2121
/// Used to synchronize access to internal mutable state.
2222
private let mutex = NSLock()
2323

24-
private let channel: AblyPlugin.RealtimeChannel
25-
private let client: AblyPlugin.RealtimeClient
24+
private let channel: _AblyPluginSupportPrivate.RealtimeChannel
25+
private let client: _AblyPluginSupportPrivate.RealtimeClient
2626
private let pluginAPI: PluginAPIProtocol
27-
private let logger: AblyPlugin.Logger
27+
private let logger: _AblyPluginSupportPrivate.Logger
2828

2929
/// If set to true, ``publish(objectMessages:)`` will behave like a no-op.
3030
///
@@ -34,10 +34,10 @@ internal final class DefaultCoreSDK: CoreSDK {
3434
private nonisolated(unsafe) var overriddenPublishImplementation: (([OutboundObjectMessage]) async throws -> Void)?
3535

3636
internal init(
37-
channel: AblyPlugin.RealtimeChannel,
38-
client: AblyPlugin.RealtimeClient,
37+
channel: _AblyPluginSupportPrivate.RealtimeChannel,
38+
client: _AblyPluginSupportPrivate.RealtimeClient,
3939
pluginAPI: PluginAPIProtocol,
40-
logger: AblyPlugin.Logger
40+
logger: _AblyPluginSupportPrivate.Logger
4141
) {
4242
self.channel = channel
4343
self.client = client

Sources/AblyLiveObjects/Internal/DefaultInternalPlugin.swift

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
internal import AblyPlugin
1+
internal import _AblyPluginSupportPrivate
22

3-
// We explicitly import the NSObject class, else it seems to get transitively imported from `internal import AblyPlugin`, leading to the error "Class cannot be declared public because its superclass is internal".
3+
// We explicitly import the NSObject class, else it seems to get transitively imported from `internal import _AblyPluginSupportPrivate`, leading to the error "Class cannot be declared public because its superclass is internal".
44
import ObjectiveC.NSObject
55

6-
/// The default implementation of `AblyPlugin`'s `LiveObjectsInternalPluginProtocol`. Implements the interface that ably-cocoa uses to access the functionality provided by the LiveObjects plugin.
6+
/// The default implementation of `_AblyPluginSupportPrivate`'s `LiveObjectsInternalPluginProtocol`. Implements the interface that ably-cocoa uses to access the functionality provided by the LiveObjects plugin.
77
@objc
8-
internal final class DefaultInternalPlugin: NSObject, AblyPlugin.LiveObjectsInternalPluginProtocol {
9-
private let pluginAPI: AblyPlugin.PluginAPIProtocol
8+
internal final class DefaultInternalPlugin: NSObject, _AblyPluginSupportPrivate.LiveObjectsInternalPluginProtocol {
9+
private let pluginAPI: _AblyPluginSupportPrivate.PluginAPIProtocol
1010

11-
internal init(pluginAPI: AblyPlugin.PluginAPIProtocol) {
11+
internal init(pluginAPI: _AblyPluginSupportPrivate.PluginAPIProtocol) {
1212
self.pluginAPI = pluginAPI
1313
}
1414

@@ -20,7 +20,7 @@ internal final class DefaultInternalPlugin: NSObject, AblyPlugin.LiveObjectsInte
2020
/// Retrieves the `RealtimeObjects` for this channel.
2121
///
2222
/// We expect this value to have been previously set by ``prepare(_:)``.
23-
internal static func realtimeObjects(for channel: AblyPlugin.RealtimeChannel, pluginAPI: AblyPlugin.PluginAPIProtocol) -> InternalDefaultRealtimeObjects {
23+
internal static func realtimeObjects(for channel: _AblyPluginSupportPrivate.RealtimeChannel, pluginAPI: _AblyPluginSupportPrivate.PluginAPIProtocol) -> InternalDefaultRealtimeObjects {
2424
guard let pluginData = pluginAPI.pluginDataValue(forKey: pluginDataKey, channel: channel) else {
2525
// InternalPlugin.prepare was not called
2626
fatalError("To access LiveObjects functionality, you must pass the LiveObjects plugin in the client options when creating the ARTRealtime instance: `clientOptions.plugins = [.liveObjects: AblyLiveObjects.Plugin.self]`")
@@ -33,7 +33,7 @@ internal final class DefaultInternalPlugin: NSObject, AblyPlugin.LiveObjectsInte
3333
// MARK: - LiveObjectsInternalPluginProtocol
3434

3535
// Populates the channel's `objects` property.
36-
internal func prepare(_ channel: AblyPlugin.RealtimeChannel, client: AblyPlugin.RealtimeClient) {
36+
internal func prepare(_ channel: _AblyPluginSupportPrivate.RealtimeChannel, client: _AblyPluginSupportPrivate.RealtimeClient) {
3737
let logger = pluginAPI.logger(for: channel)
3838
let callbackQueue = pluginAPI.callbackQueue(for: client)
3939
let options = pluginAPI.options(for: client)
@@ -49,14 +49,14 @@ internal final class DefaultInternalPlugin: NSObject, AblyPlugin.LiveObjectsInte
4949
}
5050

5151
/// Retrieves the internally-typed `objects` property for the channel.
52-
private func realtimeObjects(for channel: AblyPlugin.RealtimeChannel) -> InternalDefaultRealtimeObjects {
52+
private func realtimeObjects(for channel: _AblyPluginSupportPrivate.RealtimeChannel) -> InternalDefaultRealtimeObjects {
5353
Self.realtimeObjects(for: channel, pluginAPI: pluginAPI)
5454
}
5555

5656
/// A class that wraps an object message.
5757
///
58-
/// We need this intermediate type because we want object messages to be structs — because they're nicer to work with internally — but a struct can't conform to the class-bound `AblyPlugin.ObjectMessageProtocol`.
59-
private final class ObjectMessageBox<T>: AblyPlugin.ObjectMessageProtocol where T: Sendable {
58+
/// We need this intermediate type because we want object messages to be structs — because they're nicer to work with internally — but a struct can't conform to the class-bound `_AblyPluginSupportPrivate.ObjectMessageProtocol`.
59+
private final class ObjectMessageBox<T>: _AblyPluginSupportPrivate.ObjectMessageProtocol where T: Sendable {
6060
internal let objectMessage: T
6161

6262
init(objectMessage: T) {
@@ -70,7 +70,7 @@ internal final class DefaultInternalPlugin: NSObject, AblyPlugin.LiveObjectsInte
7070
format: EncodingFormat,
7171
error errorPtr: AutoreleasingUnsafeMutablePointer<ARTErrorInfo?>?,
7272
) -> (any ObjectMessageProtocol)? {
73-
let wireObject = WireValue.objectFromAblyPluginData(serialized)
73+
let wireObject = WireValue.objectFrom_AblyPluginSupportPrivateData(serialized)
7474

7575
do {
7676
let wireObjectMessage = try InboundWireObjectMessage(
@@ -89,22 +89,22 @@ internal final class DefaultInternalPlugin: NSObject, AblyPlugin.LiveObjectsInte
8989
}
9090

9191
internal func encodeObjectMessage(
92-
_ publicObjectMessage: any AblyPlugin.ObjectMessageProtocol,
92+
_ publicObjectMessage: any _AblyPluginSupportPrivate.ObjectMessageProtocol,
9393
format: EncodingFormat,
9494
) -> [String: Any] {
9595
guard let outboundObjectMessageBox = publicObjectMessage as? ObjectMessageBox<OutboundObjectMessage> else {
9696
preconditionFailure("Expected to receive the same OutboundObjectMessage type as we emit")
9797
}
9898

9999
let wireObjectMessage = outboundObjectMessageBox.objectMessage.toWire(format: format)
100-
return wireObjectMessage.toWireObject.toAblyPluginDataDictionary
100+
return wireObjectMessage.toWireObject.to_AblyPluginSupportPrivateDataDictionary
101101
}
102102

103-
internal func onChannelAttached(_ channel: AblyPlugin.RealtimeChannel, hasObjects: Bool) {
103+
internal func onChannelAttached(_ channel: _AblyPluginSupportPrivate.RealtimeChannel, hasObjects: Bool) {
104104
realtimeObjects(for: channel).onChannelAttached(hasObjects: hasObjects)
105105
}
106106

107-
internal func handleObjectProtocolMessage(withObjectMessages publicObjectMessages: [any AblyPlugin.ObjectMessageProtocol], channel: AblyPlugin.RealtimeChannel) {
107+
internal func handleObjectProtocolMessage(withObjectMessages publicObjectMessages: [any _AblyPluginSupportPrivate.ObjectMessageProtocol], channel: _AblyPluginSupportPrivate.RealtimeChannel) {
108108
guard let inboundObjectMessageBoxes = publicObjectMessages as? [ObjectMessageBox<InboundObjectMessage>] else {
109109
preconditionFailure("Expected to receive the same InboundObjectMessage type as we emit")
110110
}
@@ -116,7 +116,7 @@ internal final class DefaultInternalPlugin: NSObject, AblyPlugin.LiveObjectsInte
116116
)
117117
}
118118

119-
internal func handleObjectSyncProtocolMessage(withObjectMessages publicObjectMessages: [any AblyPlugin.ObjectMessageProtocol], protocolMessageChannelSerial: String?, channel: AblyPlugin.RealtimeChannel) {
119+
internal func handleObjectSyncProtocolMessage(withObjectMessages publicObjectMessages: [any _AblyPluginSupportPrivate.ObjectMessageProtocol], protocolMessageChannelSerial: String?, channel: _AblyPluginSupportPrivate.RealtimeChannel) {
120120
guard let inboundObjectMessageBoxes = publicObjectMessages as? [ObjectMessageBox<InboundObjectMessage>] else {
121121
preconditionFailure("Expected to receive the same InboundObjectMessage type as we emit")
122122
}
@@ -133,8 +133,8 @@ internal final class DefaultInternalPlugin: NSObject, AblyPlugin.LiveObjectsInte
133133

134134
internal static func sendObject(
135135
objectMessages: [OutboundObjectMessage],
136-
channel: AblyPlugin.RealtimeChannel,
137-
client: AblyPlugin.RealtimeClient,
136+
channel: _AblyPluginSupportPrivate.RealtimeChannel,
137+
client: _AblyPluginSupportPrivate.RealtimeClient,
138138
pluginAPI: PluginAPIProtocol,
139139
) async throws(InternalError) {
140140
let objectMessageBoxes: [ObjectMessageBox<OutboundObjectMessage>] = objectMessages.map { .init(objectMessage: $0) }

Sources/AblyLiveObjects/Internal/InternalDefaultLiveCounter.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
internal import _AblyPluginSupportPrivate
12
import Ably
2-
internal import AblyPlugin
33
import Foundation
44

55
/// This provides the implementation behind ``PublicDefaultLiveCounter``, via internal versions of the ``LiveCounter`` API.
@@ -21,7 +21,7 @@ internal final class InternalDefaultLiveCounter: Sendable {
2121
}
2222
}
2323

24-
private let logger: AblyPlugin.Logger
24+
private let logger: _AblyPluginSupportPrivate.Logger
2525
private let userCallbackQueue: DispatchQueue
2626
private let clock: SimpleClock
2727

@@ -30,7 +30,7 @@ internal final class InternalDefaultLiveCounter: Sendable {
3030
internal convenience init(
3131
testsOnly_data data: Double,
3232
objectID: String,
33-
logger: AblyPlugin.Logger,
33+
logger: _AblyPluginSupportPrivate.Logger,
3434
userCallbackQueue: DispatchQueue,
3535
clock: SimpleClock
3636
) {
@@ -40,7 +40,7 @@ internal final class InternalDefaultLiveCounter: Sendable {
4040
private init(
4141
data: Double,
4242
objectID: String,
43-
logger: AblyPlugin.Logger,
43+
logger: _AblyPluginSupportPrivate.Logger,
4444
userCallbackQueue: DispatchQueue,
4545
clock: SimpleClock
4646
) {
@@ -56,7 +56,7 @@ internal final class InternalDefaultLiveCounter: Sendable {
5656
/// - objectID: The value for the "private objectId field" of RTO5c1b1a.
5757
internal static func createZeroValued(
5858
objectID: String,
59-
logger: AblyPlugin.Logger,
59+
logger: _AblyPluginSupportPrivate.Logger,
6060
userCallbackQueue: DispatchQueue,
6161
clock: SimpleClock,
6262
) -> Self {

Sources/AblyLiveObjects/Internal/InternalDefaultLiveMap.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
internal import _AblyPluginSupportPrivate
12
import Ably
2-
internal import AblyPlugin
33

44
/// Protocol for accessing objects from the ObjectsPool. This is used by a LiveMap when it needs to return an object given an object ID.
55
internal protocol LiveMapObjectPoolDelegate: AnyObject, Sendable {
@@ -38,7 +38,7 @@ internal final class InternalDefaultLiveMap: Sendable {
3838
}
3939
}
4040

41-
private let logger: AblyPlugin.Logger
41+
private let logger: _AblyPluginSupportPrivate.Logger
4242
private let userCallbackQueue: DispatchQueue
4343
private let clock: SimpleClock
4444

@@ -48,7 +48,7 @@ internal final class InternalDefaultLiveMap: Sendable {
4848
testsOnly_data data: [String: InternalObjectsMapEntry],
4949
objectID: String,
5050
testsOnly_semantics semantics: WireEnum<ObjectsMapSemantics>? = nil,
51-
logger: AblyPlugin.Logger,
51+
logger: _AblyPluginSupportPrivate.Logger,
5252
userCallbackQueue: DispatchQueue,
5353
clock: SimpleClock,
5454
) {
@@ -66,7 +66,7 @@ internal final class InternalDefaultLiveMap: Sendable {
6666
data: [String: InternalObjectsMapEntry],
6767
objectID: String,
6868
semantics: WireEnum<ObjectsMapSemantics>?,
69-
logger: AblyPlugin.Logger,
69+
logger: _AblyPluginSupportPrivate.Logger,
7070
userCallbackQueue: DispatchQueue,
7171
clock: SimpleClock,
7272
) {
@@ -84,7 +84,7 @@ internal final class InternalDefaultLiveMap: Sendable {
8484
internal static func createZeroValued(
8585
objectID: String,
8686
semantics: WireEnum<ObjectsMapSemantics>? = nil,
87-
logger: AblyPlugin.Logger,
87+
logger: _AblyPluginSupportPrivate.Logger,
8888
userCallbackQueue: DispatchQueue,
8989
clock: SimpleClock,
9090
) -> Self {
@@ -398,7 +398,7 @@ internal final class InternalDefaultLiveMap: Sendable {
398398
using state: ObjectState,
399399
objectMessageSerialTimestamp: Date?,
400400
objectsPool: inout ObjectsPool,
401-
logger: AblyPlugin.Logger,
401+
logger: _AblyPluginSupportPrivate.Logger,
402402
clock: SimpleClock,
403403
userCallbackQueue: DispatchQueue,
404404
) -> LiveObjectUpdate<DefaultLiveMapUpdate> {
@@ -467,7 +467,7 @@ internal final class InternalDefaultLiveMap: Sendable {
467467
internal mutating func mergeInitialValue(
468468
from operation: ObjectOperation,
469469
objectsPool: inout ObjectsPool,
470-
logger: AblyPlugin.Logger,
470+
logger: _AblyPluginSupportPrivate.Logger,
471471
userCallbackQueue: DispatchQueue,
472472
clock: SimpleClock,
473473
) -> LiveObjectUpdate<DefaultLiveMapUpdate> {
@@ -621,7 +621,7 @@ internal final class InternalDefaultLiveMap: Sendable {
621621
operationTimeserial: String?,
622622
operationData: ObjectData?,
623623
objectsPool: inout ObjectsPool,
624-
logger: AblyPlugin.Logger,
624+
logger: _AblyPluginSupportPrivate.Logger,
625625
userCallbackQueue: DispatchQueue,
626626
clock: SimpleClock,
627627
) -> LiveObjectUpdate<DefaultLiveMapUpdate> {
@@ -744,7 +744,7 @@ internal final class InternalDefaultLiveMap: Sendable {
744744
internal mutating func applyMapCreateOperation(
745745
_ operation: ObjectOperation,
746746
objectsPool: inout ObjectsPool,
747-
logger: AblyPlugin.Logger,
747+
logger: _AblyPluginSupportPrivate.Logger,
748748
userCallbackQueue: DispatchQueue,
749749
clock: SimpleClock,
750750
) -> LiveObjectUpdate<DefaultLiveMapUpdate> {

Sources/AblyLiveObjects/Internal/InternalDefaultRealtimeObjects.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
internal import _AblyPluginSupportPrivate
12
import Ably
2-
internal import AblyPlugin
33

44
/// This provides the implementation behind ``PublicDefaultRealtimeObjects``, via internal versions of the ``RealtimeObjects`` API.
55
internal final class InternalDefaultRealtimeObjects: Sendable, LiveMapObjectPoolDelegate {
@@ -8,7 +8,7 @@ internal final class InternalDefaultRealtimeObjects: Sendable, LiveMapObjectPool
88

99
private nonisolated(unsafe) var mutableState: MutableState!
1010

11-
private let logger: AblyPlugin.Logger
11+
private let logger: _AblyPluginSupportPrivate.Logger
1212
private let userCallbackQueue: DispatchQueue
1313
private let clock: SimpleClock
1414

@@ -91,7 +91,7 @@ internal final class InternalDefaultRealtimeObjects: Sendable, LiveMapObjectPool
9191
}
9292
}
9393

94-
internal init(logger: AblyPlugin.Logger, userCallbackQueue: DispatchQueue, clock: SimpleClock, garbageCollectionOptions: GarbageCollectionOptions = .init()) {
94+
internal init(logger: _AblyPluginSupportPrivate.Logger, userCallbackQueue: DispatchQueue, clock: SimpleClock, garbageCollectionOptions: GarbageCollectionOptions = .init()) {
9595
self.logger = logger
9696
self.userCallbackQueue = userCallbackQueue
9797
self.clock = clock

0 commit comments

Comments
 (0)