Skip to content

Commit

Permalink
Temporary chat framework fixes (for tests to run without crashes/hangs).
Browse files Browse the repository at this point in the history
  • Loading branch information
maratal committed Nov 12, 2024
1 parent 9b55d26 commit c98e7de
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Sources/AblyChat/ChatClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public actor DefaultChatClient: ChatClient {
}

public nonisolated var clientID: String {
fatalError("Not yet implemented")
realtime.clientId ?? "<Noname>"
}
}

Expand Down
4 changes: 2 additions & 2 deletions Sources/AblyChat/DefaultMessages.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ internal final class DefaultMessages: Messages, EmitsDiscontinuities {
// (CHA-M4) Messages can be received via a subscription in realtime.
internal func subscribe(bufferingPolicy: BufferingPolicy) async throws -> MessageSubscription {
let uuid = UUID()
let timeserial = try await resolveSubscriptionStart()
let timeserial = channel.properties.channelSerial
let messageSubscription = MessageSubscription(
bufferingPolicy: bufferingPolicy
) { [weak self] queryOptions in
Expand All @@ -44,7 +44,7 @@ internal final class DefaultMessages: Messages, EmitsDiscontinuities {
}

// (CHA-M4a) A subscription can be registered to receive incoming messages. Adding a subscription has no side effects on the status of the room or the underlying realtime channel.
subscriptionPoints[uuid] = .init(subscription: messageSubscription, timeserial: timeserial)
subscriptionPoints[uuid] = .init(subscription: messageSubscription, timeserial: timeserial ?? "")

// (CHA-M4c) When a realtime message with name set to message.created is received, it is translated into a message event, which contains a type field with the event type as well as a message field containing the Message Struct. This event is then broadcast to all subscribers.
// (CHA-M4d) If a realtime message with an unknown name is received, the SDK shall silently discard the message, though it may log at DEBUG or TRACE level.
Expand Down
2 changes: 1 addition & 1 deletion Sources/AblyChat/Errors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public enum ErrorCode: Int {
/// ``Rooms.get(roomID:options:)`` was called with a different set of room options than was used on a previous call. You must first release the existing room instance using ``Rooms.release(roomID:)``.
///
/// TODO this code is a guess, revisit in https://github.com/ably-labs/ably-chat-swift/issues/32
case inconsistentRoomOptions = 1
case inconsistentRoomOptions = 40000

case messagesAttachmentFailed = 102_001
case presenceAttachmentFailed = 102_002
Expand Down

0 comments on commit c98e7de

Please sign in to comment.