Skip to content

Commit 32bf2b8

Browse files
committed
Revert iOS added logic to previous one
1 parent fd42dcb commit 32bf2b8

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

apple/InlineIOS/Chat/MessagesCollectionView.swift

+7-5
Original file line numberDiff line numberDiff line change
@@ -363,19 +363,21 @@ private extension MessagesCollectionView {
363363
case let .added(newMessages, _):
364364
// get current snapshot and append new items
365365
var snapshot = dataSource.snapshot()
366-
let existingIds = Set(snapshot.itemIdentifiers)
366+
// let existingIds = Set(snapshot.itemIdentifiers)
367367
let newIds = newMessages.map(\.id)
368-
let missingIds = newIds.filter { !existingIds.contains($0) }
368+
// let missingIds = newIds.filter { !existingIds.contains($0) }
369369

370-
guard !missingIds.isEmpty else { return }
370+
// guard !missingIds.isEmpty else { return }
371371
let shouldScroll = newMessages.contains {
372372
$0.message.fromId == Auth.shared.getCurrentUserId()
373373
}
374374

375375
if let first = snapshot.itemIdentifiers.first {
376-
snapshot.insertItems(missingIds, beforeItem: first)
376+
// snapshot.insertItems(missingIds, beforeItem: first)
377+
snapshot.insertItems(newIds, beforeItem: first)
377378
} else {
378-
snapshot.appendItems(missingIds, toSection: .main)
379+
// snapshot.appendItems(missingIds, toSection: .main)
380+
snapshot.appendItems(newIds, toSection: .main)
379381
}
380382

381383
// Mark as read if we're at bottom or message is from current user

0 commit comments

Comments
 (0)