Skip to content

Commit 9ff1da2

Browse files
committed
Add order creation section with switch
1 parent 621b985 commit 9ff1da2

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

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

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ private extension BetaFeaturesViewController {
7878
func configureSections() {
7979
self.sections = [
8080
productsSection(),
81-
ordersSection()
81+
ordersSection(),
82+
orderCreationSection()
8283
].compactMap { $0 }
8384
}
8485

@@ -98,6 +99,15 @@ private extension BetaFeaturesViewController {
9899
.simplePaymentsDescription])
99100
}
100101

102+
func orderCreationSection() -> Section? {
103+
guard ServiceLocator.featureFlagService.isFeatureFlagEnabled(.orderCreation) else {
104+
return nil
105+
}
106+
107+
return Section(rows: [.orderCreation,
108+
.orderCreationDescription])
109+
}
110+
101111
/// Register table cells.
102112
///
103113
func registerTableViewCells() {
@@ -125,6 +135,10 @@ private extension BetaFeaturesViewController {
125135
configureSimplePaymentsSwitch(cell: cell)
126136
case let cell as BasicTableViewCell where row == .simplePaymentsDescription:
127137
configureSimplePaymentsDescription(cell: cell)
138+
case let cell as SwitchTableViewCell where row == .orderCreation:
139+
configureOrderCreationSwitch(cell: cell)
140+
case let cell as BasicTableViewCell where row == .orderCreationDescription:
141+
configureOrderCreationDescription(cell: cell)
128142
default:
129143
fatalError()
130144
}
@@ -197,6 +211,17 @@ private extension BetaFeaturesViewController {
197211
configureCommonStylesForDescriptionCell(cell)
198212
cell.textLabel?.text = Localization.simplePaymentsDescription
199213
}
214+
215+
func configureOrderCreationSwitch(cell: SwitchTableViewCell) {
216+
configureCommonStylesForSwitchCell(cell)
217+
cell.title = Localization.orderCreationTitle
218+
cell.accessibilityIdentifier = "beta-features-order-order-creation-cell"
219+
}
220+
221+
func configureOrderCreationDescription(cell: BasicTableViewCell) {
222+
configureCommonStylesForDescriptionCell(cell)
223+
cell.textLabel?.text = Localization.orderCreationDescription
224+
}
200225
}
201226

202227
// MARK: - Shared Configurations

0 commit comments

Comments
 (0)