From 8a00fc42bf3289b2e9b87dcd82ce83a153eb3887 Mon Sep 17 00:00:00 2001 From: kevinzhow Date: Sun, 31 May 2015 19:28:40 +0800 Subject: [PATCH] Fix logic for send state --- .../Conversation/ConversationViewController.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Yep/ViewControllers/Conversation/ConversationViewController.swift b/Yep/ViewControllers/Conversation/ConversationViewController.swift index 2f584e3d..41385b7d 100644 --- a/Yep/ViewControllers/Conversation/ConversationViewController.swift +++ b/Yep/ViewControllers/Conversation/ConversationViewController.swift @@ -1534,7 +1534,6 @@ extension ConversationViewController: UICollectionViewDataSource, UICollectionVi updateMessageReadStatesChangeOperation() - case MessageStateOperationType.Sent.rawValue: // println("Message Sent") removeSendStates() @@ -1630,6 +1629,7 @@ extension ConversationViewController: UICollectionViewDataSource, UICollectionVi self.realm.beginWrite() if let sendState = sendStates.last { sendState.sendState = MessageSendState.Read.rawValue + message.sendState = MessageSendState.Read.rawValue sendState.updatedAt = NSDate() } self.realm.commitWrite() @@ -1642,6 +1642,8 @@ extension ConversationViewController: UICollectionViewDataSource, UICollectionVi if let cell = conversationCollectionView.cellForItemAtIndexPath(indexPath) as? ChatStateCell { + println("Config Chat State Cell \(cell.stateLabel.text)") + configChatStateWithMessage(message, cell: cell) } else { @@ -1667,6 +1669,8 @@ extension ConversationViewController: UICollectionViewDataSource, UICollectionVi } else { cell.stateLabel.text = "\(MessageSendState(rawValue: message.sendState)!.description) \(sectionDateFormatter.stringFromDate(message.updatedAt))" } + + cell.setNeedsDisplay() } func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {