File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -209,12 +209,16 @@ public class CallState: ObservableObject {
209
209
case let . typeCallSessionEndedEvent( event) :
210
210
update ( from: event. call)
211
211
case let . typeCallSessionParticipantJoinedEvent( event) :
212
- if session? . participants. contains ( event. participant) == false {
212
+ if let index = session? . participants. firstIndex ( where: {
213
+ $0. userSessionId == event. participant. userSessionId
214
+ } ) , index < ( session? . participants. count ?? 0 ) {
215
+ session? . participants [ index] = event. participant
216
+ } else {
213
217
session? . participants. append ( event. participant)
214
218
}
215
219
case let . typeCallSessionParticipantLeftEvent( event) :
216
220
session? . participants. removeAll ( where: { participant in
217
- participant == event. participant
221
+ participant. userSessionId == event. participant. userSessionId
218
222
} )
219
223
case let . typeCallSessionStartedEvent( event) :
220
224
update ( from: event. call)
You can’t perform that action at this time.
0 commit comments