Skip to content

Commit

Permalink
Merge branch 'trunk' into issue/14357-use-site-currency-for-order-cre…
Browse files Browse the repository at this point in the history
…ation
  • Loading branch information
joshheald authored Jan 20, 2025
2 parents d22d989 + 268c7c0 commit 3e66d07
Show file tree
Hide file tree
Showing 41 changed files with 385 additions and 1,396 deletions.
5 changes: 5 additions & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
- [Internal] [*] Improved handling of the navigation to the Woo Installation screen post Jetpack setup [https://github.com/woocommerce/woocommerce-ios/pull/14837]
- [*] Receipts: Email receipts can now be sent to customers after failed payments using WooCommerce Stripe 9.1.0+. [https://github.com/woocommerce/woocommerce-ios/pull/14864].
- [*] Order Creation: orders are always created using the store's currency, not the user's [https://github.com/woocommerce/woocommerce-ios/pull/14907]
- [*] Dashboard: Updated the drag gesture on the Performance chart to show stats instantly. [https://github.com/woocommerce/woocommerce-ios/pull/14906]
- [Internal] Removed feedback survey for Store Setup feature [https://github.com/woocommerce/woocommerce-ios/pull/14888]
- [Internal] Removed feedback survey for shipping label creation [https://github.com/woocommerce/woocommerce-ios/pull/14889]
- [Internal] Removed feedback survey for product creation AI [https://github.com/woocommerce/woocommerce-ios/pull/14890]
- [Internal] Removed feedback survey for coupons list [https://github.com/woocommerce/woocommerce-ios/pull/14891]

21.4
-----
Expand Down
8 changes: 0 additions & 8 deletions Storage/Storage/Model/FeedbackType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@ public enum FeedbackType: String, Codable {
///
case general

/// identifier for the shipping labels m3 feedback survey
///
case shippingLabelsRelease3

/// Identifier for the coupon management feedback survey
///
case couponManagement

/// Identifier for the order form shipping lines feedback survey
///
case orderFormShippingLines
Expand Down
8 changes: 0 additions & 8 deletions WooCommerce/Classes/Analytics/WooAnalyticsEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,10 @@ extension WooAnalyticsEvent {
case general
/// Shown in products banner for general feedback.
case productsGeneral = "products_general"
/// Shown in shipping labels banner for Milestone 3 features.
case shippingLabelsRelease3 = "shipping_labels_m3"
/// Shown in beta feature banner for order add-ons.
case addOnsI1 = "add-ons_i1"
/// Shown in orders banner for order creation release.
case orderCreation = "order_creation"
/// Shown in beta feature banner for coupon management.
case couponManagement = "coupon_management"
/// Shown in store setup task list
case storeSetup = "store_setup"
/// Shown in Product details form for a AI generated product
case productCreationAI = "product_creation_ai"
/// Shown in the order form after adding a shipping line
case orderFormShippingLines = "order_form_shipping_lines"
}
Expand Down
4 changes: 0 additions & 4 deletions WooCommerce/Classes/Extensions/UserDefaults+Woo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ extension UserDefaults {
// AI prompt tone
case aiPromptTone

// Product Creation AI
case numberOfTimesProductCreationAISurveySuggested
case didStartProductCreationAISurvey

// Theme installation
case themesPendingInstall

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ private extension PointOfSaleCardPresentPaymentReaderDisconnectedMessageViewMode
)

static let instruction = NSLocalizedString(
"pointOfSale.cardPresent.readerNotConnected.instruction",
value: "To process this payment, please connect your reader.",
comment: "Instruction to merchants shown on the Point of Sale Checkout, so they can take a card payment."
"pointOfSale.cardPresent.readerNotConnectedOrCash.instruction",
value: "To process this payment, please connect your reader or choose cash.",
comment: "Instruction to merchants shown on the Point of Sale Checkout when card reader is not connected."
)

static let collectPayment = NSLocalizedString(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,45 +11,55 @@ struct PointOfSaleCardPresentPaymentSuccessMessageView: View {
@State private var isShowingReceiptNotEligibleBanner: Bool = false

var body: some View {
if isShowingSendReceiptView {
POSSendReceiptView(isShowingSendReceiptView: $isShowingSendReceiptView)
} else {
ZStack {
VStack(alignment: .center, spacing: Constants.headerSpacing) {
successIcon
.renderedIf(!dynamicTypeSize.isAccessibilitySize)
.matchedGeometryEffect(id: animation.iconTransitionId, in: animation.namespace, properties: .position)
VStack(alignment: .center, spacing: Constants.textSpacing) {
Text(viewModel.title)
.font(.posTitleEmphasized)
.foregroundStyle(Color.posPrimaryText)
.accessibilityAddTraits(.isHeader)
.matchedGeometryEffect(id: animation.titleTransitionId, in: animation.namespace, properties: .position)

if let message = viewModel.message {
Text(message)
.font(.posBodyRegular)
VStack {
if isShowingSendReceiptView {
POSSendReceiptView(isShowingSendReceiptView: $isShowingSendReceiptView)
.transition(.asymmetric(
insertion: .move(edge: .trailing).combined(with: .opacity),
removal: .move(edge: .trailing).combined(with: .opacity)))
} else {
ZStack {
VStack(alignment: .center, spacing: Constants.headerSpacing) {
successIcon
.renderedIf(!dynamicTypeSize.isAccessibilitySize)
.matchedGeometryEffect(id: animation.iconTransitionId, in: animation.namespace, properties: .position)
VStack(alignment: .center, spacing: Constants.textSpacing) {
Text(viewModel.title)
.font(.posTitleEmphasized)
.foregroundStyle(Color.posPrimaryText)
.matchedGeometryEffect(id: animation.messageTransitionId, in: animation.namespace, properties: .position)
.accessibilityAddTraits(.isHeader)
.matchedGeometryEffect(id: animation.titleTransitionId, in: animation.namespace, properties: .position)

if let message = viewModel.message {
Text(message)
.font(.posBodyRegular)
.foregroundStyle(Color.posPrimaryText)
.matchedGeometryEffect(id: animation.messageTransitionId, in: animation.namespace, properties: .position)
}
}
PaymentsActionButtons(isShowingSendReceiptView: $isShowingSendReceiptView,
isShowingReceiptNotEligibleBanner: $isShowingReceiptNotEligibleBanner)
.matchedGeometryEffect(id: animation.actionButtonsTransitionId, in: animation.namespace, properties: .position)
}
PaymentsActionButtons(isShowingSendReceiptView: $isShowingSendReceiptView,
isShowingReceiptNotEligibleBanner: $isShowingReceiptNotEligibleBanner)
.matchedGeometryEffect(id: animation.actionButtonsTransitionId, in: animation.namespace, properties: .position)
}
.multilineTextAlignment(.center)
.multilineTextAlignment(.center)

if isShowingReceiptNotEligibleBanner {
VStack {
Spacer()
POSReceiptEligibilityBanner(isVisible: $isShowingReceiptNotEligibleBanner)
.transition(.move(edge: .bottom))
.padding(.bottom)
if isShowingReceiptNotEligibleBanner {
VStack {
Spacer()
POSReceiptEligibilityBanner(isVisible: $isShowingReceiptNotEligibleBanner)
.transition(.move(edge: .bottom))
.padding(.bottom)
}
.edgesIgnoringSafeArea(.bottom)
}
.edgesIgnoringSafeArea(.bottom)
}
.transition(.asymmetric(
insertion: .move(edge: .leading).combined(with: .opacity),
removal: .move(edge: .leading).combined(with: .opacity)
))
}
}
.animation(.default, value: isShowingSendReceiptView)
}

private var successIcon: some View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,22 @@ struct PointOfSaleCollectCashView: View {
allowNegativeNumber: false)

var body: some View {
VStack(alignment: .center, spacing: 20) {
VStack(alignment: .center) {
HStack {
Button(action: {
Task { @MainActor in
await posModel.cancelCashPayment()
}
}, label: {
HStack(alignment: .top) {
Image(systemName: "chevron.left")
.font(.posTitleRegular)
.bold()
Image(systemName: "chevron.backward")
.font(.posBodyEmphasized, maximumContentSizeCategory: .accessibilityLarge)
.foregroundColor(.primary)
VStack(alignment: .leading, spacing: Constants.navigationButtonSpacing) {
VStack(alignment: .leading) {
Text(Localization.backNavigationTitle)
.font(.posTitleRegular)
.bold()
.foregroundColor(.primary)
.font(.posTitleEmphasized)
.foregroundColor(.posPrimaryText)
.accessibilityAddTraits(.isHeader)

Text(formattedOrderTotal)
.font(.posBodyRegular)
Expand All @@ -51,7 +50,6 @@ struct PointOfSaleCollectCashView: View {
})
Spacer()
}
.padding()

FormattableAmountTextField(viewModel: textFieldViewModel, style: .pos)
.onChange(of: textFieldViewModel.amount) { newValue in
Expand Down Expand Up @@ -85,7 +83,7 @@ struct PointOfSaleCollectCashView: View {
isLoading = false
}
}, label: {
HStack(spacing: Constants.buttonSpacing) {
ZStack {
if isLoading {
ProgressView()
.progressViewStyle(CircularProgressViewStyle())
Expand All @@ -95,7 +93,7 @@ struct PointOfSaleCollectCashView: View {
.font(Constants.buttonFont)
}
}
.frame(maxWidth: .infinity)
.frame(maxWidth: .infinity, minHeight: Constants.buttonMinHeight)
})
.padding(Constants.buttonPadding)
.frame(maxWidth: .infinity)
Expand All @@ -108,7 +106,8 @@ struct PointOfSaleCollectCashView: View {
Spacer()
}
.background(backgroundColor)
.padding()
.padding(.top, Constants.navigationHeaderTopPadding)
.padding([.horizontal, .bottom])
.animation(.easeInOut, value: errorMessage)
.animation(.easeInOut, value: changeDueMessage)
.onChange(of: textFieldAmountInput) { _ in
Expand Down Expand Up @@ -142,7 +141,9 @@ private extension PointOfSaleCollectCashView {
enum Constants {
static let buttonSpacing: CGFloat = 12
static let buttonPadding: CGFloat = 32
static let navigationButtonSpacing: CGFloat = 4
static let buttonMinHeight: CGFloat = 32
static let navigationButtonSpacing: CGFloat = 8
static let navigationHeaderTopPadding: CGFloat = 8
static let buttonFont: POSFontStyle = .posBodyEmphasized
static let buttonCornerRadius: CGFloat = 8
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ struct PointOfSaleDashboardView: View {
.task {
await posModel.loadItems(base: .root)
}
.ignoresSafeArea(.keyboard)
}

private var contentView: some View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,24 @@ struct POSSendReceiptView: View {
}

var body: some View {
VStack(alignment: .center, spacing: 20) {
VStack(alignment: .center) {
HStack {
Button(action: {
isShowingSendReceiptView = false
withAnimation {
isShowingSendReceiptView = false
}
}, label: {
HStack {
Image(systemName: "chevron.left")
Image(systemName: "chevron.backward")
Text(Localization.emailReceiptNavigationText)
}
.font(.title)
.bold()
.foregroundColor(.primary)
.font(.posTitleEmphasized)
.foregroundColor(.posPrimaryText)
.accessibilityAddTraits(.isHeader)
})
Spacer()
}
.buttonStyle(.plain)
.padding()
.disabled(isLoading)

TextField(Localization.textfieldPlaceholder, text: $textFieldInput)
Expand Down Expand Up @@ -76,7 +77,7 @@ struct POSSendReceiptView: View {

Spacer()
}
.padding()
.padding([.horizontal, .bottom])
.animation(.easeInOut, value: errorMessage)
.onChange(of: textFieldInput) { _ in
errorMessage = nil
Expand All @@ -93,7 +94,9 @@ struct POSSendReceiptView: View {
do {
errorMessage = nil
try await posModel.sendReceipt(to: textFieldInput)
isShowingSendReceiptView = false
withAnimation {
isShowingSendReceiptView = false
}
} catch {
errorMessage = Localization.sendReceiptErrorText
}
Expand Down
1 change: 1 addition & 0 deletions WooCommerce/Classes/POS/Presentation/TotalsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ private extension TotalsView {
case .collectingCash:
if case .loaded(let total) = posModel.orderState {
PointOfSaleCollectCashView(orderTotal: total.orderTotal)
.transition(.move(edge: .trailing))
}
case .paymentSuccess:
if case .loaded(let total) = posModel.orderState {
Expand Down
2 changes: 0 additions & 2 deletions WooCommerce/Classes/System/SessionManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,6 @@ final class SessionManager: SessionManagerProtocol {
defaults[.numberOfTimesWriteWithAITooltipIsShown] = nil
defaults[.storeProfilerAnswers] = nil
defaults[.aiPromptTone] = nil
defaults[.numberOfTimesProductCreationAISurveySuggested] = nil
defaults[.didStartProductCreationAISurvey] = nil
defaults[.themesPendingInstall] = nil
defaults[.hiddenStoreIDs] = nil
defaults[.blazeNoCampaignReminderOpened] = nil
Expand Down
29 changes: 0 additions & 29 deletions WooCommerce/Classes/System/WooConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -198,22 +198,6 @@ extension WooConstants {
///
case productsFeedback = "https://automattic.survey.fm/woo-app-feature-feedback-products"

/// URL for the store setup feedback survey
///
#if DEBUG
case storeSetupFeedback = "https://automattic.survey.fm/testing-debug-woo-mobile-–-store-setup-survey-2022"
#else
case storeSetupFeedback = "https://automattic.survey.fm/woo-mobile-–-store-setup-survey-2022"
#endif

/// URL for the shipping labels M3 feedback survey
///
#if DEBUG
case shippingLabelsRelease3Feedback = "https://automattic.survey.fm/woo-app-testing-feature-feedback-shipping-labels"
#else
case shippingLabelsRelease3Feedback = "https://automattic.survey.fm/woo-app-feature-feedback-shipping-labels"
#endif

/// URL for the order add-on i1 feedback survey
///
#if DEBUG
Expand All @@ -222,14 +206,6 @@ extension WooConstants {
case orderAddOnI1Feedback = "https://automattic.survey.fm/woo-app-addons-production"
#endif

/// URL for the Product Creation with AI feedback survey
///
#if DEBUG
case productCreationAIFeedback = "https://automattic.survey.fm/testing-debug-product-creation-with-ai-dec-2023"
#else
case productCreationAIFeedback = "https://automattic.survey.fm/product-creation-with-ai-dec-2023"
#endif

/// URL for shipping label creation information
///
case shippingLabelCreationInfo = "https://woocommerce.com/products/shipping"
Expand Down Expand Up @@ -278,11 +254,6 @@ extension WooConstants {
case orderCreationFeedback = "https://automattic.survey.fm/woo-app-order-creation-production"
#endif

#if DEBUG
case couponManagementFeedback = "https://automattic.survey.fm/woo-app-coupon-management-testing"
#else
case couponManagementFeedback = "https://automattic.survey.fm/woo-app-coupon-management-production"
#endif
/// URL for the Enable Cash on Delivery (or Pay in Person) onboarding step's learn more link using the Stripe plugin
///
case stripeCashOnDeliveryLearnMore = "https://woocommerce.com/document/stripe/accept-in-person-payments-with-stripe/#section-8"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ struct CouponListView: UIViewControllerRepresentable {

func makeUIViewController(context: Self.Context) -> CouponListViewController {
let viewController = CouponListViewController(siteID: siteID,
showFeedbackBannerIfAppropriate: false,
emptyStateActionTitle: emptyStateActionTitle,
emptyStateAction: emptyStateAction,
onCouponSelected: onCouponSelected)
Expand Down
Loading

0 comments on commit 3e66d07

Please sign in to comment.