Skip to content

Commit 4ceaafd

Browse files
authored
[Woo POS][Historical Orders] Order List and Details Split view layout (#16031)
2 parents e60ecaa + b20e96e commit 4ceaafd

File tree

99 files changed

+245
-429
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+245
-429
lines changed

Modules/Tests/YosemiteTests/PointOfSale/POSSearchHistoryServiceTests.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ struct POSSearchHistoryServiceTests {
4343
#expect(history[2] == "first")
4444
}
4545

46-
@available(iOS 17.0, *)
4746
@Test func saveSuccessfulSearch_removes_duplicates() throws {
4847
// Given
4948
let itemType: POSItemType = .product

WooCommerce/Classes/POS/Controllers/POSEntryPointController.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import SwiftUI
22
import protocol Experiments.FeatureFlagService
33

4-
@available(iOS 17.0, *)
54
@Observable final class POSEntryPointController {
65
private(set) var eligibilityState: POSEligibilityState?
76
private let posEligibilityChecker: POSEntryPointEligibilityCheckerProtocol

WooCommerce/Classes/POS/Controllers/PointOfSaleCouponsController.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@ import protocol Yosemite.PointOfSaleCouponServiceProtocol
66
import struct Yosemite.PointOfSaleCouponFetchStrategyFactory
77
import protocol Yosemite.PointOfSaleCouponFetchStrategy
88

9-
@available(iOS 17.0, *)
109
protocol PointOfSaleCouponsControllerProtocol: PointOfSaleSearchingItemsControllerProtocol {
1110
/// Enables coupons in store settings
1211
/// Returns true if coupons enabled
1312
func enableCoupons() async
1413
}
1514

16-
@available(iOS 17.0, *)
1715
@Observable final class PointOfSaleCouponsController: PointOfSaleCouponsControllerProtocol {
1816
var itemsViewState: ItemsViewState = ItemsViewState(containerState: .content,
1917
itemsStack: ItemsStackState(root: .loading([]),
@@ -94,7 +92,6 @@ protocol PointOfSaleCouponsControllerProtocol: PointOfSaleSearchingItemsControll
9492
}
9593
}
9694

97-
@available(iOS 17.0, *)
9895
private extension PointOfSaleCouponsController {
9996
/// Loads the first page by attempting to load the first page from local storage
10097
/// then syncs from the remote regardless the result
@@ -140,7 +137,6 @@ private extension PointOfSaleCouponsController {
140137

141138
// MARK: - View state helpers
142139
//
143-
@available(iOS 17.0, *)
144140
private extension PointOfSaleCouponsController {
145141
func setSearchingState() {
146142
itemsViewState.itemsStack.root = .loading([])

WooCommerce/Classes/POS/Controllers/PointOfSaleItemsController.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import class Yosemite.Store
1111
import enum Yosemite.POSItemType
1212

1313

14-
@available(iOS 17.0, *)
1514
protocol PointOfSaleItemsControllerProtocol {
1615
///
1716
var itemsViewState: ItemsViewState { get }
@@ -23,15 +22,13 @@ protocol PointOfSaleItemsControllerProtocol {
2322
func loadNextItems(base: ItemListBaseItem) async
2423
}
2524

26-
@available(iOS 17.0, *)
2725
protocol PointOfSaleSearchingItemsControllerProtocol: PointOfSaleItemsControllerProtocol {
2826
/// Searches for items
2927
func searchItems(searchTerm: String, baseItem: ItemListBaseItem) async
3028
func clearSearchItems(baseItem: ItemListBaseItem)
3129
}
3230

3331

34-
@available(iOS 17.0, *)
3532
@Observable final class PointOfSaleItemsController: PointOfSaleSearchingItemsControllerProtocol {
3633
var itemsViewState: ItemsViewState
3734
private let paginationTracker: AsyncPaginationTracker
@@ -198,7 +195,6 @@ protocol PointOfSaleSearchingItemsControllerProtocol: PointOfSaleItemsController
198195
}
199196
}
200197

201-
@available(iOS 17.0, *)
202198
private extension PointOfSaleItemsController {
203199
func setLoadingState(base: ItemListBaseItem) {
204200
switch base {
@@ -241,7 +237,6 @@ private extension PointOfSaleItemsController {
241237
}
242238
}
243239

244-
@available(iOS 17.0, *)
245240
private extension PointOfSaleItemsController {
246241
/// Fetches items given a page number and appends new unique items to the `allItems` array.
247242
/// - Parameter pageNumber: Page number to fetch items from.
@@ -309,7 +304,6 @@ private extension PointOfSaleItemsController {
309304
}
310305

311306
// MARK: - ItemsViewState Updates
312-
@available(iOS 17.0, *)
313307
private extension PointOfSaleItemsController {
314308
func updateState(for parent: POSItem, to state: ItemListState) {
315309
let viewState = itemsViewState

WooCommerce/Classes/POS/Controllers/PointOfSaleOrderController.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ protocol PointOfSaleOrderControllerProtocol {
3939
func collectCashPayment(changeDueAmount: String?) async throws
4040
}
4141

42-
@available(iOS 17.0, *)
4342
@Observable final class PointOfSaleOrderController: PointOfSaleOrderControllerProtocol {
4443
init(orderService: POSOrderServiceProtocol,
4544
receiptService: POSReceiptServiceProtocol,
@@ -168,7 +167,6 @@ protocol PointOfSaleOrderControllerProtocol {
168167
}
169168
}
170169

171-
@available(iOS 17.0, *)
172170
private extension PointOfSaleOrderController {
173171
func totals(for order: Order) -> PointOfSaleOrderTotals {
174172
let totalsCalculator = OrderTotalsCalculator(for: order,
@@ -210,7 +208,6 @@ private extension PointOfSaleOrderController {
210208
}
211209
}
212210

213-
@available(iOS 17.0, *)
214211
private extension PointOfSaleOrderController {
215212
@MainActor
216213
func isPluginSupported(_ plugin: Plugin, minimumVersion: String, siteID: Int64) -> Bool {
@@ -231,7 +228,6 @@ private extension PointOfSaleOrderController {
231228

232229
// MARK: - Error Handling
233230

234-
@available(iOS 17.0, *)
235231
private extension PointOfSaleOrderController {
236232
func orderStateError(from error: Error) -> PointOfSaleOrderState.OrderStateError {
237233
if let couponsError = CouponsError(underlyingError: error) {
@@ -244,7 +240,6 @@ private extension PointOfSaleOrderController {
244240
}
245241
}
246242

247-
@available(iOS 17.0, *)
248243
private extension PointOfSaleOrderController {
249244
enum POSReceiptEligibilityConstants {
250245
static let wcPluginMinimumVersion = "10.0.0"
@@ -300,7 +295,6 @@ extension PointOfSaleInternalOrderState: Equatable {
300295
}
301296
}
302297

303-
@available(iOS 17.0, *)
304298
extension PointOfSaleOrderController {
305299
enum PointOfSaleOrderControllerError: Error {
306300
case noSiteID
@@ -309,7 +303,6 @@ extension PointOfSaleOrderController {
309303
}
310304

311305

312-
@available(iOS 17.0, *)
313306
private extension PointOfSaleOrderController {
314307
func trackOrderCreationFailed(error: Error) {
315308
var errorType: WooAnalyticsEvent.Orders.OrderCreationErrorType?

WooCommerce/Classes/POS/Models/ItemsStackState.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import Foundation
22
import enum Yosemite.POSItem
33
import Observation
44

5-
@available(iOS 17.0, *)
65
@Observable final class ItemsStackState {
76
var root: ItemListState
87
var itemStates: [POSItem: ItemListState]
@@ -13,7 +12,6 @@ import Observation
1312
}
1413
}
1514

16-
@available(iOS 17.0, *)
1715
extension ItemsStackState: Equatable {
1816
static func == (lhs: ItemsStackState, rhs: ItemsStackState) -> Bool {
1917
return lhs.root == rhs.root

WooCommerce/Classes/POS/Models/ItemsViewState.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import Foundation
22
import Observation
33

4-
@available(iOS 17.0, *)
54
@Observable class ItemsViewState {
65
var containerState: ItemsContainerState
76
var itemsStack: ItemsStackState
@@ -12,7 +11,6 @@ import Observation
1211
}
1312
}
1413

15-
@available(iOS 17.0, *)
1614
extension ItemsViewState: Equatable {
1715
static func == (lhs: ItemsViewState, rhs: ItemsViewState) -> Bool {
1816
return lhs.containerState == rhs.containerState

WooCommerce/Classes/POS/Models/PointOfSaleAggregateModel.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import enum Yosemite.POSItemType
1414
import protocol Yosemite.PointOfSaleBarcodeScanServiceProtocol
1515
import enum Yosemite.PointOfSaleBarcodeScanError
1616

17-
@available(iOS 17.0, *)
1817
protocol PointOfSaleAggregateModelProtocol {
1918
var orderStage: PointOfSaleOrderStage { get }
2019

@@ -50,7 +49,6 @@ protocol PointOfSaleAggregateModelProtocol {
5049
func pointOfSaleClosed()
5150
}
5251

53-
@available(iOS 17.0, *)
5452
@Observable final class PointOfSaleAggregateModel: PointOfSaleAggregateModelProtocol {
5553
private(set) var orderStage: PointOfSaleOrderStage = .building
5654

@@ -136,7 +134,6 @@ protocol PointOfSaleAggregateModelProtocol {
136134
}
137135

138136
// MARK: - Cart
139-
@available(iOS 17.0, *)
140137
extension PointOfSaleAggregateModel {
141138
func addToCart(_ item: POSItem) {
142139
trackCustomerInteractionStarted()
@@ -186,7 +183,6 @@ extension PointOfSaleAggregateModel {
186183
}
187184

188185
// MARK: - Barcode Scanning
189-
@available(iOS 17.0, *)
190186
extension PointOfSaleAggregateModel {
191187
func barcodeScanned(_ result: Result<String, HIDBarcodeParserError>) {
192188
Task { @MainActor [weak self] in
@@ -263,7 +259,6 @@ extension PointOfSaleAggregateModel {
263259
}
264260

265261
// MARK: - Search
266-
@available(iOS 17.0, *)
267262
extension PointOfSaleAggregateModel {
268263
func saveSearchTerm(_ term: String, for itemType: POSItemType) {
269264
searchHistoryService.saveSuccessfulSearch(term: term, for: itemType)
@@ -275,7 +270,6 @@ extension PointOfSaleAggregateModel {
275270
}
276271

277272
// MARK: - Track events
278-
@available(iOS 17.0, *)
279273
private extension PointOfSaleAggregateModel {
280274
func trackCustomerInteractionStarted() {
281275
// At the moment we're assumming that an interaction starts simply when the cart is zero
@@ -303,7 +297,6 @@ private extension PointOfSaleAggregateModel {
303297
}
304298

305299
// MARK: - Card payments
306-
@available(iOS 17.0, *)
307300
extension PointOfSaleAggregateModel {
308301
private func publishCardReaderConnectionStatus() {
309302
cardPresentPaymentService.readerConnectionStatusPublisher
@@ -476,7 +469,6 @@ extension PointOfSaleAggregateModel {
476469
}
477470
}
478471

479-
@available(iOS 17.0, *)
480472
private extension PointOfSaleAggregateModel {
481473
func publishPaymentMessages() {
482474
cardPresentPaymentService.paymentEventPublisher
@@ -594,7 +586,6 @@ private extension PointOfSaleAggregateModel {
594586
}
595587

596588
// MARK: - Order syncing
597-
@available(iOS 17.0, *)
598589
extension PointOfSaleAggregateModel {
599590
@MainActor
600591
func checkOut() async {
@@ -609,7 +600,6 @@ extension PointOfSaleAggregateModel {
609600
}
610601

611602
// MARK: - Lifecycle
612-
@available(iOS 17.0, *)
613603
extension PointOfSaleAggregateModel {
614604
func pointOfSaleClosed() {
615605
// We cancel any payment to prevent the reader from remaining live and awaiting a card tap. Otherwise, it would
@@ -630,7 +620,6 @@ extension PointOfSaleAggregateModel {
630620
}
631621
}
632622

633-
@available(iOS 17.0, *)
634623
private extension PointOfSaleAggregateModel {
635624
enum Constants {
636625
static let initialPage: Int = 1

WooCommerce/Classes/POS/Models/PointOfSaleViewStateCoordinator.swift

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

3-
@available(iOS 17.0, *)
43
protocol PointOfSaleViewStateResettable {
54
/// Resets all view state to its default values.
65
/// This should be called when starting a new cart to ensure the UI returns to its initial state.
@@ -10,7 +9,6 @@ protocol PointOfSaleViewStateResettable {
109
/// Coordinates view-specific state for the Point of Sale interface.
1110
/// This coordinator manages UI state that needs to persist across the POS experience
1211
/// but should be reset when starting a new cart/order.
13-
@available(iOS 17.0, *)
1412
@Observable final class PointOfSaleViewStateCoordinator: PointOfSaleViewStateResettable {
1513
/// The currently selected item list type, shown when building the cart.
1614
/// When we reset, the non-searched products list is shown for the new cart.

WooCommerce/Classes/POS/Presentation/Barcode Scanner Setup/PointOfSaleBarcodeScannerSetup.swift

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

3-
@available(iOS 17.0, *)
43
struct PointOfSaleBarcodeScannerSetup: View {
54
@Binding var isPresented: Bool
65
@State private var flowManager: PointOfSaleBarcodeScannerSetupFlowManager
@@ -91,7 +90,6 @@ private enum Constants {
9190
}
9291

9392
// MARK: - Private Localization Extension
94-
@available(iOS 17.0, *)
9593
private extension PointOfSaleBarcodeScannerSetup {
9694
enum Localization {
9795
static let starBSH20BTitle = NSLocalizedString(
@@ -119,7 +117,6 @@ private extension PointOfSaleBarcodeScannerSetup {
119117

120118
// MARK: - Previews
121119

122-
@available(iOS 17.0, *)
123120
#Preview {
124121
PointOfSaleBarcodeScannerSetup(isPresented: .constant(true))
125122
}
@@ -131,7 +128,6 @@ private extension PointOfSaleBarcodeScannerSetup {
131128
/// - On content change: fades out old content, replaces it, then fades in new content.
132129
/// - Handles height changes with a spring animation.
133130
///
134-
@available(iOS 17.0, *)
135131
private struct AnimatedTransitionContainer<Content: View, ID: Equatable>: View {
136132
let maxWidth: CGFloat
137133
let maxHeight: CGFloat

0 commit comments

Comments
 (0)