Skip to content

Conversation

@samiuelson
Copy link
Contributor

@samiuelson samiuelson commented Dec 12, 2025

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:

  1. Classes that were dependent only on woopos - specific dependencies were moved to libs/pos module altogether.
  2. Classes that were dependent on store management dependencies were split between libs/commons and libs/pos.

💡 Do not merge until the parent branch is trunk and we make sure it will work fine with the automated strings translation process.

Test Steps

  • Verify CI is green
  • Smoke test the app

Images/gif

N/A

  • I have considered if this change warrants release notes and have added them to RELEASE-NOTES.txt if necessary. Use the "[Internal]" label for non-user-facing changes.

@dangermattic
Copy link
Collaborator

dangermattic commented Dec 12, 2025

1 Error
🚫 This PR is tagged with status: do not merge label(s).

Generated by 🚫 Danger

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Dec 12, 2025

📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
App NameWooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commit6b0a17b
Direct Downloadwoocommerce-wear-prototype-build-pr15094-6b0a17b.apk

- 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`.
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Dec 12, 2025

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

App NameWooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commit6b0a17b
Direct Downloadwoocommerce-prototype-build-pr15094-6b0a17b.apk

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Dec 12, 2025

🤖 Build Failure Analysis

This build has failures. Claude has analyzed them - check the build annotations for details.

@samiuelson samiuelson changed the title [Woo POS] Modularization - utils [Woo POS] Modularization - move utils to /libs/pos module Dec 12, 2025
@samiuelson samiuelson requested a review from Copilot December 12, 2025 17:10
@samiuelson samiuelson added this to the 24.0 milestone Dec 12, 2025
@samiuelson samiuelson added the type: task An internally driven task. label Dec 12, 2025
Copy link
Contributor

Copilot AI left a 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/pos for 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.

Comment on lines +3 to +4

<string name="woopos_eligibility_screen_UK_country_name">İngiltere</string>
Copy link

Copilot AI Dec 12, 2025

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.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

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>
Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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 👍

@samiuelson samiuelson added the status: do not merge Dependent on another PR, ready for review but not ready for merge. label Dec 12, 2025
@samiuelson samiuelson marked this pull request as ready for review December 12, 2025 18:29
…tion-utils

# Conflicts:
#	WooCommerce/src/main/res/values-de/strings.xml
@samiuelson samiuelson changed the title [Woo POS] Modularization - move utils to /libs/pos module [HACK][Woo POS] Modularization - move utils to /libs/pos module Dec 15, 2025
@malinajirka malinajirka self-assigned this Dec 16, 2025
Copy link
Contributor

@malinajirka malinajirka left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: do not merge Dependent on another PR, ready for review but not ready for merge. type: task An internally driven task.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants