-
Notifications
You must be signed in to change notification settings - Fork 135
[Woo POS][Local Catalog] Disable "cellular data" toggle if device doesn't have data modem #14971
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
[Woo POS][Local Catalog] Disable "cellular data" toggle if device doesn't have data modem #14971
Conversation
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 adds functionality to disable the "cellular data" toggle in the WooCommerce POS Local Catalog settings when the device doesn't have cellular capability (data modem).
Key Changes:
- Introduced
WooPosCellularCapabilityDetectorutility class to detect device telephony capabilities - Updated ViewModel to check cellular capability on initialization and disable the preference when unavailable
- Modified UI to visually disable and reduce opacity of the cellular data section when capability is absent
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| WooPosCellularCapabilityDetector.kt | New utility class that checks for FEATURE_TELEPHONY system feature to determine cellular capability |
| WooPosSettingsLocalCatalogViewModel.kt | Added cellular capability checking in init block and forces preference to false when capability is unavailable |
| WooPosSettingsLocalCatalogState.kt | Added hasCellularCapability boolean field to track device capability state |
| WooPosSettingsLocalCatalogScreen.kt | Updated UI to disable toggle and apply reduced opacity when device lacks cellular capability; added preview parameter provider for testing both states |
| WooPosSettingsLocalCatalogViewModelTest.kt | Added comprehensive tests for cellular capability detection and preference handling behavior |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...e/src/main/kotlin/com/woocommerce/android/ui/woopos/util/WooPosCellularCapabilityDetector.kt
Show resolved
Hide resolved
...e/android/ui/woopos/settings/details/localcatalog/WooPosSettingsLocalCatalogViewModelTest.kt
Outdated
Show resolved
Hide resolved
📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
|
…-local-catalog-settings-in
|
📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## trunk #14971 +/- ##
=========================================
Coverage 38.48% 38.49%
- Complexity 10244 10247 +3
=========================================
Files 2155 2156 +1
Lines 122223 122243 +20
Branches 16822 16823 +1
=========================================
+ Hits 47036 47055 +19
- Misses 70407 70409 +2
+ Partials 4780 4779 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
...e/android/ui/woopos/settings/details/localcatalog/WooPosSettingsLocalCatalogViewModelTest.kt
Outdated
Show resolved
Hide resolved
| data class WooPosSettingsLocalCatalogState( | ||
| val catalogStatus: CatalogStatus = CatalogStatus.Loading, | ||
| val allowCellularDataUpdate: Boolean = false, | ||
| val hasCellularCapability: Boolean = false, |
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 state is designed in the way it can be ambiguous/invalid. We should do, something like that maybe. Wdyt?
val cellularCapability: CellularCapability
sealed class CellularCapability {
object None : CellularCapability()
data class Available(val allowCellularDataUpdate: Boolean) : CellularCapability()
}
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.
Good idea, done: c154f17
kidinov
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.
Overall, LGTM.
I left one remark regarding how the state is designed.
Another one: do we even need to show this section on the devices without mobile internet?
Thanks for review. The section is now hidden on devices without a cellular modem: 7f36fe3 |
…-local-catalog-settings-in
kidinov
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.
LGTM!
WOOMOB-1697
Description
This PR adds functionality to disable the "cellular data" toggle in the WooCommerce POS Local Catalog settings when the device doesn't have cellular capability (data modem).
Key Changes:
WooPosCellularCapabilityDetectorutility class to detect device telephony capabilitiesTest Steps
Test POS > Settings > Catalog screen on different devices:
Images/gif
Enabled
Disabled
RELEASE-NOTES.txtif necessary. Use the "[Internal]" label for non-user-facing changes.