Skip to content

Commit 04522c6

Browse files
authored
[Beta fix] Hides GhostItemCardView rendering behind feature flag (#14373)
2 parents 2abad4e + 3b334d0 commit 04522c6

File tree

5 files changed

+14
-3
lines changed

5 files changed

+14
-3
lines changed

Experiments/Experiments/DefaultFeatureFlagService.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ public struct DefaultFeatureFlagService: FeatureFlagService {
9090
return buildConfig == .localDeveloper || buildConfig == .alpha
9191
case .paymentsOnboardingInPointOfSale:
9292
return buildConfig == .localDeveloper
93+
case .displayInfiniteScrollingUIDetailsInPointOfSale:
94+
return buildConfig == .localDeveloper || buildConfig == .alpha
9395
default:
9496
return true
9597
}

Experiments/Experiments/FeatureFlag.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,4 +196,8 @@ public enum FeatureFlag: Int {
196196
/// Supports Woo Payments onboarding in POS so that merchants who have not completed onboarding can access POS.
197197
///
198198
case paymentsOnboardingInPointOfSale
199+
200+
/// Enables UI-related aspects of infinite scrolling in POS. It does not affect the actual infinite scrolling behaviour.
201+
///
202+
case displayInfiniteScrollingUIDetailsInPointOfSale
199203
}

WooCommerce/Classes/POS/Presentation/ItemListView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ private extension ItemListView {
131131
})
132132
}
133133
GhostItemCardView()
134-
.renderedIf(viewModel.state == .loading)
134+
.renderedIf(viewModel.shouldShowGhostableItemCard && viewModel.state == .loading)
135135
}
136136
.padding(.bottom, floatingControlAreaSize.height)
137137
.padding(.horizontal, Constants.itemListPadding)

WooCommerce/Classes/POS/Presentation/PointOfSaleEntryPointView.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ struct PointOfSaleEntryPointView: View {
2626
currencyFormatter: currencyFormatter,
2727
paymentState: .acceptingCard)
2828
let cartViewModel = CartViewModel(analytics: analytics)
29-
let itemListViewModel = ItemListViewModel(itemProvider: itemProvider)
29+
30+
let shouldShowGhostableItemCard = ServiceLocator.featureFlagService.isFeatureFlagEnabled(.displayInfiniteScrollingUIDetailsInPointOfSale)
31+
let itemListViewModel = ItemListViewModel(itemProvider: itemProvider, shouldShowGhostableItemCard: shouldShowGhostableItemCard)
3032

3133
self._viewModel = StateObject(wrappedValue: PointOfSaleDashboardViewModel(
3234
cardPresentPaymentService: cardPresentPaymentService,

WooCommerce/Classes/POS/ViewModels/ItemListViewModel.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ final class ItemListViewModel: ItemListViewModelProtocol {
1212

1313
@Published private var currentPage: Int = Constants.initialPage
1414

15+
private(set) var shouldShowGhostableItemCard: Bool = false
16+
1517
var shouldShowHeaderBanner: Bool {
1618
// The banner it's shown as long as it hasn't already been dismissed once:
1719
if UserDefaults.standard.bool(forKey: BannerState.isSimpleProductsOnlyBannerDismissedKey) == true {
@@ -28,8 +30,9 @@ final class ItemListViewModel: ItemListViewModelProtocol {
2830
var itemsPublisher: Published<[POSItem]>.Publisher { $items }
2931
var statePublisher: Published<ItemListViewModel.ItemListState>.Publisher { $state }
3032

31-
init(itemProvider: POSItemProvider) {
33+
init(itemProvider: POSItemProvider, shouldShowGhostableItemCard: Bool = false) {
3234
self.itemProvider = itemProvider
35+
self.shouldShowGhostableItemCard = shouldShowGhostableItemCard
3336
selectedItemPublisher = selectedItemSubject.eraseToAnyPublisher()
3437
}
3538

0 commit comments

Comments
 (0)