You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Sources/AblyChat/Room.swift
+17-1Lines changed: 17 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -79,6 +79,11 @@ public protocol Room<Channel>: AnyObject, Sendable {
79
79
*/
80
80
varstatus:RoomStatus{get}
81
81
82
+
/**
83
+
* The current error, if any, that caused the room to enter the current status.
84
+
*/
85
+
varerror:ARTErrorInfo?{get}
86
+
82
87
/**
83
88
* Subscribes a given listener to the room status changes.
84
89
*
@@ -216,12 +221,19 @@ public struct RoomStatusChange: Sendable {
216
221
*/
217
222
publicvarprevious:RoomStatus
218
223
224
+
/**
225
+
* An error that provides a reason why the room has
226
+
* entered the new status, if applicable.
227
+
*/
228
+
publicvarerror:ARTErrorInfo?
229
+
219
230
/// Memberwise initializer to create a `RoomStatusChange`.
220
231
///
221
232
/// - Note: You should not need to use this initializer when using the Chat SDK. It is exposed only to allow users to create mock versions of the SDK's protocols.
Copy file name to clipboardExpand all lines: Sources/AblyChat/RoomStatus.swift
+6-104Lines changed: 6 additions & 104 deletions
Original file line number
Diff line number
Diff line change
@@ -12,32 +12,32 @@ public enum RoomStatus: Sendable {
12
12
/**
13
13
* The library is currently attempting to attach the room.
14
14
*/
15
-
case attaching(error:ARTErrorInfo?)
15
+
case attaching
16
16
17
17
/**
18
18
* The room is currently attached and receiving events.
19
19
*/
20
-
case attached(error:ARTErrorInfo?)
20
+
case attached
21
21
22
22
/**
23
23
* The room is currently detaching and will not receive events.
24
24
*/
25
-
case detaching(error:ARTErrorInfo?)
25
+
case detaching
26
26
27
27
/**
28
28
* The room is currently detached and will not receive events.
29
29
*/
30
-
case detached(error:ARTErrorInfo?)
30
+
case detached
31
31
32
32
/**
33
33
* The room is in an extended state of detachment, but will attempt to re-attach when able.
34
34
*/
35
-
case suspended(error:ARTErrorInfo)
35
+
case suspended
36
36
37
37
/**
38
38
* The room is currently detached and will not attempt to re-attach. User intervention is required.
39
39
*/
40
-
case failed(error:ARTErrorInfo)
40
+
case failed
41
41
42
42
/**
43
43
* The room is in the process of releasing. Attempting to use a room in this state may result in undefined behavior.
@@ -48,102 +48,4 @@ public enum RoomStatus: Sendable {
48
48
* The room has been released and is no longer usable.
49
49
*/
50
50
case released
51
-
52
-
internalvarerror:ARTErrorInfo?{
53
-
switchself{
54
-
caselet.attaching(error):
55
-
error
56
-
caselet.attached(error):
57
-
error
58
-
caselet.detaching(error):
59
-
error
60
-
caselet.detached(error):
61
-
error
62
-
caselet.suspended(error):
63
-
error
64
-
caselet.failed(error):
65
-
error
66
-
case.initialized,
67
-
.releasing,
68
-
.released:
69
-
nil
70
-
}
71
-
}
72
-
73
-
// Helpers to allow us to test whether a `RoomStatus` value has a certain case, without caring about the associated value. These are useful for in contexts where we want to use a `Bool` to communicate a case. For example:
74
-
//
75
-
// 1. testing (e.g. `#expect(status.isFailed)`)
76
-
// 2. testing that a status does _not_ have a particular case (e.g. if !status.isFailed), which a `case` statement cannot succinctly express
0 commit comments