Skip to content

Commit dd2f59c

Browse files
authored
[Woo POS][App Listings] POS ASC screenshots (#16355)
2 parents 89f1add + 36d431f commit dd2f59c

File tree

62 files changed

+626
-28
lines changed

Some content is hidden

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

62 files changed

+626
-28
lines changed

Modules/Sources/PointOfSale/Controllers/PointOfSaleItemsController.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Foundation
22
import Observation
33
import enum Yosemite.POSItem
4+
import struct Yosemite.POSSimpleProduct
45
import class Yosemite.PointOfSaleItemService
56
import protocol Yosemite.PointOfSaleItemServiceProtocol
67
import protocol Yosemite.PointOfSaleItemFetchStrategyFactoryProtocol

Modules/Sources/PointOfSale/Presentation/CardReaderConnection/CardReaderConnectionStatusView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ struct CardReaderConnectionStatusView: View {
3434
.padding(.horizontal, Constants.horizontalPadding)
3535
.frame(maxHeight: .infinity)
3636
}
37+
.accessibilityIdentifier("pos-reader-connected")
3738
case .disconnecting:
3839
progressIndicatingCardReaderStatus(title: Localization.readerDisconnecting)
3940
case .cancellingConnection:
@@ -55,6 +56,7 @@ struct CardReaderConnectionStatusView: View {
5556
)
5657
.padding(Constants.disconnectedBorderInset)
5758
}
59+
.accessibilityIdentifier("pos-connect-reader-button")
5860
}
5961
}
6062
.font(Constants.font)

Modules/Sources/PointOfSale/Presentation/CardReaderConnection/UI States/Reader Messages/PointOfSaleCardPresentPaymentTapSwipeInsertCardMessageView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ struct PointOfSaleCardPresentPaymentTapSwipeInsertCardMessageView: View {
2424
}
2525
}
2626
.multilineTextAlignment(.center)
27+
.accessibilityIdentifier("pos-card-payment-message")
2728
}
2829
}
2930

Modules/Sources/PointOfSale/Presentation/CardReaderConnection/UI States/Reader Messages/PointOfSalePaymentSuccessView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ struct PointOfSalePaymentSuccessView: View {
3131
}
3232
}
3333
}
34+
.accessibilityIdentifier("pos-payment-success-view")
3435
.onAppear {
3536
withAnimation(.spring(response: 0.6, dampingFraction: 0.8)) {
3637
isViewLoaded = true

Modules/Sources/PointOfSale/Presentation/CartView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ struct CartView: View {
8080
})
8181
.background(backgroundColor.ignoresSafeArea(.all))
8282
.accessibilityElement(children: .contain)
83+
.accessibilityIdentifier("pos-cart-view")
8384
}
8485
}
8586
}
@@ -175,6 +176,7 @@ private extension CartView {
175176
}
176177
.buttonStyle(POSFilledButtonStyle(size: .normal))
177178
.disabled(CartViewHelper().hasUnresolvedItems(cart: posModel.cart))
179+
.accessibilityIdentifier("pos-checkout-button")
178180
}
179181

180182
var backButtonConfiguration: POSPageHeaderBackButtonConfiguration? {

Modules/Sources/PointOfSale/Presentation/Item Selector/ItemList.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ struct ItemListRow: View {
156156
}, label: {
157157
SimpleProductCardView(product: product)
158158
})
159+
.accessibilityIdentifier("pos-product-card-\(product.productID)")
159160
case let .variableParentProduct(parentProduct):
160161
if #available(iOS 18.0, *) {
161162
NavigationLink(value: item) {

Modules/Sources/PointOfSale/Presentation/POSFloatingControlView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ struct POSFloatingControlView: View {
4040
}
4141
.frame(width: Constants.size)
4242
}
43+
.accessibilityIdentifier("pos-menu-button")
4344
.background(backgroundColor)
4445
.cornerRadius(Constants.cornerRadius)
4546
.disabled(posModel.paymentState.card == .processingPayment)
@@ -78,6 +79,7 @@ private extension POSFloatingControlView {
7879
icon: { Image(systemName: "rectangle.portrait.and.arrow.forward") }
7980
)
8081
}
82+
.accessibilityIdentifier("pos-exit-menu-item")
8183
Button {
8284
analytics.track(.pointOfSaleSettingsMenuItemTapped)
8385
showSettings = true

Modules/Sources/PointOfSale/Presentation/PointOfSaleCollectCashView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ struct PointOfSaleCollectCashView: View {
9797
buttonFrame = $0
9898
}
9999
.buttonStyle(POSFilledButtonStyle(size: .normal, isLoading: isLoading))
100+
.accessibilityIdentifier("pos-mark-payment-complete-button")
100101
.frame(maxWidth: .infinity)
101102
.dynamicTypeSize(...DynamicTypeSize.accessibility1)
102103
.disabled(!isButtonEnabled)

Modules/Sources/PointOfSale/Presentation/PointOfSaleDashboardView.swift

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,13 @@ struct PointOfSaleDashboardView: View {
150150
}
151151
}
152152
.onChange(of: posModel.entryPointController.eligibilityState) { oldValue, newValue in
153-
guard newValue == .eligible else { return }
154-
Task { @MainActor in
155-
await posModel.purchasableItemsController.loadItems(base: .root)
156-
await posModel.couponsController.loadItems(base: .root)
157-
await posModel.popularPurchasableItemsController.loadItems(base: .root)
158-
}
153+
guard case .eligible = newValue, oldValue != newValue else { return }
154+
loadItemsWhenEligible()
159155
}
160156
.ignoresSafeArea(.keyboard)
161157
.onAppear {
162158
trackTimeForInitialLoadingState()
159+
loadItemsWhenEligible()
163160
}
164161
.onChange(of: viewState) { oldValue, newValue in
165162
if newValue == .content && oldValue != newValue {
@@ -249,6 +246,14 @@ private extension PointOfSaleDashboardView {
249246
self.waitingTimeTracker = nil
250247
}
251248
}
249+
250+
func loadItemsWhenEligible() {
251+
Task { @MainActor in
252+
await posModel.purchasableItemsController.loadItems(base: .root)
253+
await posModel.couponsController.loadItems(base: .root)
254+
await posModel.popularPurchasableItemsController.loadItems(base: .root)
255+
}
256+
}
252257
}
253258

254259
struct FloatingControlAreaSizeKey: EnvironmentKey {

Modules/Sources/PointOfSale/Presentation/PointOfSaleEntryPointView.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import class Yosemite.PointOfSaleItemService
1515
import protocol Yosemite.PointOfSaleSettingsServiceProtocol
1616
import struct Yosemite.SiteSetting
1717
import protocol Yosemite.PointOfSaleCouponFetchStrategyFactoryProtocol
18+
import protocol Yosemite.PointOfSaleItemServiceProtocol
1819

1920
/// periphery: ignore - public in preparation of move to POS module
2021
public struct PointOfSaleEntryPointView: View {
@@ -67,9 +68,12 @@ public struct PointOfSaleEntryPointView: View {
6768
grdbManager: GRDBManagerProtocol?,
6869
catalogSyncCoordinator: POSCatalogSyncCoordinatorProtocol?,
6970
isLocalCatalogEligible: Bool,
70-
services: POSDependencyProviding) {
71+
services: POSDependencyProviding,
72+
itemProvider: PointOfSaleItemServiceProtocol? = nil) {
7173
self.onPointOfSaleModeActiveStateChange = onPointOfSaleModeActiveStateChange
7274

75+
let selectedItemProvider = itemProvider ?? PointOfSaleItemService(currencySettings: services.currency.currencySettings)
76+
7377
// Use observable controller with GRDB if local catalog is eligible,
7478
// otherwise fall back to standard controller.
7579
if isLocalCatalogEligible, let grdbManager = grdbManager, let catalogSyncCoordinator {
@@ -81,13 +85,13 @@ public struct PointOfSaleEntryPointView: View {
8185
)
8286
} else {
8387
self.itemsController = PointOfSaleItemsController(
84-
itemProvider: PointOfSaleItemService(currencySettings: services.currency.currencySettings),
88+
itemProvider: selectedItemProvider,
8589
itemFetchStrategyFactory: itemFetchStrategyFactory,
8690
analyticsProvider: services.analytics
8791
)
8892
}
8993
self.purchasableItemsSearchController = PointOfSaleItemsController(
90-
itemProvider: PointOfSaleItemService(currencySettings: services.currency.currencySettings),
94+
itemProvider: selectedItemProvider,
9195
itemFetchStrategyFactory: itemFetchStrategyFactory,
9296
initialState: .init(containerState: .content,
9397
itemsStack: .init(root: .loaded([], hasMoreItems: true), itemStates: [:])),
@@ -121,7 +125,7 @@ public struct PointOfSaleEntryPointView: View {
121125
self.collectOrderPaymentAnalyticsTracker = collectOrderPaymentAnalyticsTracker
122126
self.searchHistoryService = searchHistoryService
123127
self.popularPurchasableItemsController = PointOfSaleItemsController(
124-
itemProvider: PointOfSaleItemService(currencySettings: services.currency.currencySettings),
128+
itemProvider: selectedItemProvider,
125129
itemFetchStrategyFactory: popularItemFetchStrategyFactory,
126130
analyticsProvider: services.analytics
127131
)

0 commit comments

Comments
 (0)