diff --git a/Session/Conversations/ConversationVC.swift b/Session/Conversations/ConversationVC.swift index 35f5e1dde..cec77ffda 100644 --- a/Session/Conversations/ConversationVC.swift +++ b/Session/Conversations/ConversationVC.swift @@ -351,11 +351,11 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversat for update in conversationUpdate.updateItems! { switch update.updateItemType { case .delete: - self.messagesTableView.deleteRows(at: [ IndexPath(row: Int(update.oldIndex), section: 0) ], with: .fade) + self.messagesTableView.deleteRows(at: [ IndexPath(row: Int(update.oldIndex), section: 0) ], with: .none) case .insert: print("[Test] INSERT") // Perform inserts before updates - self.messagesTableView.insertRows(at: [ IndexPath(row: Int(update.newIndex), section: 0) ], with: .fade) + self.messagesTableView.insertRows(at: [ IndexPath(row: Int(update.newIndex), section: 0) ], with: .none) if update.viewItem?.interaction is TSOutgoingMessage { shouldScrollToBottom = true } else { @@ -368,14 +368,16 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversat } } } - messagesTableView.performBatchUpdates(batchUpdates) { _ in + UIView.performWithoutAnimation { + messagesTableView.performBatchUpdates(batchUpdates) { _ in + if shouldScrollToBottom { + self.scrollToBottom(isAnimated: false) + } + self.markAllAsRead() + } if shouldScrollToBottom { - self.scrollToBottom(isAnimated: true) + self.scrollToBottom(isAnimated: false) } - self.markAllAsRead() - } - if shouldScrollToBottom { - self.scrollToBottom(isAnimated: false) } } diff --git a/SessionMessagingKit/Sending & Receiving/MessageSender.swift b/SessionMessagingKit/Sending & Receiving/MessageSender.swift index 4994a13a1..b9ef948c7 100644 --- a/SessionMessagingKit/Sending & Receiving/MessageSender.swift +++ b/SessionMessagingKit/Sending & Receiving/MessageSender.swift @@ -330,19 +330,16 @@ public final class MessageSender : NSObject { if let tsMessage = TSOutgoingMessage.find(withTimestamp: message.sentTimestamp!) { // Track the open group server message ID tsMessage.openGroupServerMessageID = message.openGroupServerMessageID ?? 0 - tsMessage.save(with: transaction) // Mark the message as sent var recipients = [ message.recipient! ] if case .closedGroup(_) = destination, let threadID = message.threadID, // threadID should always be set at this point let thread = TSGroupThread.fetch(uniqueId: threadID, transaction: transaction), thread.isClosedGroup { recipients = thread.groupModel.groupMemberIds } - if !tsMessage.wasSentToAnyRecipient { - recipients.forEach { recipient in - tsMessage.update(withSentRecipient: recipient, wasSentByUD: true, transaction: transaction) - } - MessageInvalidator.invalidate(tsMessage, with: transaction) + recipients.forEach { recipient in + tsMessage.update(withSentRecipient: recipient, wasSentByUD: true, transaction: transaction) } + tsMessage.save(with: transaction) // Start the disappearing messages timer if needed OWSDisappearingMessagesJob.shared().startAnyExpiration(for: tsMessage, expirationStartedAt: NSDate.millisecondTimestamp(), transaction: transaction) }