Created
October 25, 2018 11:45
-
-
Save mischa-hildebrand/a5b885928f00b751937a46a240c6add4 to your computer and use it in GitHub Desktop.
Add Message
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private func add(_ message: Message, direction: Message.CommunicationDirection) { | |
let conversationId = conversationIdFor(message: message, direction: direction) | |
if let existingConverstion = conversations[conversationId] { | |
existingConverstion.append(message) | |
} else { | |
let newConversation = Conversation(user: conversationId) | |
newConversation.append(message) | |
conversations[conversationId] = newConversation | |
} | |
delegate?.dataStoreDidReceiveNewMessage(forConversationWith: conversationId) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment