Skip to content
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

[2 pane layout] Tablet mode detection logic change #13228

Open
wants to merge 3 commits into
base: issue/13221-remove-variation-quantity
Choose a base branch
from

Conversation

AnirudhBhat
Copy link
Contributor

Closes: #12861

Description

This PR refactors the tablet detection logic to account for both width and height dimensions when determining if a device qualifies as a tablet. The updated logic improves compatibility with larger phones especially in landscape mode.

Changes Introduced:
New Size Class Determination Method:

Introduced determineWindowSizeClassByDimensions(widthDp: Int, heightDp: Int).
Evaluates both shortSize and longSize (smallest and largest dimensions, respectively) to classify devices as Compact, Medium, or ExpandedAndBigger.

Steps to reproduce

  1. Open WooCommerce app
  2. Navigate to orders screen
  3. Rotate your device
  4. Observe the Behaviour:
    On smaller devices: The screen remains in single-pane mode and does not split into tablet mode.
    On larger phones and tablets: The screen transitions to split-pane (tablet) mode as expected.

The tests that have been performed

Verified behaviour on below emulators:
Tablets (portrait and landscape)
Large phones in landscape mode

Images/gif

tablet_detection_logic.mp4
  • 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.

Reviewer (or Author, in the case of optional code reviews):

Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement:

  • The PR is small and has a clear, single focus, or a valid explanation is provided in the description. If needed, please request to split it into smaller PRs.
  • Ensure Adequate Unit Test Coverage: The changes are reasonably covered by unit tests or an explanation is provided in the PR description.
  • Manual Testing: The author listed all the tests they ran, including smoke tests when needed (e.g., for refactorings). The reviewer confirmed that the PR works as expected on big (tablet) and small (phone) in case of UI changes, and no regressions are added.

@AnirudhBhat AnirudhBhat added type: bug A confirmed bug. category: tablet Specific to tablet devices such as a Galaxy Tab or an iPad. labels Dec 31, 2024
@AnirudhBhat AnirudhBhat added this to the 21.4 milestone Dec 31, 2024
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Dec 31, 2024

📲 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 Name WooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commite0b9d62
Direct Downloadwoocommerce-wear-prototype-build-pr13228-e0b9d62.apk

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Dec 31, 2024

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

App Name WooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commite0b9d62
Direct Downloadwoocommerce-prototype-build-pr13228-e0b9d62.apk

@codecov-commenter
Copy link

codecov-commenter commented Dec 31, 2024

Codecov Report

Attention: Patch coverage is 0% with 10 lines in your changes missing coverage. Please review.

Project coverage is 40.64%. Comparing base (3f54acc) to head (e0b9d62).

Files with missing lines Patch % Lines
...n/com/woocommerce/android/extensions/ContextExt.kt 0.00% 10 Missing ⚠️
Additional details and impacted files
@@                             Coverage Diff                             @@
##             issue/13221-remove-variation-quantity   #13228      +/-   ##
===========================================================================
- Coverage                                    40.64%   40.64%   -0.01%     
  Complexity                                    6380     6380              
===========================================================================
  Files                                         1349     1349              
  Lines                                        77400    77407       +7     
  Branches                                     10647    10647              
===========================================================================
  Hits                                         31461    31461              
- Misses                                       43159    43166       +7     
  Partials                                      2780     2780              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@AnirudhBhat AnirudhBhat requested a review from samiuelson January 2, 2025 04:10
@AnirudhBhat AnirudhBhat marked this pull request as ready for review January 2, 2025 04:10
@AnirudhBhat AnirudhBhat changed the title [Woo POS][Non-Simple Products] Tablet mode detection logic change [2 pane layout] Tablet mode detection logic change Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: tablet Specific to tablet devices such as a Galaxy Tab or an iPad. type: bug A confirmed bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants