Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // chats contain meta information about the chat like last message and count of unread messages
- let chatRef = ref.child("chats").child(receiverId).child(chatId)
- chatRef.observeSingleEventOfType(.Value, withBlock: { (snapshot) -> Void in
- if !snapshot.exists() {
- print("snapshot eists")
- // the other side has deleted the chat
- // now delete all messages and member objects
- ref.child("messages").child(chatId).setValue(nil)
- ref.child("members").child(chatId).setValue(nil)
- } else {
- print("snapshot does not exist")
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement