Skip to content

Commit

Permalink
😅 Session join/leave fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
benlmyers committed Sep 18, 2022
1 parent f4dc0b1 commit d141ea4
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions Sources/EasyFirebase/Services/Auth/EasyUser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -605,11 +605,7 @@ public extension EasyUser {
completion(session, nil)
return
}
EasyFirestore.Updating.append(\S.users, with: self.id, in: session) { error in
guard error == nil else {
completion(nil, SessionError.communicationError)
return
}
Firestore.firestore().collection(String(describing: type)).document(id).updateData(["users": FieldValue.arrayUnion([self.id])]) { error in
completion(session, nil)
}
}
Expand Down Expand Up @@ -662,7 +658,7 @@ public extension EasyUser {
}
self.sessions.removeValue(forKey: session.typeName)
EasyFirestore.Listening.stop("_session_\(session.id)")
EasyFirestore.Updating.remove(\S.users, taking: self.id, in: session) { error in
Firestore.firestore().collection(String(describing: type(of: session))).document(session.id).updateData(["users": FieldValue.arrayRemove([self.id])]) { error in
guard error == nil else {
completion(SessionError.leaveError)
return
Expand Down

0 comments on commit d141ea4

Please sign in to comment.