Fix animation glitch
This commit is contained in:
parent
b8c4e6aa93
commit
50d17be43b
|
@ -351,11 +351,11 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversat
|
||||||
for update in conversationUpdate.updateItems! {
|
for update in conversationUpdate.updateItems! {
|
||||||
switch update.updateItemType {
|
switch update.updateItemType {
|
||||||
case .delete:
|
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:
|
case .insert:
|
||||||
print("[Test] INSERT")
|
print("[Test] INSERT")
|
||||||
// Perform inserts before updates
|
// 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 {
|
if update.viewItem?.interaction is TSOutgoingMessage {
|
||||||
shouldScrollToBottom = true
|
shouldScrollToBottom = true
|
||||||
} else {
|
} else {
|
||||||
|
@ -368,14 +368,16 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
messagesTableView.performBatchUpdates(batchUpdates) { _ in
|
UIView.performWithoutAnimation {
|
||||||
if shouldScrollToBottom {
|
messagesTableView.performBatchUpdates(batchUpdates) { _ in
|
||||||
self.scrollToBottom(isAnimated: true)
|
if shouldScrollToBottom {
|
||||||
|
self.scrollToBottom(isAnimated: false)
|
||||||
|
}
|
||||||
|
self.markAllAsRead()
|
||||||
|
}
|
||||||
|
if shouldScrollToBottom {
|
||||||
|
self.scrollToBottom(isAnimated: false)
|
||||||
}
|
}
|
||||||
self.markAllAsRead()
|
|
||||||
}
|
|
||||||
if shouldScrollToBottom {
|
|
||||||
self.scrollToBottom(isAnimated: false)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -330,19 +330,16 @@ public final class MessageSender : NSObject {
|
||||||
if let tsMessage = TSOutgoingMessage.find(withTimestamp: message.sentTimestamp!) {
|
if let tsMessage = TSOutgoingMessage.find(withTimestamp: message.sentTimestamp!) {
|
||||||
// Track the open group server message ID
|
// Track the open group server message ID
|
||||||
tsMessage.openGroupServerMessageID = message.openGroupServerMessageID ?? 0
|
tsMessage.openGroupServerMessageID = message.openGroupServerMessageID ?? 0
|
||||||
tsMessage.save(with: transaction)
|
|
||||||
// Mark the message as sent
|
// Mark the message as sent
|
||||||
var recipients = [ message.recipient! ]
|
var recipients = [ message.recipient! ]
|
||||||
if case .closedGroup(_) = destination, let threadID = message.threadID, // threadID should always be set at this point
|
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 {
|
let thread = TSGroupThread.fetch(uniqueId: threadID, transaction: transaction), thread.isClosedGroup {
|
||||||
recipients = thread.groupModel.groupMemberIds
|
recipients = thread.groupModel.groupMemberIds
|
||||||
}
|
}
|
||||||
if !tsMessage.wasSentToAnyRecipient {
|
recipients.forEach { recipient in
|
||||||
recipients.forEach { recipient in
|
tsMessage.update(withSentRecipient: recipient, wasSentByUD: true, transaction: transaction)
|
||||||
tsMessage.update(withSentRecipient: recipient, wasSentByUD: true, transaction: transaction)
|
|
||||||
}
|
|
||||||
MessageInvalidator.invalidate(tsMessage, with: transaction)
|
|
||||||
}
|
}
|
||||||
|
tsMessage.save(with: transaction)
|
||||||
// Start the disappearing messages timer if needed
|
// Start the disappearing messages timer if needed
|
||||||
OWSDisappearingMessagesJob.shared().startAnyExpiration(for: tsMessage, expirationStartedAt: NSDate.millisecondTimestamp(), transaction: transaction)
|
OWSDisappearingMessagesJob.shared().startAnyExpiration(for: tsMessage, expirationStartedAt: NSDate.millisecondTimestamp(), transaction: transaction)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue