Skip to content

Instantly share code, notes, and snippets.

@mischa-hildebrand
Created October 25, 2018 11:45
Show Gist options
  • Save mischa-hildebrand/a5b885928f00b751937a46a240c6add4 to your computer and use it in GitHub Desktop.
Save mischa-hildebrand/a5b885928f00b751937a46a240c6add4 to your computer and use it in GitHub Desktop.
Add Message
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