-
Notifications
You must be signed in to change notification settings - Fork 137
[HACK][Woo POS] Modularization - move utils to /libs/pos module #15094
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: hack-modularize-selected-site
Are you sure you want to change the base?
[HACK][Woo POS] Modularization - move utils to /libs/pos module #15094
Conversation
Generated by 🚫 Danger |
📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
|
- Move `WooPosContextExt.kt` from the main app module to the `libs/pos` module. - Add `androidx.core.ktx` and `androidx.compose.ui.main` dependencies to `libs/pos/build.gradle`.
|
📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.
|
🤖 Build Failure AnalysisThis build has failures. Claude has analyzed them - check the build annotations for details. |
- Move `WooPosGetStoreCountryName` and related string resources from the main app to `libs/pos`. - Add Dagger Hilt configuration to `libs/pos/build.gradle`.
…nto hack-pos-modularization-utils
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR modularizes the Woo POS codebase by moving utility classes, data storage managers, and related test files from the main WooCommerce module to the /libs/pos module. This refactoring improves code organization and module separation.
Key Changes
- Created new utility classes in
/libs/posfor POS-specific functionality including connection type detection, currency retrieval, and timestamp management - Moved and created DataStore-based repositories for managing POS preferences and sync timestamps
- Added comprehensive test coverage for the moved/new utilities
- Relocated country name string resources from main app to the POS module with localization support
Reviewed changes
Copilot reviewed 39 out of 61 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| libs/pos/build.gradle | Added Hilt plugin and dependencies for DataStore, Compose UI, Gson, and testing libraries |
| libs/pos/src/main/java/com/woocommerce/android/ui/woopos/util/WooPosGetStoreCountryName.kt | Updated import to reference new R file location in pos module |
| libs/pos/src/main/java/com/woocommerce/android/ui/woopos/util/WooPosGetCachedStoreCurrency.kt | New utility for caching and retrieving store currency |
| libs/pos/src/main/java/com/woocommerce/android/ui/woopos/util/WooPosConnectionTypeProvider.kt | New utility for detecting network connection type (WiFi/Cellular/Unknown) |
| libs/pos/src/main/java/com/woocommerce/android/ui/woopos/util/WooPosCellularCapabilityDetector.kt | New utility for detecting device cellular capability |
| libs/pos/src/main/java/com/woocommerce/android/ui/woopos/util/WooPosTestTags.kt | New constants for UI testing tags |
| libs/pos/src/main/java/com/woocommerce/android/ui/woopos/util/datastore/WooPosSyncTimestampRepository.kt | New DataStore repository for managing sync timestamps |
| libs/pos/src/main/java/com/woocommerce/android/ui/woopos/util/datastore/WooPosSyncTimestampManager.kt | New manager for formatting and parsing API timestamps |
| libs/pos/src/main/java/com/woocommerce/android/ui/woopos/util/datastore/WooPosPreferencesRepository.kt | New DataStore repository for POS preferences and searches |
| libs/pos/src/main/java/com/woocommerce/android/ui/woopos/util/ext/*.kt | New extension functions for Date, Context, and WindowInsetsCompat |
| libs/pos/src/main/java/com/woocommerce/android/ui/woopos/util/format/Is24HourFormat.kt | New utility for checking 24-hour format preference |
| libs/pos/src/main/java/com/woocommerce/android/ui/woopos/WooPOSIsRemotelyEnabled.kt | New use case for checking remote POS feature enablement |
| libs/pos/src/main/java/com/woocommerce/android/ui/woopos/common/util/WooPosCouldNotDetermineValueException.kt | New exception class for indeterminate values |
| libs/pos/src/test/java/**/*.kt | Comprehensive test coverage for new utilities |
| libs/pos/src/main/res/values*/strings.xml | Relocated country name strings with translations for 18+ languages |
| libs/commons/src/main/java/com/woocommerce/android/util/WCSSRModelCachingFetcher.kt | New caching fetcher for WCSSR model with TTL-based cache |
| libs/commons/src/main/java/com/woocommerce/android/ui/woopos/util/*.kt | New common utilities for network status and country code retrieval |
| libs/commons/build.gradle | Added testFixtures dependency for fluxc-plugin |
| WooCommerce/src/main/res/values*/strings.xml | Removed country name strings (moved to libs/pos module) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| <string name="woopos_eligibility_screen_UK_country_name">İngiltere</string> |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The US country name string resource is missing from the Turkish translation file. All other language files include both woopos_eligibility_screen_US_country_name and woopos_eligibility_screen_UK_country_name, but this file only has the UK entry. This will cause issues if the US country name is needed in the Turkish locale.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Turkish translation needs to be added. This is a pre-existing bug that was carried over during the modularization. The Turkish translation was incomplete in the original WooCommerce module - it only had the UK country name, never the US one. The PR simply moved what existed without introducing new missing translations.
| @@ -0,0 +1,5 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <resources> | |||
| <string name="woopos_eligibility_screen_US_country_name">the United States</string> | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When moving WooPosGetStoreCountryName to libs/pos module, the string resources were moved along with this class. Do you have an idea how this will be treated by our automated translation process during app release, @wzieba? I wonder if any new strings from the /libs/ modules are going to be processed the same way as from WooCommerce app module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if we merge this as it is, the translation will be broken 😕. I'll research more on this topic later (I hope today) but please don't merge this for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright. Thanks for looking into that and researching 👍
…tion-utils # Conflicts: # WooCommerce/src/main/res/values-de/strings.xml
malinajirka
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall. However, I believe we'll need to update our tolling to handle the translations properly. Wojtek has a way better understanding there, so let's see what he thinks.
WOOMOB-1875
Description
This PR modularizes the Woo POS codebase by moving utility classes, data storage managers, and related test files from the main WooCommerce module to the /libs/pos module. This refactoring improves code organization and module separation.
Methodology:
woopos- specific dependencies were moved tolibs/posmodule altogether.store managementdependencies were split betweenlibs/commonsandlibs/pos.💡
Do not mergeuntil the parent branch istrunkand we make sure it will work fine with the automated strings translation process.Test Steps
Images/gif
N/A
RELEASE-NOTES.txtif necessary. Use the "[Internal]" label for non-user-facing changes.