Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Modules/Sources/Experiments/FeatureFlag.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ public enum FeatureFlag: Int {
///
case subscriptionsInOrderCreationCustomers

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

Expand Down

This file was deleted.

42 changes: 0 additions & 42 deletions WooCommerce/Classes/ViewRelated/Hub Menu/HubMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,46 +31,6 @@ struct HubMenu: View {
.onAppear {
viewModel.setupMenuElements()
}
.fullScreenCover(isPresented: $viewModel.showsPOS) {
if let cardPresentPaymentService = viewModel.cardPresentPaymentService,
let receiptService = POSReceiptService(siteID: viewModel.siteID,
credentials: viewModel.credentials),
let orderService = POSOrderService(siteID: viewModel.siteID,
credentials: viewModel.credentials),
#available(iOS 17.0, *) {
PointOfSaleEntryPointView(
itemsController: PointOfSaleItemsController(
itemProvider: PointOfSaleItemService(
currencySettings: ServiceLocator.currencySettings),
itemFetchStrategyFactory: viewModel.posItemFetchStrategyFactory),
purchasableItemsSearchController: PointOfSaleItemsController(
itemProvider: PointOfSaleItemService(
currencySettings: ServiceLocator.currencySettings),
itemFetchStrategyFactory: viewModel.posItemFetchStrategyFactory,
initialState: .init(containerState: .content,
itemsStack: .init(root: .loaded([], hasMoreItems: true), itemStates: [:]))),
couponsController: PointOfSaleCouponsController(itemProvider: viewModel.posCouponProvider,
fetchStrategyFactory: viewModel.posCouponFetchStrategyFactory),
couponsSearchController: PointOfSaleCouponsController(itemProvider: viewModel.posCouponProvider,
fetchStrategyFactory: viewModel.posCouponFetchStrategyFactory),
onPointOfSaleModeActiveStateChange: { isEnabled in
viewModel.updateDefaultConfigurationForPointOfSale(isEnabled)
},
cardPresentPaymentService: cardPresentPaymentService,
orderController: PointOfSaleOrderController(orderService: orderService,
receiptService: receiptService),
collectOrderPaymentAnalyticsTracker: viewModel.collectOrderPaymentAnalyticsTracker,
searchHistoryService: POSSearchHistoryService(siteID: viewModel.siteID),
popularPurchasableItemsController: PointOfSaleItemsController(
itemProvider: PointOfSaleItemService(currencySettings: ServiceLocator.currencySettings),
itemFetchStrategyFactory: viewModel.posPopularItemFetchStrategyFactory),
barcodeScanService: viewModel.barcodeScanService,
posEligibilityChecker: LegacyPOSTabEligibilityChecker(siteID: viewModel.siteID))
} else {
// TODO: When we have a singleton for the card payment service, this should not be required.
Text("Error creating card payment service")
}
}
}
}

Expand All @@ -86,8 +46,6 @@ struct HubMenu: View {
ServiceLocator.analytics.track(.hubMenuSettingsTapped)
case HubMenuViewModel.Blaze.id:
ServiceLocator.analytics.track(event: .Blaze.blazeCampaignListEntryPointSelected(source: .menu))
case HubMenuViewModel.PointOfSaleEntryPoint.id:
viewModel.showsPOS = true
default:
break
}
Expand Down
56 changes: 1 addition & 55 deletions WooCommerce/Classes/ViewRelated/Hub Menu/HubMenuViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,10 @@ final class HubMenuViewModel: ObservableObject {
@Published private(set) var hasGoogleAdsCampaigns = false
@Published private var currentSite: Yosemite.Site?

/// Whether the app is in POS mode for an eligible site.
@Published var showsPOS: Bool = false

private let stores: StoresManager
private let featureFlagService: FeatureFlagService
private let generalAppSettings: GeneralAppSettingsStorage
private let cardPresentPaymentsOnboarding: CardPresentPaymentsOnboardingUseCaseProtocol
private let posEligibilityChecker: POSEligibilityCheckerProtocol
private let inboxEligibilityChecker: InboxEligibilityChecker
private let blazeEligibilityChecker: BlazeEligibilityCheckerProtocol
private let googleAdsEligibilityChecker: GoogleAdsEligibilityChecker
Expand Down Expand Up @@ -177,9 +173,6 @@ final class HubMenuViewModel: ObservableObject {
self.blazeEligibilityChecker = blazeEligibilityChecker
self.googleAdsEligibilityChecker = googleAdsEligibilityChecker
self.cardPresentPaymentsOnboarding = CardPresentPaymentsOnboardingUseCase()
self.posEligibilityChecker = POSEligibilityChecker(siteSettings: ServiceLocator.selectedSiteSettings,
currencySettings: ServiceLocator.currencySettings,
featureFlagService: featureFlagService)
self.analytics = analytics
observeSiteForUIUpdates()
observePlanName()
Expand Down Expand Up @@ -210,7 +203,6 @@ final class HubMenuViewModel: ObservableObject {
/// Resets the menu elements displayed on the menu.
///
func setupMenuElements() {
setupPOSElement()
setupSettingsElements()
setupGeneralElements()
}
Expand Down Expand Up @@ -250,14 +242,7 @@ final class HubMenuViewModel: ObservableObject {
}

func trackMenuItemTapEvent(menu: HubMenuItem) {
let eventProperties: [AnyHashable: Any] = {
var properties: [AnyHashable: Any] = [AnalyticsKeys.trackingOption: menu.trackingOption]
if menu.id == HubMenuViewModel.PointOfSaleEntryPoint.id {
properties[AnalyticsKeys.paymentsOnboardingState] = cardPresentPaymentsOnboarding.state.reasonForAnalytics
}
return properties
}()
analytics.track(.hubMenuOptionTapped, withProperties: eventProperties)
analytics.track(.hubMenuOptionTapped, withProperties: [AnalyticsKeys.trackingOption: menu.trackingOption])
}

func createGoogleAdsCampaignCoordinator(with navigationController: UINavigationController) -> GoogleAdsCampaignCoordinator {
Expand Down Expand Up @@ -313,21 +298,6 @@ private extension HubMenuViewModel {
}
}

func setupPOSElement() {
guard featureFlagService.isFeatureFlagEnabled(.pointOfSaleAsATabi1) == false else {
return
}

posEligibilityChecker.isEligible.map { isEligibleForPOS in
if isEligibleForPOS {
return PointOfSaleEntryPoint()
} else {
return nil
}
}
.assign(to: &$posElement)
}

func setupSettingsElements() {
settingsElements = [Settings()]

Expand Down Expand Up @@ -694,20 +664,6 @@ extension HubMenuViewModel {
let navigationDestination: HubMenuNavigationDestination? = .reviews
}

struct PointOfSaleEntryPoint: HubMenuItem {
static var id = "pointOfSale"

let title: String = Localization.pos
let description: String = Localization.posDescription
let icon: UIImage = .pointOfSaleImage
let iconColor: UIColor = .withColorStudio(.green, shade: .shade30)
let accessibilityIdentifier: String = "menu-pointOfSale"
let trackingOption: String = "pointOfSale"
let iconBadge: HubMenuBadgeType? = nil
// POS is presented with its own navigation stack as nested navigation stack is not supported.
let navigationDestination: HubMenuNavigationDestination? = nil
}

struct Subscriptions: HubMenuItem {
static var id = "subscriptions"

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

static let pos = NSLocalizedString(
"Point of Sale Mode",
comment: "Title of the POS menu in the hub menu")

static let posDescription = NSLocalizedString(
"hubMenu.pointOfSale.description",
value: "Accept payments at your physical store",
comment: "Description of the POS menu in the hub menu")

static let woocommerceAdmin = NSLocalizedString(
"WooCommerce Admin",
comment: "Title of one of the hub menu options")
Expand Down Expand Up @@ -855,7 +802,6 @@ extension HubMenuViewModel {

enum AnalyticsKeys {
static let trackingOption = "option"
static let paymentsOnboardingState = "payments_onboarding_state"
}
}

Expand Down
Loading