Skip to content

Commit 07a94ab

Browse files
committed
Rename NewOrder -> OrderForm
1 parent bcab23f commit 07a94ab

File tree

4 files changed

+30
-30
lines changed

4 files changed

+30
-30
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ private extension AddOrderCoordinator {
7575
ServiceLocator.analytics.track(event: WooAnalyticsEvent.SimplePayments.simplePaymentsFlowStarted())
7676
}
7777

78-
/// Presents `NewOrderHostingController`.
78+
/// Presents `OrderFormHostingController`.
7979
///
8080
func presentNewOrderController() {
8181
let viewModel = EditableOrderViewModel(siteID: siteID)
8282
viewModel.onFinished = onOrderCreated
8383

84-
let viewController = NewOrderHostingController(viewModel: viewModel)
84+
let viewController = OrderFormHostingController(viewModel: viewModel)
8585
if ServiceLocator.featureFlagService.isFeatureFlagEnabled(.splitViewInOrdersTab) {
8686
let newOrderNC = WooNavigationController(rootViewController: viewController)
8787
navigationController.present(newOrderNC, animated: true)

WooCommerce/Classes/ViewRelated/Orders/Order Creation/NewOrder.swift renamed to WooCommerce/Classes/ViewRelated/Orders/Order Creation/OrderForm.swift

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import SwiftUI
22
import Combine
33

4-
/// Hosting controller that wraps an `NewOrder` view.
4+
/// Hosting controller that wraps an `OrderForm` view.
55
///
6-
final class NewOrderHostingController: UIHostingController<NewOrder> {
6+
final class OrderFormHostingController: UIHostingController<OrderForm> {
77

88
/// References to keep the Combine subscriptions alive within the lifecycle of the object.
99
///
@@ -12,7 +12,7 @@ final class NewOrderHostingController: UIHostingController<NewOrder> {
1212

1313
init(viewModel: EditableOrderViewModel) {
1414
self.viewModel = viewModel
15-
super.init(rootView: NewOrder(viewModel: viewModel))
15+
super.init(rootView: OrderForm(viewModel: viewModel))
1616

1717
// Needed because a `SwiftUI` cannot be dismissed when being presented by a UIHostingController
1818
rootView.dismissHandler = { [weak self] in
@@ -42,7 +42,7 @@ final class NewOrderHostingController: UIHostingController<NewOrder> {
4242

4343
/// Intercepts back navigation (selecting back button or swiping back).
4444
///
45-
extension NewOrderHostingController {
45+
extension OrderFormHostingController {
4646
override func shouldPopOnBackButton() -> Bool {
4747
guard viewModel.canBeDismissed else {
4848
presentDiscardChangesActionSheet(onDiscard: { [weak self] in
@@ -60,7 +60,7 @@ extension NewOrderHostingController {
6060

6161
/// Intercepts to the dismiss drag gesture.
6262
///
63-
extension NewOrderHostingController: UIAdaptivePresentationControllerDelegate {
63+
extension OrderFormHostingController: UIAdaptivePresentationControllerDelegate {
6464
func presentationControllerShouldDismiss(_ presentationController: UIPresentationController) -> Bool {
6565
return viewModel.canBeDismissed
6666
}
@@ -74,7 +74,7 @@ extension NewOrderHostingController: UIAdaptivePresentationControllerDelegate {
7474

7575
/// Private methods
7676
///
77-
private extension NewOrderHostingController {
77+
private extension OrderFormHostingController {
7878
func presentDiscardChangesActionSheet(onDiscard: @escaping () -> Void) {
7979
UIAlertController.presentDiscardChangesActionSheet(viewController: self, onDiscard: onDiscard)
8080
}
@@ -90,9 +90,9 @@ private extension NewOrderHostingController {
9090
}
9191
}
9292

93-
/// View to create a new manual order
93+
/// View to create or edit an order
9494
///
95-
struct NewOrder: View {
95+
struct OrderForm: View {
9696
/// Set this closure with UIKit dismiss code. Needed because we need access to the UIHostingController `dismiss` method.
9797
///
9898
var dismissHandler: (() -> Void) = {}
@@ -192,13 +192,13 @@ private struct ProductsSection: View {
192192
Group {
193193
Divider()
194194

195-
VStack(alignment: .leading, spacing: NewOrder.Layout.verticalSpacing) {
196-
Text(NewOrder.Localization.products)
195+
VStack(alignment: .leading, spacing: OrderForm.Layout.verticalSpacing) {
196+
Text(OrderForm.Localization.products)
197197
.accessibilityAddTraits(.isHeader)
198198
.headlineStyle()
199199

200200
ForEach(viewModel.productRows) { productRow in
201-
ProductRow(viewModel: productRow, accessibilityHint: NewOrder.Localization.productRowAccessibilityHint)
201+
ProductRow(viewModel: productRow, accessibilityHint: OrderForm.Localization.productRowAccessibilityHint)
202202
.onTapGesture {
203203
viewModel.selectOrderItem(productRow.id)
204204
}
@@ -209,11 +209,11 @@ private struct ProductsSection: View {
209209
Divider()
210210
}
211211

212-
Button(NewOrder.Localization.addProduct) {
212+
Button(OrderForm.Localization.addProduct) {
213213
showAddProduct.toggle()
214214
}
215215
.id(addProductButton)
216-
.accessibilityIdentifier(NewOrder.Accessibility.addProductButtonIdentifier)
216+
.accessibilityIdentifier(OrderForm.Accessibility.addProductButtonIdentifier)
217217
.buttonStyle(PlusButtonStyle())
218218
.sheet(isPresented: $showAddProduct, onDismiss: {
219219
scroll.scrollTo(addProductButton)
@@ -237,21 +237,21 @@ private struct ProductsSection: View {
237237
}
238238

239239
// MARK: Constants
240-
private extension NewOrder {
240+
private extension OrderForm {
241241
enum Layout {
242242
static let sectionSpacing: CGFloat = 16.0
243243
static let verticalSpacing: CGFloat = 22.0
244244
static let noSpacing: CGFloat = 0.0
245245
}
246246

247247
enum Localization {
248-
static let createButton = NSLocalizedString("Create", comment: "Button to create an order on the New Order screen")
248+
static let createButton = NSLocalizedString("Create", comment: "Button to create an order on the Order screen")
249249
static let doneButton = NSLocalizedString("Done", comment: "Button to dismiss the Order Editing screen")
250250
static let cancelButton = NSLocalizedString("Cancel", comment: "Button to cancel the creation of an order on the New Order screen")
251-
static let products = NSLocalizedString("Products", comment: "Title text of the section that shows the Products when creating a new order")
252-
static let addProduct = NSLocalizedString("Add Product", comment: "Title text of the button that adds a product when creating a new order")
251+
static let products = NSLocalizedString("Products", comment: "Title text of the section that shows the Products when creating or editing an order")
252+
static let addProduct = NSLocalizedString("Add Product", comment: "Title text of the button that adds a product when creating or editing an order")
253253
static let productRowAccessibilityHint = NSLocalizedString("Opens product detail.",
254-
comment: "Accessibility hint for selecting a product in a new order")
254+
comment: "Accessibility hint for selecting a product in an order form")
255255
}
256256

257257
enum Accessibility {
@@ -261,28 +261,28 @@ private extension NewOrder {
261261
}
262262
}
263263

264-
struct NewOrder_Previews: PreviewProvider {
264+
struct OrderForm_Previews: PreviewProvider {
265265
static var previews: some View {
266266
let viewModel = EditableOrderViewModel(siteID: 123)
267267

268268
NavigationView {
269-
NewOrder(viewModel: viewModel)
269+
OrderForm(viewModel: viewModel)
270270
}
271271

272272
NavigationView {
273-
NewOrder(viewModel: viewModel)
273+
OrderForm(viewModel: viewModel)
274274
}
275275
.environment(\.sizeCategory, .accessibilityExtraExtraLarge)
276276
.previewDisplayName("Accessibility")
277277

278278
NavigationView {
279-
NewOrder(viewModel: viewModel)
279+
OrderForm(viewModel: viewModel)
280280
}
281281
.environment(\.colorScheme, .dark)
282282
.previewDisplayName("Dark")
283283

284284
NavigationView {
285-
NewOrder(viewModel: viewModel)
285+
OrderForm(viewModel: viewModel)
286286
}
287287
.environment(\.layoutDirection, .rightToLeft)
288288
.previewDisplayName("Right to left")

WooCommerce/Classes/ViewRelated/Orders/Order Details/OrderDetailsViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ private extension OrderDetailsViewController {
358358
guard let self = self else { return }
359359
self.dismiss(animated: true)
360360
}
361-
let viewController = NewOrderHostingController(viewModel: viewModel)
361+
let viewController = OrderFormHostingController(viewModel: viewModel)
362362
let navController = UINavigationController(rootViewController: viewController)
363363
present(navController, animated: true)
364364
}

WooCommerce/WooCommerce.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,7 +1333,7 @@
13331333
CCFC010C23E9BD5500157A78 /* stats_orders_year.json in Resources */ = {isa = PBXBuildFile; fileRef = CCFC00E623E9BD5500157A78 /* stats_orders_year.json */; };
13341334
CCFC010D23E9BD5500157A78 /* stats_top_earners_month.json in Resources */ = {isa = PBXBuildFile; fileRef = CCFC00E723E9BD5500157A78 /* stats_top_earners_month.json */; };
13351335
CCFC010E23E9BD5500157A78 /* stats_visits_day.json in Resources */ = {isa = PBXBuildFile; fileRef = CCFC00E823E9BD5500157A78 /* stats_visits_day.json */; };
1336-
CCFC50552743BC0D001E505F /* NewOrder.swift in Sources */ = {isa = PBXBuildFile; fileRef = CCFC50542743BC0D001E505F /* NewOrder.swift */; };
1336+
CCFC50552743BC0D001E505F /* OrderForm.swift in Sources */ = {isa = PBXBuildFile; fileRef = CCFC50542743BC0D001E505F /* OrderForm.swift */; };
13371337
CCFC50592743E021001E505F /* EditableOrderViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CCFC50582743E021001E505F /* EditableOrderViewModel.swift */; };
13381338
CE0F17CF22A8105800964A63 /* ReadMoreTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE0F17CD22A8105800964A63 /* ReadMoreTableViewCell.swift */; };
13391339
CE0F17D022A8105800964A63 /* ReadMoreTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = CE0F17CE22A8105800964A63 /* ReadMoreTableViewCell.xib */; };
@@ -3108,7 +3108,7 @@
31083108
CCFC00E823E9BD5500157A78 /* stats_visits_day.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = stats_visits_day.json; sourceTree = "<group>"; };
31093109
CCFC011023E9E3F400157A78 /* start.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = start.sh; sourceTree = "<group>"; };
31103110
CCFC011123E9E40B00157A78 /* stop.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = stop.sh; sourceTree = "<group>"; };
3111-
CCFC50542743BC0D001E505F /* NewOrder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewOrder.swift; sourceTree = "<group>"; };
3111+
CCFC50542743BC0D001E505F /* OrderForm.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderForm.swift; sourceTree = "<group>"; };
31123112
CCFC50582743E021001E505F /* EditableOrderViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditableOrderViewModel.swift; sourceTree = "<group>"; };
31133113
CE0F17CD22A8105800964A63 /* ReadMoreTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReadMoreTableViewCell.swift; sourceTree = "<group>"; };
31143114
CE0F17CE22A8105800964A63 /* ReadMoreTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ReadMoreTableViewCell.xib; sourceTree = "<group>"; };
@@ -6975,7 +6975,7 @@
69756975
isa = PBXGroup;
69766976
children = (
69776977
B651474327D644DE00C9C4E6 /* CustomerNoteSection */,
6978-
CCFC50542743BC0D001E505F /* NewOrder.swift */,
6978+
CCFC50542743BC0D001E505F /* OrderForm.swift */,
69796979
CCFC50582743E021001E505F /* EditableOrderViewModel.swift */,
69806980
26C6439127B5DBE900DD00D1 /* Synchronizer */,
69816981
AE264C05275A495E00B52996 /* FlowCoordinator */,
@@ -9441,7 +9441,7 @@
94419441
DE68B81F26F86B1700C86CFB /* OfflineBannerView.swift in Sources */,
94429442
02D4564C231D05E2008CF0A9 /* BetaFeaturesViewController.swift in Sources */,
94439443
D8610BCC256F284700A5DF27 /* ULErrorViewModel.swift in Sources */,
9444-
CCFC50552743BC0D001E505F /* NewOrder.swift in Sources */,
9444+
CCFC50552743BC0D001E505F /* OrderForm.swift in Sources */,
94459445
4590CEE4249BA46700949F05 /* AddProductCategoryViewController.swift in Sources */,
94469446
CE37C04422984E81008DCB39 /* PickListTableViewCell.swift in Sources */,
94479447
DE3877E0283B68CF0075D87E /* DiscountTypeBottomSheetListSelectorCommand.swift in Sources */,

0 commit comments

Comments
 (0)