From 07ffb72e30da914645470934ba1eef3761f9bdc6 Mon Sep 17 00:00:00 2001 From: Lawrence Forooghian Date: Tue, 1 Oct 2024 18:24:15 -0300 Subject: [PATCH] Perform analogous change to 64c0315 for Connection Same motivation. Resolves #73. --- Sources/AblyChat/Connection.swift | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Sources/AblyChat/Connection.swift b/Sources/AblyChat/Connection.swift index c53e954e..d7b31bf8 100644 --- a/Sources/AblyChat/Connection.swift +++ b/Sources/AblyChat/Connection.swift @@ -1,17 +1,17 @@ import Ably public protocol Connection: AnyObject, Sendable { - var status: any ConnectionStatus { get } + var lifecycle: any ConnectionLifecycle { get } } -public protocol ConnectionStatus: AnyObject, Sendable { - var current: ConnectionLifecycle { get } +public protocol ConnectionLifecycle: AnyObject, Sendable { + var status: ConnectionStatus { get } // TODO: (https://github.com/ably-labs/ably-chat-swift/issues/12): consider how to avoid the need for an unwrap var error: ARTErrorInfo? { get } func onChange(bufferingPolicy: BufferingPolicy) -> Subscription } -public enum ConnectionLifecycle: Sendable { +public enum ConnectionStatus: Sendable { case initialized case connecting case connected @@ -21,13 +21,13 @@ public enum ConnectionLifecycle: Sendable { } public struct ConnectionStatusChange: Sendable { - public var current: ConnectionLifecycle - public var previous: ConnectionLifecycle + public var current: ConnectionStatus + public var previous: ConnectionStatus // TODO: (https://github.com/ably-labs/ably-chat-swift/issues/12): consider how to avoid the need for an unwrap public var error: ARTErrorInfo? public var retryIn: TimeInterval - public init(current: ConnectionLifecycle, previous: ConnectionLifecycle, error: ARTErrorInfo? = nil, retryIn: TimeInterval) { + public init(current: ConnectionStatus, previous: ConnectionStatus, error: ARTErrorInfo? = nil, retryIn: TimeInterval) { self.current = current self.previous = previous self.error = error