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
In the rest of the SDK, we've not provided event filters on subscription
events - this is a fairly trivial thing for users to write (if/switch).
Also, when dealing with multiple events in the list, the if/switch is
required anyway and in many languages must be exhaustive, so the real
benefit is when you're listening to a single event (but still marginal).
Furthermore, the overloading is somewhat cumbersome to maintain.
This change removes the event filtering for presence.
* Subscribes a given listener to all presence events.
77
+
* Subscribes a given listener to all presence events in the chat room.
78
78
*
79
79
* Note that it is a programmer error to call this method if presence events are not enabled in the room options. Make sure to set `enableEvents: true` in your room's presence options to use this feature (this is the default value).
80
80
*
@@ -86,34 +86,6 @@ public protocol Presence: AnyObject, Sendable {
* Subscribes a given listener to a particular presence event in the chat room.
91
-
*
92
-
* Note that it is a programmer error to call this method if presence events are not enabled in the room options. Make sure to set `enableEvents: true` in your room's presence options to use this feature (this is the default value).
93
-
*
94
-
* - Parameters:
95
-
* - event: A single presence event type ``PresenceEventType`` to subscribe to.
96
-
* - callback: The listener closure for capturing room ``PresenceEvent`` events.
97
-
*
98
-
* - Returns: A subscription that can be used to unsubscribe from ``PresenceEvent`` events.
* Subscribes a given listener to different presence events in the chat room.
105
-
*
106
-
* Note that it is a programmer error to call this method if presence events are not enabled in the room options. Make sure to set `enableEvents: true` in your room's presence options to use this feature (this is the default value).
107
-
*
108
-
* - Parameters:
109
-
* - events: An array of presence event types ``PresenceEventType`` to subscribe to.
110
-
* - callback: The listener closure for capturing room ``PresenceEvent`` events.
111
-
*
112
-
* - Returns: A subscription that can be used to unsubscribe from ``PresenceEvent`` events.
* Method to join room presence, will emit an enter event to all subscribers. Repeat calls will trigger more enter events.
119
91
* In oppose to ``enter(data:)`` it doesn't publish any custom presence data.
@@ -142,7 +114,7 @@ public protocol Presence: AnyObject, Sendable {
142
114
// swiftlint:disable:next missing_docs
143
115
publicextensionPresence{
144
116
/**
145
-
* Subscribes to all presence events.
117
+
* Subscribes to all presence events in the chat room.
146
118
*
147
119
* Note that it is a programmer error to call this method if presence events are not enabled in the room options. Make sure to set `enableEvents: true` in your room's presence options to use this feature (this is the default value).
148
120
*
@@ -167,74 +139,10 @@ public extension Presence {
167
139
return subscriptionAsyncSequence
168
140
}
169
141
170
-
/**
171
-
* Subscribes a given listener to a particular presence event in the chat room.
172
-
*
173
-
* Note that it is a programmer error to call this method if presence events are not enabled in the room options. Make sure to set `enableEvents: true` in your room's presence options to use this feature (this is the default value).
174
-
*
175
-
* - Parameters:
176
-
* - event: A single presence event type ``PresenceEventType`` to subscribe to.
177
-
* - bufferingPolicy: The ``BufferingPolicy`` for the created subscription.
178
-
*
179
-
* - Returns: A subscription `AsyncSequence` that can be used to iterate through ``PresenceEvent`` events.
letsubscription=subscribe(event: event){ presence in
185
-
subscriptionAsyncSequence.emit(presence)
186
-
}
187
-
188
-
subscriptionAsyncSequence.addTerminationHandler{
189
-
Task{@MainActorin
190
-
subscription.unsubscribe()
191
-
}
192
-
}
193
-
194
-
return subscriptionAsyncSequence
195
-
}
196
-
197
-
/**
198
-
* Subscribes a given listener to different presence events in the chat room.
199
-
*
200
-
* Note that it is a programmer error to call this method if presence events are not enabled in the room options. Make sure to set `enableEvents: true` in your room's presence options to use this feature (this is the default value).
201
-
*
202
-
* - Parameters:
203
-
* - events: An array of presence event types ``PresenceEventType`` to subscribe to.
204
-
* - bufferingPolicy: The ``BufferingPolicy`` for the created subscription.
205
-
*
206
-
* - Returns: A subscription `AsyncSequence` that can be used to iterate through ``PresenceEvent`` events.
0 commit comments