Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UTS chat adapter #90

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/unified-test-suite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Unified Test Suite

on:
pull_request:
push:
branches:
- main

jobs:
unified-test-suite:
runs-on: macos-15
maratal marked this conversation as resolved.
Show resolved Hide resolved
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20

- run: npm ci

- name: Install uts-chat globally
run: npm install -g @ably-labs/uts-chat

# This step can be removed once the runners' default version of Xcode is 16 or above
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 16

- name: Prepare Adapter
working-directory: UTSChatAdapter
run: swift build --target Adapter

- name: Run uts-chat with ADAPTER_EXECUTABLE
env:
ADAPTER_EXECUTABLE: cd UTSChatAdapter && swift run UTSChatAdapter
run: uts-chat
maratal marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
excluded:
- .build
- UTSChatAdapter/Sources/Adapter/NanoID.swift

strict: true

Expand Down
3 changes: 3 additions & 0 deletions AblyChat.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion AblyChat.xcworkspace/xcshareddata/swiftpm/Package.resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "a296396707b7685153f4cf548f6281f483d562002fe11235f1fc3bb053be91d7",
"originHash" : "1ad2d7338668d15feccbf564582941161acd47349bfca8f34374e11c69677ae8",
"pins" : [
{
"identity" : "ably-cocoa",
Expand Down
2 changes: 1 addition & 1 deletion Sources/AblyChat/ChatClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public actor DefaultChatClient: ChatClient {
}

maratal marked this conversation as resolved.
Show resolved Hide resolved
public nonisolated var clientID: String {
fatalError("Not yet implemented")
realtime.clientId ?? "<Noname>"
}
}

Expand Down
4 changes: 4 additions & 0 deletions Sources/AblyChat/DefaultMessages.swift
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ internal final class DefaultMessages: Messages, EmitsDiscontinuities {
}
}

if channel.state == .initialized {
channel.attach()
}

// (CHA-M5b) If a subscription is added when the underlying realtime channel is in any other state, then its subscription point becomes the attachSerial at the the point of channel attachment.
return try await timeserialOnChannelAttach()
}
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
13 changes: 13 additions & 0 deletions UTSChatAdapter/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Start of .gitignore created by Swift Package Manager
.DS_Store
/.build
/Packages
xcuserdata/
DerivedData/
.swiftpm/configuration/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
# End of .gitignore created by Swift Package Manager

/node_modules
/.mint
51 changes: 51 additions & 0 deletions UTSChatAdapter/Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"originHash" : "1e440d9500a61178defdb136b0459b00cd00a3c57aa142d698fd712060f7b673",
"pins" : [
{
"identity" : "ably-cocoa",
"kind" : "remoteSourceControl",
"location" : "https://github.com/ably/ably-cocoa",
"state" : {
"branch" : "main",
"revision" : "f7bff4b1c941b4c7b952b9224a33674e2302e19f"
}
},
{
"identity" : "delta-codec-cocoa",
"kind" : "remoteSourceControl",
"location" : "https://github.com/ably/delta-codec-cocoa",
"state" : {
"revision" : "3ee62ea40a63996b55818d44b3f0e56d8753be88",
"version" : "1.3.3"
}
},
{
"identity" : "msgpack-objective-c",
"kind" : "remoteSourceControl",
"location" : "https://github.com/rvi/msgpack-objective-C",
"state" : {
"revision" : "3e36b48e04ecd756cb927bd5f5b9bf6d45e475f9",
"version" : "0.4.0"
}
},
{
"identity" : "swift-async-algorithms",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-async-algorithms",
"state" : {
"revision" : "5c8bd186f48c16af0775972700626f0b74588278",
"version" : "1.0.2"
}
},
{
"identity" : "swift-collections",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections.git",
"state" : {
"revision" : "671108c96644956dddcd89dd59c203dcdb36cec7",
"version" : "1.1.4"
}
}
],
"version" : 3
}
45 changes: 45 additions & 0 deletions UTSChatAdapter/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// swift-tools-version: 6.0

import PackageDescription

let package = Package(
name: "UTSChatAdapter",
platforms: [
.macOS(.v13),
.iOS(.v14),
.tvOS(.v14),
],
products: [
.executable(
name: "UTSChatAdapter",
targets: [
"Adapter",
]
),
.executable(
name: "UTSChatAdapterGenerator",
targets: [
"Generator",
]
),
],
dependencies: [
.package(
path: "../" // AblyChat
),
],
targets: [
.executableTarget(
name: "Adapter",
dependencies: [
.product(
name: "AblyChat",
package: "ably-chat-swift"
),
]
),
.executableTarget(
name: "Generator"
),
]
)
Loading
Loading