Skip to content

Commit

Permalink
Code review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
michalrentka committed Dec 3, 2024
1 parent 596ab95 commit b9ae603
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ final class ItemDetailCollectionViewHandler: NSObject {

let toReload = rowsToReload(from: oldRows, to: newRows, in: section)
if !toReload.isEmpty {
snapshot.reloadItems(toReload)
snapshot.reconfigureItems(toReload)
}

dataSource.apply(snapshot, animatingDifferences: animated)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,9 @@ final class PDFAnnotationsViewController: UIViewController {
var snapshot = NSDiffableDataSourceSnapshot<Int, PDFReaderState.AnnotationKey>()
snapshot.appendSections([0])
snapshot.appendItems(viewModel.state.sortedKeys)
dataSource.apply(snapshot, animatingDifferences: false)
if let key = viewModel.state.focusSidebarKey, let indexPath = dataSource.indexPath(for: key) {
inMainThread { [weak self] in
self?.tableView.selectRow(at: indexPath, animated: false, scrollPosition: .middle)
}
dataSource.apply(snapshot, animatingDifferences: false) { [weak self] in
guard let self, let key = viewModel.state.focusSidebarKey, let indexPath = dataSource.indexPath(for: key) else { return }
tableView.selectRow(at: indexPath, animated: false, scrollPosition: .middle)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class PDFThumbnailsViewController: UICollectionViewController {
guard let self else { return }
var snapshot = dataSource.snapshot()
let label = dataSource.snapshot().itemIdentifiers[index]
snapshot.reloadItems([label])
snapshot.reconfigureItems([label])
dataSource.apply(snapshot)
}
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,7 @@ class CollectionsPickerViewController: UICollectionViewController {
guard let self else { return }
dataSource.apply(state.collectionTree.createSnapshot(collapseState: .expandedAll), to: 0, animatingDifferences: animated) { [weak self] in
guard let self, multipleSelectionAllowed else { return }
inMainThread { [weak self] in
self?.select(selected: state.selected, tree: state.collectionTree)
}
select(selected: state.selected, tree: state.collectionTree)
}
}
}
Expand Down

0 comments on commit b9ae603

Please sign in to comment.