Skip to content

Commit 12600d4

Browse files
authored
[POS as a tab i1] Remove POS entry point and related code from the Menu tab (#15939)
2 parents 911f10c + 598321d commit 12600d4

File tree

7 files changed

+2
-625
lines changed

7 files changed

+2
-625
lines changed

Modules/Sources/Experiments/FeatureFlag.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,7 @@ public enum FeatureFlag: Int {
131131
///
132132
case subscriptionsInOrderCreationCustomers
133133

134-
/// Enables the Point Of Sale entry point under the Menu tab, if all requirements pass.
135-
/// Please check the `POSEligibilityChecker` class for additional requirements in order to enable the feature.
134+
/// Enables the Point Of Sale when remote feature flag is disabled.
136135
///
137136
case pointOfSale
138137

WooCommerce/Classes/ViewRelated/Dashboard/Settings/POS/POSEligibilityChecker.swift

Lines changed: 0 additions & 160 deletions
This file was deleted.

WooCommerce/Classes/ViewRelated/Hub Menu/HubMenu.swift

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -31,46 +31,6 @@ struct HubMenu: View {
3131
.onAppear {
3232
viewModel.setupMenuElements()
3333
}
34-
.fullScreenCover(isPresented: $viewModel.showsPOS) {
35-
if let cardPresentPaymentService = viewModel.cardPresentPaymentService,
36-
let receiptService = POSReceiptService(siteID: viewModel.siteID,
37-
credentials: viewModel.credentials),
38-
let orderService = POSOrderService(siteID: viewModel.siteID,
39-
credentials: viewModel.credentials),
40-
#available(iOS 17.0, *) {
41-
PointOfSaleEntryPointView(
42-
itemsController: PointOfSaleItemsController(
43-
itemProvider: PointOfSaleItemService(
44-
currencySettings: ServiceLocator.currencySettings),
45-
itemFetchStrategyFactory: viewModel.posItemFetchStrategyFactory),
46-
purchasableItemsSearchController: PointOfSaleItemsController(
47-
itemProvider: PointOfSaleItemService(
48-
currencySettings: ServiceLocator.currencySettings),
49-
itemFetchStrategyFactory: viewModel.posItemFetchStrategyFactory,
50-
initialState: .init(containerState: .content,
51-
itemsStack: .init(root: .loaded([], hasMoreItems: true), itemStates: [:]))),
52-
couponsController: PointOfSaleCouponsController(itemProvider: viewModel.posCouponProvider,
53-
fetchStrategyFactory: viewModel.posCouponFetchStrategyFactory),
54-
couponsSearchController: PointOfSaleCouponsController(itemProvider: viewModel.posCouponProvider,
55-
fetchStrategyFactory: viewModel.posCouponFetchStrategyFactory),
56-
onPointOfSaleModeActiveStateChange: { isEnabled in
57-
viewModel.updateDefaultConfigurationForPointOfSale(isEnabled)
58-
},
59-
cardPresentPaymentService: cardPresentPaymentService,
60-
orderController: PointOfSaleOrderController(orderService: orderService,
61-
receiptService: receiptService),
62-
collectOrderPaymentAnalyticsTracker: viewModel.collectOrderPaymentAnalyticsTracker,
63-
searchHistoryService: POSSearchHistoryService(siteID: viewModel.siteID),
64-
popularPurchasableItemsController: PointOfSaleItemsController(
65-
itemProvider: PointOfSaleItemService(currencySettings: ServiceLocator.currencySettings),
66-
itemFetchStrategyFactory: viewModel.posPopularItemFetchStrategyFactory),
67-
barcodeScanService: viewModel.barcodeScanService,
68-
posEligibilityChecker: LegacyPOSTabEligibilityChecker(siteID: viewModel.siteID))
69-
} else {
70-
// TODO: When we have a singleton for the card payment service, this should not be required.
71-
Text("Error creating card payment service")
72-
}
73-
}
7434
}
7535
}
7636

@@ -86,8 +46,6 @@ struct HubMenu: View {
8646
ServiceLocator.analytics.track(.hubMenuSettingsTapped)
8747
case HubMenuViewModel.Blaze.id:
8848
ServiceLocator.analytics.track(event: .Blaze.blazeCampaignListEntryPointSelected(source: .menu))
89-
case HubMenuViewModel.PointOfSaleEntryPoint.id:
90-
viewModel.showsPOS = true
9149
default:
9250
break
9351
}

WooCommerce/Classes/ViewRelated/Hub Menu/HubMenuViewModel.swift

Lines changed: 1 addition & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,10 @@ final class HubMenuViewModel: ObservableObject {
8282
@Published private(set) var hasGoogleAdsCampaigns = false
8383
@Published private var currentSite: Yosemite.Site?
8484

85-
/// Whether the app is in POS mode for an eligible site.
86-
@Published var showsPOS: Bool = false
87-
8885
private let stores: StoresManager
8986
private let featureFlagService: FeatureFlagService
9087
private let generalAppSettings: GeneralAppSettingsStorage
9188
private let cardPresentPaymentsOnboarding: CardPresentPaymentsOnboardingUseCaseProtocol
92-
private let posEligibilityChecker: POSEligibilityCheckerProtocol
9389
private let inboxEligibilityChecker: InboxEligibilityChecker
9490
private let blazeEligibilityChecker: BlazeEligibilityCheckerProtocol
9591
private let googleAdsEligibilityChecker: GoogleAdsEligibilityChecker
@@ -177,9 +173,6 @@ final class HubMenuViewModel: ObservableObject {
177173
self.blazeEligibilityChecker = blazeEligibilityChecker
178174
self.googleAdsEligibilityChecker = googleAdsEligibilityChecker
179175
self.cardPresentPaymentsOnboarding = CardPresentPaymentsOnboardingUseCase()
180-
self.posEligibilityChecker = POSEligibilityChecker(siteSettings: ServiceLocator.selectedSiteSettings,
181-
currencySettings: ServiceLocator.currencySettings,
182-
featureFlagService: featureFlagService)
183176
self.analytics = analytics
184177
observeSiteForUIUpdates()
185178
observePlanName()
@@ -210,7 +203,6 @@ final class HubMenuViewModel: ObservableObject {
210203
/// Resets the menu elements displayed on the menu.
211204
///
212205
func setupMenuElements() {
213-
setupPOSElement()
214206
setupSettingsElements()
215207
setupGeneralElements()
216208
}
@@ -250,14 +242,7 @@ final class HubMenuViewModel: ObservableObject {
250242
}
251243

252244
func trackMenuItemTapEvent(menu: HubMenuItem) {
253-
let eventProperties: [AnyHashable: Any] = {
254-
var properties: [AnyHashable: Any] = [AnalyticsKeys.trackingOption: menu.trackingOption]
255-
if menu.id == HubMenuViewModel.PointOfSaleEntryPoint.id {
256-
properties[AnalyticsKeys.paymentsOnboardingState] = cardPresentPaymentsOnboarding.state.reasonForAnalytics
257-
}
258-
return properties
259-
}()
260-
analytics.track(.hubMenuOptionTapped, withProperties: eventProperties)
245+
analytics.track(.hubMenuOptionTapped, withProperties: [AnalyticsKeys.trackingOption: menu.trackingOption])
261246
}
262247

263248
func createGoogleAdsCampaignCoordinator(with navigationController: UINavigationController) -> GoogleAdsCampaignCoordinator {
@@ -313,21 +298,6 @@ private extension HubMenuViewModel {
313298
}
314299
}
315300

316-
func setupPOSElement() {
317-
guard featureFlagService.isFeatureFlagEnabled(.pointOfSaleAsATabi1) == false else {
318-
return
319-
}
320-
321-
posEligibilityChecker.isEligible.map { isEligibleForPOS in
322-
if isEligibleForPOS {
323-
return PointOfSaleEntryPoint()
324-
} else {
325-
return nil
326-
}
327-
}
328-
.assign(to: &$posElement)
329-
}
330-
331301
func setupSettingsElements() {
332302
settingsElements = [Settings()]
333303

@@ -694,20 +664,6 @@ extension HubMenuViewModel {
694664
let navigationDestination: HubMenuNavigationDestination? = .reviews
695665
}
696666

697-
struct PointOfSaleEntryPoint: HubMenuItem {
698-
static var id = "pointOfSale"
699-
700-
let title: String = Localization.pos
701-
let description: String = Localization.posDescription
702-
let icon: UIImage = .pointOfSaleImage
703-
let iconColor: UIColor = .withColorStudio(.green, shade: .shade30)
704-
let accessibilityIdentifier: String = "menu-pointOfSale"
705-
let trackingOption: String = "pointOfSale"
706-
let iconBadge: HubMenuBadgeType? = nil
707-
// POS is presented with its own navigation stack as nested navigation stack is not supported.
708-
let navigationDestination: HubMenuNavigationDestination? = nil
709-
}
710-
711667
struct Subscriptions: HubMenuItem {
712668
static var id = "subscriptions"
713669

@@ -785,15 +741,6 @@ extension HubMenuViewModel {
785741
"My Store",
786742
comment: "Title of the hub menu view in case there is no title for the store")
787743

788-
static let pos = NSLocalizedString(
789-
"Point of Sale Mode",
790-
comment: "Title of the POS menu in the hub menu")
791-
792-
static let posDescription = NSLocalizedString(
793-
"hubMenu.pointOfSale.description",
794-
value: "Accept payments at your physical store",
795-
comment: "Description of the POS menu in the hub menu")
796-
797744
static let woocommerceAdmin = NSLocalizedString(
798745
"WooCommerce Admin",
799746
comment: "Title of one of the hub menu options")
@@ -855,7 +802,6 @@ extension HubMenuViewModel {
855802

856803
enum AnalyticsKeys {
857804
static let trackingOption = "option"
858-
static let paymentsOnboardingState = "payments_onboarding_state"
859805
}
860806
}
861807

0 commit comments

Comments
 (0)