Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Fix #8255: Reordering Favourites shows duplicated items (#8314)
Browse files Browse the repository at this point in the history
  • Loading branch information
soner-yuksel committed Oct 26, 2023
1 parent 5a82064 commit a2836da
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1232,13 +1232,21 @@ extension NewTabPageViewController: UICollectionViewDragDelegate, UICollectionVi

if coordinator.proposal.operation == .move {
guard let item = coordinator.items.first else { return }
_ = coordinator.drop(item.dragItem, toItemAt: destinationIndexPath)

guard let favouritesSection = sections.firstIndex(where: { $0 is FavoritesSectionProvider }) else {
return
}

Favorite.reorder(
sourceIndexPath: sourceIndexPath,
destinationIndexPath: destinationIndexPath,
isInteractiveDragReorder: true
)
_ = coordinator.drop(item.dragItem, toItemAt: destinationIndexPath)

UIView.performWithoutAnimation {
self.collectionView.reloadSections(IndexSet(integer: favouritesSection))
}

}
}
Expand Down

0 comments on commit a2836da

Please sign in to comment.