@@ -54,10 +54,6 @@ final class OrdersRootViewController: UIViewController {
5454 }
5555 }
5656
57- /// Stores status for order creation availability.
58- ///
59- private var isOrderCreationEnabled : Bool = false
60-
6157 private let storageManager : StorageManagerType
6258
6359 /// Used for looking up the `OrderStatus` to show in the `Order Filters`.
@@ -97,6 +93,7 @@ final class OrdersRootViewController: UIViewController {
9793 super. viewDidLoad ( )
9894 configureTitle ( )
9995 configureView ( )
96+ configureNavigationButtons ( )
10097 configureFiltersBar ( )
10198 configureChildViewController ( )
10299
@@ -112,9 +109,6 @@ final class OrdersRootViewController: UIViewController {
112109 override func viewWillAppear( _ animated: Bool ) {
113110 super. viewWillAppear ( animated)
114111
115- // Needed in ViewWillAppear because this View Controller is never recreated.
116- fetchExperimentalTogglesAndConfigureNavigationButtons ( )
117-
118112 ServiceLocator . pushNotesManager. resetBadgeCount ( type: . storeOrder)
119113 }
120114
@@ -207,9 +201,9 @@ private extension OrdersRootViewController {
207201 /// Search: Is always present.
208202 /// Add: Always present.
209203 ///
210- func configureNavigationButtons( isOrderCreationExperimentalToggleEnabled : Bool ) {
204+ func configureNavigationButtons( ) {
211205 let buttons : [ UIBarButtonItem ] = [
212- createAddOrderItem ( isOrderCreationEnabled : isOrderCreationExperimentalToggleEnabled ) ,
206+ createAddOrderItem ( ) ,
213207 createSearchBarButtonItem ( )
214208 ]
215209 navigationItem. rightBarButtonItems = buttons
@@ -244,24 +238,6 @@ private extension OrdersRootViewController {
244238 ordersViewController. didMove ( toParent: self )
245239 }
246240
247- /// Fetches the latest values of order-related experimental feature toggles and re configures navigation buttons.
248- ///
249- func fetchExperimentalTogglesAndConfigureNavigationButtons( ) {
250- let group = DispatchGroup ( )
251- var isOrderCreationEnabled = false
252-
253- group. enter ( )
254- let orderCreationAction = AppSettingsAction . loadOrderCreationSwitchState { result in
255- isOrderCreationEnabled = ( try ? result. get ( ) ) ?? false
256- group. leave ( )
257- }
258- ServiceLocator . stores. dispatch ( orderCreationAction)
259-
260- group. notify ( queue: . main) { [ weak self] in
261- self ? . configureNavigationButtons ( isOrderCreationExperimentalToggleEnabled: isOrderCreationEnabled)
262- }
263- }
264-
265241 /// Connect hooks on `ResultsController` and query cached data.
266242 /// This is useful for stay up to date with the remote statuses, resetting the filters if one of the local status filters was deleted remotely.
267243 ///
@@ -354,22 +330,14 @@ private extension OrdersRootViewController {
354330
355331 /// Create a `UIBarButtonItem` to be used as a way to create a new order.
356332 ///
357- func createAddOrderItem( isOrderCreationEnabled: Bool ) -> UIBarButtonItem {
358- self . isOrderCreationEnabled = isOrderCreationEnabled
359-
333+ func createAddOrderItem( ) -> UIBarButtonItem {
360334 let button = UIBarButtonItem ( image: . plusBarButtonItemImage,
361335 style: . plain,
362336 target: self ,
363337 action: #selector( presentOrderCreationFlow ( sender: ) ) )
364338 button. accessibilityTraits = . button
365-
366- if isOrderCreationEnabled {
367- button. accessibilityLabel = NSLocalizedString ( " Choose new order type " , comment: " Opens action sheet to choose a type of a new order " )
368- button. accessibilityIdentifier = " new-order-type-sheet-button "
369- } else {
370- button. accessibilityLabel = NSLocalizedString ( " Add simple payments order " , comment: " Navigates to a screen to create a simple payments order " )
371- button. accessibilityIdentifier = " simple-payments-add-button "
372- }
339+ button. accessibilityLabel = NSLocalizedString ( " Choose new order type " , comment: " Opens action sheet to choose a type of a new order " )
340+ button. accessibilityIdentifier = " new-order-type-sheet-button "
373341 return button
374342 }
375343
@@ -381,7 +349,6 @@ private extension OrdersRootViewController {
381349 }
382350
383351 let coordinatingController = AddOrderCoordinator ( siteID: siteID,
384- isOrderCreationEnabled: isOrderCreationEnabled,
385352 sourceBarButtonItem: sender,
386353 sourceNavigationController: navigationController)
387354 coordinatingController. onOrderCreated = { [ weak self] order in
0 commit comments