Skip to content

Commit 8ef9ce3

Browse files
authored
Merge pull request #6537 from woocommerce/issue/6536-remove-order-creation-experimental-toggle
Order Creation: Release order creation (removes experimental toggle)
2 parents c803fa5 + aabf5a1 commit 8ef9ce3

File tree

14 files changed

+13
-217
lines changed

14 files changed

+13
-217
lines changed

RELEASE-NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- [*] In-Person Payments: Removed collecting L2/L3 data. [https://github.com/woocommerce/woocommerce-ios/pull/6519]
77
- [*] Hub Menu: Multiple menu items can no longer be tapped simultaneously. [https://github.com/woocommerce/woocommerce-ios/pull/6484]
88
- [*] Jetpack CP: Fixed crash when attempting to access WP-Admin with an invalid URL that has an unsupported scheme. [https://github.com/woocommerce/woocommerce-ios/pull/6502]
9+
- [***] Orders: Order Creation is now available to everyone! You can go to the Orders tab and tap the + button to create a new order. [https://github.com/woocommerce/woocommerce-ios/pull/6537]
910
- [internal] Loading screens are refactored to avoid duplicated code and a potential crash. Please quickly smoke test them to make sure that everything still works as before. [https://github.com/woocommerce/woocommerce-ios/pull/6535] [https://github.com/woocommerce/woocommerce-ios/pull/6544]
1011

1112
8.8

Storage/Storage/Model/Copiable/Models+Copiable.generated.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ extension GeneralAppSettings {
99
installationDate: NullableCopiableProp<Date> = .copy,
1010
feedbacks: CopiableProp<[FeedbackType: FeedbackSettings]> = .copy,
1111
isViewAddOnsSwitchEnabled: CopiableProp<Bool> = .copy,
12-
isOrderCreationSwitchEnabled: CopiableProp<Bool> = .copy,
1312
isCanadaInPersonPaymentsSwitchEnabled: CopiableProp<Bool> = .copy,
1413
isProductSKUInputScannerSwitchEnabled: CopiableProp<Bool> = .copy,
1514
isCouponManagementSwitchEnabled: CopiableProp<Bool> = .copy,
@@ -20,7 +19,6 @@ extension GeneralAppSettings {
2019
let installationDate = installationDate ?? self.installationDate
2120
let feedbacks = feedbacks ?? self.feedbacks
2221
let isViewAddOnsSwitchEnabled = isViewAddOnsSwitchEnabled ?? self.isViewAddOnsSwitchEnabled
23-
let isOrderCreationSwitchEnabled = isOrderCreationSwitchEnabled ?? self.isOrderCreationSwitchEnabled
2422
let isCanadaInPersonPaymentsSwitchEnabled = isCanadaInPersonPaymentsSwitchEnabled ?? self.isCanadaInPersonPaymentsSwitchEnabled
2523
let isProductSKUInputScannerSwitchEnabled = isProductSKUInputScannerSwitchEnabled ?? self.isProductSKUInputScannerSwitchEnabled
2624
let isCouponManagementSwitchEnabled = isCouponManagementSwitchEnabled ?? self.isCouponManagementSwitchEnabled
@@ -32,7 +30,6 @@ extension GeneralAppSettings {
3230
installationDate: installationDate,
3331
feedbacks: feedbacks,
3432
isViewAddOnsSwitchEnabled: isViewAddOnsSwitchEnabled,
35-
isOrderCreationSwitchEnabled: isOrderCreationSwitchEnabled,
3633
isCanadaInPersonPaymentsSwitchEnabled: isCanadaInPersonPaymentsSwitchEnabled,
3734
isProductSKUInputScannerSwitchEnabled: isProductSKUInputScannerSwitchEnabled,
3835
isCouponManagementSwitchEnabled: isCouponManagementSwitchEnabled,

Storage/Storage/Model/GeneralAppSettings.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ public struct GeneralAppSettings: Codable, Equatable, GeneratedCopiable {
2424
///
2525
public let isViewAddOnsSwitchEnabled: Bool
2626

27-
/// The state(`true` or `false`) for the Order Creation feature switch.
28-
///
29-
public let isOrderCreationSwitchEnabled: Bool
30-
3127
/// The state for the In-Person Payments in Canada feature switch
3228
///
3329
public let isCanadaInPersonPaymentsSwitchEnabled: Bool
@@ -55,7 +51,6 @@ public struct GeneralAppSettings: Codable, Equatable, GeneratedCopiable {
5551
public init(installationDate: Date?,
5652
feedbacks: [FeedbackType: FeedbackSettings],
5753
isViewAddOnsSwitchEnabled: Bool,
58-
isOrderCreationSwitchEnabled: Bool,
5954
isCanadaInPersonPaymentsSwitchEnabled: Bool,
6055
isProductSKUInputScannerSwitchEnabled: Bool,
6156
isCouponManagementSwitchEnabled: Bool,
@@ -65,7 +60,6 @@ public struct GeneralAppSettings: Codable, Equatable, GeneratedCopiable {
6560
self.installationDate = installationDate
6661
self.feedbacks = feedbacks
6762
self.isViewAddOnsSwitchEnabled = isViewAddOnsSwitchEnabled
68-
self.isOrderCreationSwitchEnabled = isOrderCreationSwitchEnabled
6963
self.isCanadaInPersonPaymentsSwitchEnabled = isCanadaInPersonPaymentsSwitchEnabled
7064
self.isProductSKUInputScannerSwitchEnabled = isProductSKUInputScannerSwitchEnabled
7165
self.isCouponManagementSwitchEnabled = isCouponManagementSwitchEnabled
@@ -95,7 +89,6 @@ public struct GeneralAppSettings: Codable, Equatable, GeneratedCopiable {
9589
installationDate: installationDate,
9690
feedbacks: updatedFeedbacks,
9791
isViewAddOnsSwitchEnabled: isViewAddOnsSwitchEnabled,
98-
isOrderCreationSwitchEnabled: isOrderCreationSwitchEnabled,
9992
isCanadaInPersonPaymentsSwitchEnabled: isCanadaInPersonPaymentsSwitchEnabled,
10093
isProductSKUInputScannerSwitchEnabled: isProductSKUInputScannerSwitchEnabled,
10194
isCouponManagementSwitchEnabled: isCouponManagementSwitchEnabled,
@@ -115,7 +108,6 @@ extension GeneralAppSettings {
115108
self.installationDate = try container.decodeIfPresent(Date.self, forKey: .installationDate)
116109
self.feedbacks = try container.decodeIfPresent([FeedbackType: FeedbackSettings].self, forKey: .feedbacks) ?? [:]
117110
self.isViewAddOnsSwitchEnabled = try container.decodeIfPresent(Bool.self, forKey: .isViewAddOnsSwitchEnabled) ?? false
118-
self.isOrderCreationSwitchEnabled = try container.decodeIfPresent(Bool.self, forKey: .isOrderCreationSwitchEnabled) ?? false
119111
self.isCanadaInPersonPaymentsSwitchEnabled = try container.decodeIfPresent(Bool.self, forKey: .isCanadaInPersonPaymentsSwitchEnabled) ?? false
120112
self.isProductSKUInputScannerSwitchEnabled = try container.decodeIfPresent(Bool.self, forKey: .isProductSKUInputScannerSwitchEnabled) ?? false
121113
self.isCouponManagementSwitchEnabled = try container.decodeIfPresent(Bool.self, forKey: .isCouponManagementSwitchEnabled) ?? false

Storage/StorageTests/Model/AppSettings/GeneralAppSettingsTests.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ final class GeneralAppSettingsTests: XCTestCase {
6161
let previousSettings = GeneralAppSettings(installationDate: installationDate,
6262
feedbacks: feedbackSettings,
6363
isViewAddOnsSwitchEnabled: true,
64-
isOrderCreationSwitchEnabled: true,
6564
isCanadaInPersonPaymentsSwitchEnabled: true,
6665
isProductSKUInputScannerSwitchEnabled: true,
6766
isCouponManagementSwitchEnabled: true,
@@ -83,7 +82,6 @@ final class GeneralAppSettingsTests: XCTestCase {
8382
assertEqual(newSettings.knownCardReaders, readers)
8483
assertEqual(newSettings.lastEligibilityErrorInfo, eligibilityInfo)
8584
assertEqual(newSettings.isViewAddOnsSwitchEnabled, false)
86-
assertEqual(newSettings.isOrderCreationSwitchEnabled, true)
8785
assertEqual(newSettings.isCanadaInPersonPaymentsSwitchEnabled, true)
8886
assertEqual(newSettings.isProductSKUInputScannerSwitchEnabled, true)
8987
assertEqual(newSettings.isCouponManagementSwitchEnabled, true)
@@ -95,7 +93,6 @@ private extension GeneralAppSettingsTests {
9593
func createGeneralAppSettings(installationDate: Date? = nil,
9694
feedbacks: [FeedbackType: FeedbackSettings] = [:],
9795
isViewAddOnsSwitchEnabled: Bool = false,
98-
isOrderCreationSwitchEnabled: Bool = false,
9996
isCanadaInPersonPaymentsSwitchEnabled: Bool = false,
10097
isProductSKUInputScannerSwitchEnabled: Bool = false,
10198
isCouponManagementSwitchEnabled: Bool = false,
@@ -105,7 +102,6 @@ private extension GeneralAppSettingsTests {
105102
GeneralAppSettings(installationDate: installationDate,
106103
feedbacks: feedbacks,
107104
isViewAddOnsSwitchEnabled: isViewAddOnsSwitchEnabled,
108-
isOrderCreationSwitchEnabled: isOrderCreationSwitchEnabled,
109105
isCanadaInPersonPaymentsSwitchEnabled: isCanadaInPersonPaymentsSwitchEnabled,
110106
isProductSKUInputScannerSwitchEnabled: isProductSKUInputScannerSwitchEnabled,
111107
isCouponManagementSwitchEnabled: isCouponManagementSwitchEnabled,

WooCommerce/Classes/ViewRelated/Dashboard/Settings/Beta features/BetaFeaturesViewController.swift

Lines changed: 2 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ private extension BetaFeaturesViewController {
7474
func configureSections() {
7575
self.sections = [
7676
productsSection(),
77-
orderCreationSection(),
7877
inPersonPaymentsSection(),
7978
productSKUInputScannerSection(),
8079
couponManagementSection()
@@ -86,11 +85,6 @@ private extension BetaFeaturesViewController {
8685
.orderAddOnsDescription])
8786
}
8887

89-
func orderCreationSection() -> Section? {
90-
return Section(rows: [.orderCreation,
91-
.orderCreationDescription])
92-
}
93-
9488
func inPersonPaymentsSection() -> Section? {
9589
var rows: [Row] = []
9690

@@ -144,11 +138,6 @@ private extension BetaFeaturesViewController {
144138
configureOrderAddOnsSwitch(cell: cell)
145139
case let cell as BasicTableViewCell where row == .orderAddOnsDescription:
146140
configureOrderAddOnsDescription(cell: cell)
147-
// Orders
148-
case let cell as SwitchTableViewCell where row == .orderCreation:
149-
configureOrderCreationSwitch(cell: cell)
150-
case let cell as BasicTableViewCell where row == .orderCreationDescription:
151-
configureOrderCreationDescription(cell: cell)
152141
// In-Person Payments in Canada
153142
case let cell as SwitchTableViewCell where row == .canadaInPersonPayments:
154143
configureCanadaInPersonPaymentsSwitch(cell: cell)
@@ -203,37 +192,6 @@ private extension BetaFeaturesViewController {
203192
cell.textLabel?.text = Localization.orderAddOnsDescription
204193
}
205194

206-
func configureOrderCreationSwitch(cell: SwitchTableViewCell) {
207-
configureCommonStylesForSwitchCell(cell)
208-
cell.title = Localization.orderCreationTitle
209-
210-
// Fetch switch's state stored value.
211-
let action = AppSettingsAction.loadOrderCreationSwitchState() { result in
212-
guard let isEnabled = try? result.get() else {
213-
return cell.isOn = false
214-
}
215-
cell.isOn = isEnabled
216-
}
217-
ServiceLocator.stores.dispatch(action)
218-
219-
// Change switch's state stored value
220-
cell.onChange = { isSwitchOn in
221-
let action = AppSettingsAction.setOrderCreationFeatureSwitchState(isEnabled: isSwitchOn, onCompletion: { result in
222-
// Roll back toggle if an error occurred
223-
if result.isFailure {
224-
cell.isOn.toggle()
225-
}
226-
})
227-
ServiceLocator.stores.dispatch(action)
228-
}
229-
cell.accessibilityIdentifier = "beta-features-order-order-creation-cell"
230-
}
231-
232-
func configureOrderCreationDescription(cell: BasicTableViewCell) {
233-
configureCommonStylesForDescriptionCell(cell)
234-
cell.textLabel?.text = Localization.orderCreationDescription
235-
}
236-
237195
func configureCanadaInPersonPaymentsSwitch(cell: SwitchTableViewCell) {
238196
configureCommonStylesForSwitchCell(cell)
239197
cell.title = Localization.canadaExtensionInPersonPaymentsTitle
@@ -390,10 +348,6 @@ private enum Row: CaseIterable {
390348
case orderAddOns
391349
case orderAddOnsDescription
392350

393-
// Orders.
394-
case orderCreation
395-
case orderCreationDescription
396-
397351
// In-Person Payments in Canada
398352
case canadaInPersonPayments
399353
case canadaInPersonPaymentsDescription
@@ -408,9 +362,9 @@ private enum Row: CaseIterable {
408362

409363
var type: UITableViewCell.Type {
410364
switch self {
411-
case .orderAddOns, .orderCreation, .canadaInPersonPayments, .productSKUInputScanner, .couponManagement:
365+
case .orderAddOns, .canadaInPersonPayments, .productSKUInputScanner, .couponManagement:
412366
return SwitchTableViewCell.self
413-
case .orderAddOnsDescription, .orderCreationDescription, .canadaInPersonPaymentsDescription,
367+
case .orderAddOnsDescription, .canadaInPersonPaymentsDescription,
414368
.productSKUInputScannerDescription, .couponManagementDescription:
415369
return BasicTableViewCell.self
416370
}
@@ -430,13 +384,6 @@ private extension BetaFeaturesViewController {
430384
"Test out viewing Order Add-Ons as we get ready to launch",
431385
comment: "Cell description on the beta features screen to enable the order add-ons feature")
432386

433-
static let orderCreationTitle = NSLocalizedString(
434-
"Order Creation",
435-
comment: "Cell title on the beta features screen to enable creating new orders")
436-
static let orderCreationDescription = NSLocalizedString(
437-
"Test out creating new manual orders as we get ready to launch",
438-
comment: "Cell description on the beta features screen to enable creating new orders")
439-
440387
static let canadaExtensionInPersonPaymentsTitle = NSLocalizedString(
441388
"In-Person Payments in Canada",
442389
comment: "Cell title on beta features screen to enable accepting in-person payments for stores in Canada ")

WooCommerce/Classes/ViewRelated/Orders/Order Creation/FlowCoordinator/AddOrderCoordinator.swift

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ final class AddOrderCoordinator: Coordinator {
66
var navigationController: UINavigationController
77

88
private let siteID: Int64
9-
private let isOrderCreationEnabled: Bool
109
private let sourceBarButtonItem: UIBarButtonItem?
1110
private let sourceView: UIView?
1211

@@ -15,22 +14,18 @@ final class AddOrderCoordinator: Coordinator {
1514
var onOrderCreated: (Order) -> Void = { _ in }
1615

1716
init(siteID: Int64,
18-
isOrderCreationEnabled: Bool,
1917
sourceBarButtonItem: UIBarButtonItem,
2018
sourceNavigationController: UINavigationController) {
2119
self.siteID = siteID
22-
self.isOrderCreationEnabled = isOrderCreationEnabled
2320
self.sourceBarButtonItem = sourceBarButtonItem
2421
self.sourceView = nil
2522
self.navigationController = sourceNavigationController
2623
}
2724

2825
init(siteID: Int64,
29-
isOrderCreationEnabled: Bool,
3026
sourceView: UIView,
3127
sourceNavigationController: UINavigationController) {
3228
self.siteID = siteID
33-
self.isOrderCreationEnabled = isOrderCreationEnabled
3429
self.sourceBarButtonItem = nil
3530
self.sourceView = sourceView
3631
self.navigationController = sourceNavigationController
@@ -41,11 +36,7 @@ final class AddOrderCoordinator: Coordinator {
4136
}
4237

4338
func start() {
44-
if isOrderCreationEnabled {
45-
presentOrderTypeBottomSheet()
46-
} else {
47-
presentOrderCreationFlow(bottomSheetOrderType: .simple)
48-
}
39+
presentOrderTypeBottomSheet()
4940
}
5041
}
5142

WooCommerce/Classes/ViewRelated/Orders/OrdersRootViewController.swift

Lines changed: 6 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)