Skip to content

Conversation

@jaclync
Copy link
Contributor

@jaclync jaclync commented Sep 22, 2025

Part of WOOMOB-935

Description

Refactored FormattableAmountTextField to replace the hardcoded font override with a more flexible Style struct that allows dependency injection of fonts, since .posHeadingRegular won't be available once POS is in a separate module. As the refactoring affects multiple use cases in the app, I made these changes in one PR.

Changes made:

  • Replaced Style enum with a Style struct containing showsBorder, textAlignment, and optional font properties
  • Updated POSFormattableAmountTextFieldAdaptor to accept and pass font parameter from POS module
  • Modified POSExternalViewProviding protocol to include font parameter in createFormattableAmountTextField method
  • Updated POS integration to pass the appropriate font based on dynamic type size

This refactoring maintains the same behavior while improving modularity and allowing better font customization for different use cases.

Steps to reproduce

  1. Open POS cash collection view
  2. Verify the amount text field displays with the correct POS font styling
  3. Test other uses of FormattableAmountTextField (order creation, payment methods, shipping) to ensure they continue working as before
  4. Test with different dynamic type sizes to ensure font scaling works correctly

Testing information

Regression testing:

  • POS cash collection view displays amount field with correct font
  • Order creation custom amount entry works normally
  • Cash payment tender view functions properly
  • Order creation shipping amount entry works normally

Screenshots

I compared the following screens from PR branch & trunk:

POS cash view:

Order creation add custom amount:

custom amount custom amount filled custom percentage
Simulator Screenshot - iPad (A16) - 2025-09-22 at 16 10 38 Simulator Screenshot - iPad (A16) - 2025-09-22 at 16 11 05 Simulator Screenshot - iPad (A16) - 2025-09-22 at 16 11 13

Order creation shipping line:

Order cash payment:


  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@jaclync jaclync added type: task An internally driven task. feature: POS labels Sep 22, 2025
@jaclync jaclync added this to the 23.4 milestone Sep 22, 2025
@wpmobilebot
Copy link
Collaborator

App Icon📲 You can test the changes from this Pull Request in WooCommerce iOS Prototype by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS Prototype
Build Numberpr16160-675a81d
Version23.3
Bundle IDcom.automattic.alpha.woocommerce
Commit675a81d
Installation URL1p3q8om0sbg20
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@jaclync jaclync changed the title Refactor FormattableAmountTextField to use Style struct for font dependency injection [Woo POS] Modularization: refactor FormattableAmountTextField to decouple from POS font Sep 22, 2025
@jaclync jaclync requested a review from staskus September 22, 2025 08:32
Copy link
Contributor

@staskus staskus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Thanks for refactoring, looks good

@staskus staskus merged commit 5cff5f0 into trunk Sep 29, 2025
28 of 33 checks passed
@staskus staskus deleted the feat/WOOMOB-935-refactor-POSFormattableAmountTextField-for-passing-font-from-pos-module branch September 29, 2025 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: POS type: task An internally driven task.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants