@@ -73,7 +73,7 @@ final class ProductsViewController: UIViewController, GhostableViewController {
7373 didSet {
7474 bottomToolbar. isHidden = true
7575 bottomToolbar. backgroundColor = . systemColor( . secondarySystemGroupedBackground)
76- bottomToolbar. setSubviews ( leftViews: [ ] , rightViews: [ bulkEditButton] )
76+ bottomToolbar. setSubviews ( leftViews: [ selectAllButton ] , rightViews: [ bulkEditButton] )
7777 bottomToolbar. addDividerOnTop ( )
7878 }
7979 }
@@ -105,6 +105,18 @@ final class ProductsViewController: UIViewController, GhostableViewController {
105105 return button
106106 } ( )
107107
108+ /// The select all CTA in the bottom toolbar.
109+ private lazy var selectAllButton : UIButton = {
110+ let button = UIButton ( frame: . zero)
111+ button. setTitle ( Localization . selectAllToolbarButtonTitle, for: . normal)
112+ button. addTarget ( self , action: #selector( selectAllProducts) , for: . touchUpInside)
113+ button. applyLinkButtonStyle ( )
114+ var configuration = UIButton . Configuration. plain ( )
115+ configuration. contentInsets = Constants . toolbarButtonInsets
116+ button. configuration = configuration
117+ return button
118+ } ( )
119+
108120 /// Container of the top banner that shows that the Products feature is still work in progress.
109121 ///
110122 private lazy var topBannerContainerView : SwappableSubviewContainerView = SwappableSubviewContainerView ( )
@@ -333,6 +345,12 @@ private extension ProductsViewController {
333345 bulkEditButton. isEnabled = viewModel. bulkEditActionIsEnabled
334346 }
335347
348+ @objc func selectAllProducts( ) {
349+ viewModel. selectProducts ( resultsController. fetchedObjects)
350+ updatedSelectedItems ( )
351+ tableView. reloadRows ( at: tableView. indexPathsForVisibleRows ?? [ ] , with: . none)
352+ }
353+
336354 @objc func openBulkEditingOptions( sender: UIButton ) {
337355 let actionSheet = UIAlertController ( title: nil , message: nil , preferredStyle: . actionSheet)
338356
@@ -1305,6 +1323,10 @@ private extension ProductsViewController {
13051323 comment: " VoiceOver accessibility hint, informing the user the button can be used to bulk edit products "
13061324 )
13071325
1326+ static let selectAllToolbarButtonTitle = NSLocalizedString (
1327+ " Select all " ,
1328+ comment: " Title of a button that selects all products for bulk update "
1329+ )
13081330 static let bulkEditingToolbarButtonTitle = NSLocalizedString (
13091331 " Bulk update " ,
13101332 comment: " Title of a button that presents a menu with possible products bulk update options "
0 commit comments