Skip to content

Commit 4cc899a

Browse files
committed
Rename PointOfSaleOrderList to POSOrderList
1 parent 1b37a57 commit 4cc899a

22 files changed

+212
-212
lines changed

Modules/Sources/Yosemite/PointOfSale/OrderList/PointOfSaleOrderListFetchStrategy.swift renamed to Modules/Sources/Yosemite/PointOfSale/OrderList/POSOrderListFetchStrategy.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
import Foundation
22
import struct NetworkingCore.PagedItems
33

4-
public protocol PointOfSaleOrderListFetchStrategy {
4+
public protocol POSOrderListFetchStrategy {
55
func fetchOrders(pageNumber: Int) async throws -> PagedItems<POSOrder>
66
var supportsCaching: Bool { get }
77
var showsLoadingWithItems: Bool { get }
88
var id: String { get }
99
}
1010

11-
extension PointOfSaleOrderListFetchStrategy {
11+
extension POSOrderListFetchStrategy {
1212
var id: String {
1313
String(describing: type(of: self))
1414
}
1515
}
1616

17-
struct PointOfSaleDefaultOrderListFetchStrategy: PointOfSaleOrderListFetchStrategy {
18-
private let orderListService: PointOfSaleOrderListServiceProtocol
17+
struct POSDefaultOrderListFetchStrategy: POSOrderListFetchStrategy {
18+
private let orderListService: POSOrderListServiceProtocol
1919
let supportsCaching: Bool = true
2020
var showsLoadingWithItems: Bool = true
2121

22-
init(orderListService: PointOfSaleOrderListServiceProtocol) {
22+
init(orderListService: POSOrderListServiceProtocol) {
2323
self.orderListService = orderListService
2424
}
2525

@@ -28,14 +28,14 @@ struct PointOfSaleDefaultOrderListFetchStrategy: PointOfSaleOrderListFetchStrate
2828
}
2929
}
3030

31-
struct PointOfSaleSearchOrderListFetchStrategy: PointOfSaleOrderListFetchStrategy {
32-
private let orderListService: PointOfSaleOrderListServiceProtocol
31+
struct POSSearchOrderListFetchStrategy: POSOrderListFetchStrategy {
32+
private let orderListService: POSOrderListServiceProtocol
3333
private let searchTerm: String
3434

3535
var supportsCaching: Bool = false
3636
var showsLoadingWithItems = false
3737

38-
init(orderListService: PointOfSaleOrderListServiceProtocol, searchTerm: String) {
38+
init(orderListService: POSOrderListServiceProtocol, searchTerm: String) {
3939
self.orderListService = orderListService
4040
self.searchTerm = searchTerm
4141
}
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import class Networking.AlamofireNetwork
33
import class Networking.OrdersRemote
44
import class WooFoundationCore.CurrencyFormatter
55

6-
public protocol PointOfSaleOrderListFetchStrategyFactoryProtocol {
7-
func defaultStrategy() -> PointOfSaleOrderListFetchStrategy
8-
func searchStrategy(searchTerm: String) -> PointOfSaleOrderListFetchStrategy
6+
public protocol POSOrderListFetchStrategyFactoryProtocol {
7+
func defaultStrategy() -> POSOrderListFetchStrategy
8+
func searchStrategy(searchTerm: String) -> POSOrderListFetchStrategy
99
}
1010

11-
public final class PointOfSaleOrderListFetchStrategyFactory: PointOfSaleOrderListFetchStrategyFactoryProtocol {
11+
public final class POSOrderListFetchStrategyFactory: POSOrderListFetchStrategyFactoryProtocol {
1212
private let siteID: Int64
1313
private let ordersRemote: OrdersRemote
1414
private let currencyFormatter: CurrencyFormatter
@@ -22,19 +22,19 @@ public final class PointOfSaleOrderListFetchStrategyFactory: PointOfSaleOrderLis
2222
self.currencyFormatter = currencyFormatter
2323
}
2424

25-
public func defaultStrategy() -> PointOfSaleOrderListFetchStrategy {
26-
PointOfSaleDefaultOrderListFetchStrategy(
27-
orderListService: PointOfSaleOrderListService(
25+
public func defaultStrategy() -> POSOrderListFetchStrategy {
26+
POSDefaultOrderListFetchStrategy(
27+
orderListService: POSOrderListService(
2828
siteID: siteID,
2929
ordersRemote: ordersRemote,
3030
currencyFormatter: currencyFormatter
3131
)
3232
)
3333
}
3434

35-
public func searchStrategy(searchTerm: String) -> PointOfSaleOrderListFetchStrategy {
36-
PointOfSaleSearchOrderListFetchStrategy(
37-
orderListService: PointOfSaleOrderListService(
35+
public func searchStrategy(searchTerm: String) -> POSOrderListFetchStrategy {
36+
POSSearchOrderListFetchStrategy(
37+
orderListService: POSOrderListService(
3838
siteID: siteID,
3939
ordersRemote: ordersRemote,
4040
currencyFormatter: currencyFormatter

Modules/Sources/Yosemite/PointOfSale/OrderList/PointOfSaleOrderListService.swift renamed to Modules/Sources/Yosemite/PointOfSale/OrderList/POSOrderListService.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import struct NetworkingCore.Order
55
import protocol NetworkingCore.POSOrdersRemoteProtocol
66
import class WooFoundationCore.CurrencyFormatter
77

8-
public final class PointOfSaleOrderListService: PointOfSaleOrderListServiceProtocol {
8+
public final class POSOrderListService: POSOrderListServiceProtocol {
99
private let ordersRemote: POSOrdersRemoteProtocol
1010
private let siteID: Int64
1111
private let mapper: POSOrderMapper
@@ -39,9 +39,9 @@ public final class PointOfSaleOrderListService: PointOfSaleOrderListServiceProto
3939
hasMorePages: pagedOrders.hasMorePages,
4040
totalItems: pagedOrders.totalItems)
4141
} catch AFError.explicitlyCancelled {
42-
throw PointOfSaleOrderListServiceError.requestCancelled
42+
throw POSOrderListServiceError.requestCancelled
4343
} catch {
44-
throw PointOfSaleOrderListServiceError.requestFailed
44+
throw POSOrderListServiceError.requestFailed
4545
}
4646
}
4747

@@ -65,9 +65,9 @@ public final class PointOfSaleOrderListService: PointOfSaleOrderListServiceProto
6565
hasMorePages: pagedOrders.hasMorePages,
6666
totalItems: pagedOrders.totalItems)
6767
} catch AFError.explicitlyCancelled {
68-
throw PointOfSaleOrderListServiceError.requestCancelled
68+
throw POSOrderListServiceError.requestCancelled
6969
} catch {
70-
throw PointOfSaleOrderListServiceError.requestFailed
70+
throw POSOrderListServiceError.requestFailed
7171
}
7272
}
7373
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import Foundation
22
import struct NetworkingCore.PagedItems
33

4-
public enum PointOfSaleOrderListServiceError: Error, Equatable {
4+
public enum POSOrderListServiceError: Error, Equatable {
55
case requestFailed
66
case requestCancelled
77
}
88

9-
public protocol PointOfSaleOrderListServiceProtocol {
9+
public protocol POSOrderListServiceProtocol {
1010
func providePointOfSaleOrders(pageNumber: Int) async throws -> PagedItems<POSOrder>
1111
func searchPointOfSaleOrders(searchTerm: String, pageNumber: Int) async throws -> PagedItems<POSOrder>
1212
}

Modules/Tests/YosemiteTests/PointOfSale/PointOfSaleOrderServiceTests.swift renamed to Modules/Tests/YosemiteTests/PointOfSale/OrderList/POSOrderListServiceTests.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ import struct NetworkingCore.Order
55
import enum NetworkingCore.OrderStatusEnum
66
import WooFoundation
77

8-
final class PointOfSaleOrderServiceTests: XCTestCase {
8+
final class POSOrderListServiceTests: XCTestCase {
99
private let siteID: Int64 = 13092
10-
private var orderProvider: PointOfSaleOrderListServiceProtocol!
10+
private var orderProvider: POSOrderListServiceProtocol!
1111
private var mockOrdersRemote: MockPOSOrdersRemote!
1212

1313
override func setUp() {
1414
super.setUp()
1515
mockOrdersRemote = MockPOSOrdersRemote()
16-
orderProvider = PointOfSaleOrderListService(
16+
orderProvider = POSOrderListService(
1717
siteID: siteID,
1818
ordersRemote: mockOrdersRemote,
1919
currencyFormatter: CurrencyFormatter(currencySettings: CurrencySettings())
@@ -27,14 +27,14 @@ final class PointOfSaleOrderServiceTests: XCTestCase {
2727
}
2828

2929
func test_PointOfSaleOrderServiceProtocol_when_fails_request_with_requestFailed_then_throws_error() async throws {
30-
let expectedError = PointOfSaleOrderListServiceError.requestFailed
30+
let expectedError = POSOrderListServiceError.requestFailed
3131
mockOrdersRemote.mockPagedOrdersResult = .failure(expectedError)
3232

3333
do {
3434
_ = try await orderProvider.providePointOfSaleOrders(pageNumber: 1)
3535
XCTFail("Expected an error, but got success.")
3636
} catch {
37-
XCTAssertEqual(error as? PointOfSaleOrderListServiceError, expectedError)
37+
XCTAssertEqual(error as? POSOrderListServiceError, expectedError)
3838
}
3939
}
4040

@@ -111,7 +111,7 @@ final class PointOfSaleOrderServiceTests: XCTestCase {
111111
do {
112112
_ = try await orderProvider.providePointOfSaleOrders(pageNumber: 1)
113113
XCTFail("Expected error to be thrown")
114-
} catch PointOfSaleOrderListServiceError.requestFailed {
114+
} catch POSOrderListServiceError.requestFailed {
115115
// Expected
116116
} catch {
117117
XCTFail("Unexpected error occurred: \(error)")
@@ -144,7 +144,7 @@ final class PointOfSaleOrderServiceTests: XCTestCase {
144144
}
145145
}
146146

147-
private extension PointOfSaleOrderServiceTests {
147+
private extension POSOrderListServiceTests {
148148
enum TestError: Error {
149149
case expectedError
150150
}

WooCommerce/Classes/POS/Controllers/PointOfSaleOrderListController.swift renamed to WooCommerce/Classes/POS/Controllers/POSOrderListController.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import Foundation
22
import Observation
3-
import enum Yosemite.PointOfSaleOrderListServiceError
4-
import protocol Yosemite.PointOfSaleOrderListServiceProtocol
5-
import protocol Yosemite.PointOfSaleOrderListFetchStrategyFactoryProtocol
6-
import protocol Yosemite.PointOfSaleOrderListFetchStrategy
3+
import enum Yosemite.POSOrderListServiceError
4+
import protocol Yosemite.POSOrderListServiceProtocol
5+
import protocol Yosemite.POSOrderListFetchStrategyFactoryProtocol
6+
import protocol Yosemite.POSOrderListFetchStrategy
77
import struct Yosemite.POSOrder
88
import struct Yosemite.POSOrderItem
99
import struct Yosemite.POSOrderRefund
1010
import class Yosemite.Store
1111

12-
protocol PointOfSaleOrderListControllerProtocol {
12+
protocol POSOrderListControllerProtocol {
1313
var ordersViewState: POSOrderListState { get }
1414
var selectedOrder: POSOrder? { get }
1515
func loadOrders() async
@@ -18,18 +18,18 @@ protocol PointOfSaleOrderListControllerProtocol {
1818
func selectOrder(_ order: POSOrder?)
1919
}
2020

21-
protocol PointOfSaleSearchingOrderListControllerProtocol: PointOfSaleOrderListControllerProtocol {
21+
protocol POSSearchingOrderListControllerProtocol: POSOrderListControllerProtocol {
2222
func searchOrders(searchTerm: String) async
2323
func clearSearchOrders()
2424
}
2525

26-
@Observable final class PointOfSaleOrderListController: PointOfSaleSearchingOrderListControllerProtocol {
26+
@Observable final class POSOrderListController: POSSearchingOrderListControllerProtocol {
2727
var ordersViewState: POSOrderListState
2828
private var strategyPaginationTracker: [String: AsyncPaginationTracker] = [:]
29-
private var fetchStrategy: PointOfSaleOrderListFetchStrategy
29+
private var fetchStrategy: POSOrderListFetchStrategy
3030
private var cachedOrders: [POSOrder] = []
3131
private(set) var selectedOrder: POSOrder?
32-
private let orderListFetchStrategyFactory: PointOfSaleOrderListFetchStrategyFactoryProtocol
32+
private let orderListFetchStrategyFactory: POSOrderListFetchStrategyFactoryProtocol
3333
private var paginationTracker: AsyncPaginationTracker {
3434
if let existing = strategyPaginationTracker[fetchStrategy.id] {
3535
return existing
@@ -39,7 +39,7 @@ protocol PointOfSaleSearchingOrderListControllerProtocol: PointOfSaleOrderListCo
3939
return tracker
4040
}
4141

42-
init(orderListFetchStrategyFactory: PointOfSaleOrderListFetchStrategyFactoryProtocol,
42+
init(orderListFetchStrategyFactory: POSOrderListFetchStrategyFactoryProtocol,
4343
initialState: POSOrderListState = .loading([])) {
4444
self.ordersViewState = initialState
4545
self.orderListFetchStrategyFactory = orderListFetchStrategyFactory
@@ -127,7 +127,7 @@ protocol PointOfSaleSearchingOrderListControllerProtocol: PointOfSaleOrderListCo
127127
}
128128

129129
return pagedOrders.hasMorePages
130-
} catch PointOfSaleOrderListServiceError.requestCancelled {
130+
} catch POSOrderListServiceError.requestCancelled {
131131
return true
132132
}
133133
}

WooCommerce/Classes/POS/Models/PointOfSaleOrderListModel.swift renamed to WooCommerce/Classes/POS/Models/POSOrderListModel.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import Foundation
22
import Observation
33
import struct Yosemite.POSOrder
44

5-
@Observable final class PointOfSaleOrderListModel {
6-
let ordersController: PointOfSaleSearchingOrderListControllerProtocol
5+
@Observable final class POSOrderListModel {
6+
let ordersController: POSSearchingOrderListControllerProtocol
77
let receiptSender: POSReceiptSending
88

9-
init(ordersController: PointOfSaleSearchingOrderListControllerProtocol,
9+
init(ordersController: POSSearchingOrderListControllerProtocol,
1010
receiptSender: POSReceiptSending) {
1111
self.ordersController = ordersController
1212
self.receiptSender = receiptSender

WooCommerce/Classes/POS/Presentation/Orders/PointOfSaleOrderDetailsView.swift renamed to WooCommerce/Classes/POS/Presentation/Orders/POSDetailsView.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import struct Yosemite.POSOrderRefund
55
import enum Yosemite.OrderStatusEnum
66
import typealias Yosemite.OrderItemAttribute
77

8-
struct PointOfSaleOrderDetailsView: View {
8+
struct POSOrderDetailsView: View {
99
let order: POSOrder
1010
let onBack: () -> Void
1111

1212
@Environment(\.horizontalSizeClass) private var horizontalSizeClass
1313
@Environment(\.siteTimezone) private var siteTimezone
14-
@Environment(PointOfSaleOrderListModel.self) private var orderListModel
14+
@Environment(POSOrderListModel.self) private var orderListModel
1515
@State private var isShowingEmailReceiptView: Bool = false
1616

1717
private var shouldShowBackButton: Bool {
@@ -60,7 +60,7 @@ struct PointOfSaleOrderDetailsView: View {
6060

6161
// MARK: - Main Sections
6262

63-
private extension PointOfSaleOrderDetailsView {
63+
private extension POSOrderDetailsView {
6464
@ViewBuilder
6565
func productsSection(_ order: POSOrder) -> some View {
6666
VStack(alignment: .leading, spacing: POSSpacing.medium) {
@@ -108,7 +108,7 @@ private extension PointOfSaleOrderDetailsView {
108108

109109
// MARK: - Header Components
110110

111-
private extension PointOfSaleOrderDetailsView {
111+
private extension POSOrderDetailsView {
112112
@ViewBuilder
113113
func headerBottomContent(for order: POSOrder) -> some View {
114114
VStack(alignment: .leading, spacing: POSSpacing.xSmall) {
@@ -131,7 +131,7 @@ private extension PointOfSaleOrderDetailsView {
131131

132132
// MARK: - Product Components
133133

134-
private extension PointOfSaleOrderDetailsView {
134+
private extension POSOrderDetailsView {
135135
@ViewBuilder
136136
func productRow(item: POSOrderItem) -> some View {
137137
HStack(alignment: .top, spacing: POSSpacing.medium) {
@@ -188,7 +188,7 @@ private extension PointOfSaleOrderDetailsView {
188188

189189
// MARK: - Totals Components
190190

191-
private extension PointOfSaleOrderDetailsView {
191+
private extension POSOrderDetailsView {
192192
@ViewBuilder
193193
func productsSubtotalRow(_ order: POSOrder) -> some View {
194194
totalsRow(
@@ -299,7 +299,7 @@ private extension PointOfSaleOrderDetailsView {
299299

300300
// MARK: - Actions
301301

302-
private extension PointOfSaleOrderDetailsView {
302+
private extension POSOrderDetailsView {
303303
enum POSOrderDetailsAction: Identifiable, CaseIterable {
304304
case emailReceipt
305305

@@ -436,7 +436,7 @@ private enum Localization {
436436

437437
#if DEBUG
438438
#Preview("Order Details") {
439-
PointOfSaleOrderDetailsView(
439+
POSOrderDetailsView(
440440
order: POSPreviewHelpers.makePreviewOrder(),
441441
onBack: {}
442442
)

WooCommerce/Classes/POS/Presentation/Orders/PointOfSaleOrderDetailsEmptyView.swift renamed to WooCommerce/Classes/POS/Presentation/Orders/POSOrderDetailsEmptyView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import SwiftUI
22

3-
struct PointOfSaleOrderDetailsEmptyView: View {
3+
struct POSOrderDetailsEmptyView: View {
44
var body: some View {
55
VStack(spacing: 0) {
66
POSPageHeaderView(
@@ -40,6 +40,6 @@ private enum Localization {
4040

4141
#if DEBUG
4242
#Preview {
43-
PointOfSaleOrderDetailsEmptyView()
43+
POSOrderDetailsEmptyView()
4444
}
4545
#endif

WooCommerce/Classes/POS/Presentation/Orders/PointOfSaleOrderDetailsLoadingView.swift renamed to WooCommerce/Classes/POS/Presentation/Orders/POSOrderDetailsLoadingView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import SwiftUI
22

3-
struct PointOfSaleOrderDetailsLoadingView: View {
3+
struct POSOrderDetailsLoadingView: View {
44
var body: some View {
55
VStack(spacing: 0) {
66
POSPageHeaderView(
@@ -177,6 +177,6 @@ private enum Localization {
177177

178178
#if DEBUG
179179
#Preview {
180-
PointOfSaleOrderDetailsLoadingView()
180+
POSOrderDetailsLoadingView()
181181
}
182182
#endif

0 commit comments

Comments
 (0)