@@ -137,7 +137,6 @@ final class ProductVariationsViewController: UIViewController {
137137 super. viewDidLoad ( )
138138
139139 configureNavigationBarTitle ( )
140- configureNavigationBarButtons ( )
141140 configureMainView ( )
142141 configureTableView ( )
143142 configureSyncingCoordinator ( )
@@ -169,15 +168,27 @@ private extension ProductVariationsViewController {
169168 )
170169 }
171170
172- /// Sets the navigation bar buttons
171+ /// Shows or hides the "more" navigation bar button.
173172 ///
174- func configureNavigationBarButtons ( ) {
173+ func showOrHideMoreActionsNavigationBarButton ( ) {
175174 guard featureFlagService. isFeatureFlagEnabled ( . bulkEditProductVariations) && resultsController. fetchedObjects. isNotEmpty else {
176175 // Do not display the "more" button with the bulk update option if we do not have any variations
177- navigationItem . rightBarButtonItem = nil
176+ hideMoreActionsNavigationBarButton ( )
178177 return
179178 }
180179
180+ showMoreActionsNavigationBarButton ( )
181+ }
182+
183+ /// Hides the "more" navigation bar button.
184+ ///
185+ func hideMoreActionsNavigationBarButton( ) {
186+ navigationItem. rightBarButtonItem = nil
187+ }
188+
189+ /// Shows the "more" navigation bar button.
190+ ///
191+ func showMoreActionsNavigationBarButton( ) {
181192 navigationItem. rightBarButtonItem = UIBarButtonItem ( image: . moreImage,
182193 style: . plain,
183194 target: self ,
@@ -361,7 +372,7 @@ private extension ProductVariationsViewController {
361372 func configureResultsControllerEventHandling( _ resultsController: ResultsController < StorageProductVariation > ) {
362373 let onReload = { [ weak self] in
363374 self ? . tableView. reloadData ( )
364- self ? . configureNavigationBarButtons ( )
375+ self ? . showOrHideMoreActionsNavigationBarButton ( )
365376 }
366377
367378 resultsController. onDidChangeContent = { [ weak tableView] in
@@ -686,8 +697,9 @@ private extension ProductVariationsViewController {
686697 case . noResultsPlaceholder:
687698 break
688699 case . syncing( let pageNumber) :
689- if pageNumber == SyncingCoordinator . Defaults . pageFirstIndex {
700+ if pageNumber == syncingCoordinator . pageFirstIndex {
690701 displayPlaceholderProducts ( )
702+ hideMoreActionsNavigationBarButton ( )
691703 } else {
692704 ensureFooterSpinnerIsStarted ( )
693705 }
@@ -701,6 +713,7 @@ private extension ProductVariationsViewController {
701713 case . syncing:
702714 ensureFooterSpinnerIsStopped ( )
703715 removePlaceholderProducts ( )
716+ showOrHideMoreActionsNavigationBarButton ( )
704717 case . noResultsPlaceholder, . results:
705718 break
706719 }
@@ -737,7 +750,7 @@ extension ProductVariationsViewController {
737750 return false
738751 }
739752
740- return highestPageBeingSynced * SyncingCoordinator . Defaults . pageSize > resultsController. numberOfObjects
753+ return highestPageBeingSynced * syncingCoordinator . pageSize > resultsController. numberOfObjects
741754 }
742755
743756 /// Stops animating the Footer Spinner.
0 commit comments