Skip to content

Commit

Permalink
When a message is hard deleted, make sure to reload the previous cell
Browse files Browse the repository at this point in the history
  • Loading branch information
nuno-vieira committed Aug 17, 2022
1 parent 12e1d5a commit 6492e7d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Sources/StreamChatUI/ChatMessageList/ChatMessageListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,17 @@ open class ChatMessageListView: UITableView, Customizable, ComponentsProvider {
self?.reloadRows(at: [movedIndexPath], with: .none)
}
}

// When there are deletions, we should update the previous message, so that we add the
// avatar image back and the timestamp too. Since we have an inverted list, the previous
// message has the same index of the deleted message after the deletion has been executed.
let visibleRemoves = changes.filter {
$0.isRemove && self?.indexPathsForVisibleRows?.contains($0.indexPath) == true
}
visibleRemoves.forEach {
self?.reloadRows(at: [$0.indexPath], with: .none)
}

completion?()
}
)
Expand Down

0 comments on commit 6492e7d

Please sign in to comment.