woocommerce-android icon indicating copy to clipboard operation
woocommerce-android copied to clipboard

[Woo POS] We don't handle the low battery event during IPP flow properly

Open backwardstruck opened this issue 1 year ago • 4 comments

Closes: #12565

Description

Discussed in Slack.

This PR addresses the issue where a LOW_BATTERY event incorrectly shows a toast and an empty dialog instead of triggering the appropriate low battery warning dialog similar to the LOW_BATTERY_SUCCEED_CONNECT event.

The underlying problem was that LOW_BATTERY events were causing the bluetoothReaderListener to be reset to an Unknown state before the low battery event could be appropriately handled as Failed.

Steps to reproduce

  1. Go to POS.
  2. Connect to virtual card reader in low battery state OR physical card reader that's low on battery.
  3. Observe the behavior. Previously, it would show a toast and reset to an unknown state.
  4. With the fix, it should now display the low battery warning dialog correctly.

Testing information

  • Devices used: tablet emulator and physical tablet/card reader
  • Workflow tested: Initiated a reader connection and simulated low battery events during the update process.
  • Affected areas: Card reader connection workflow, software update process.

The tests that have been performed

  1. Verified that LOW_BATTERY triggers the correct dialog.
  2. Confirmed the state transitions are handled correctly without prematurely resetting to Unknown.
  3. Checked no regressions occur in LOW_BATTERY_SUCCEED_CONNECT.
  • [x] 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.

  • [ ] I have Removed any TEST CODE.

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.

backwardstruck avatar Sep 09 '24 20:09 backwardstruck

1 Message
:book: This PR is still a Draft: some checks will be skipped.

Generated by :no_entry_sign: Danger

dangermattic avatar Sep 09 '24 20:09 dangermattic

📲 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
Commitafcb619fda13a053cd462469fad78448c9744ca6
Direct Downloadwoocommerce-wear-prototype-build-pr12568-afcb619.apk

wpmobilebot avatar Sep 09 '24 20:09 wpmobilebot

📲 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
Commitafcb619fda13a053cd462469fad78448c9744ca6
Direct Downloadwoocommerce-prototype-build-pr12568-afcb619.apk

wpmobilebot avatar Sep 09 '24 21:09 wpmobilebot

Codecov Report

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

Project coverage is 40.58%. Comparing base (56404b5) to head (afcb619). Report is 1108 commits behind head on trunk.

Files with missing lines Patch % Lines
...ardreader/internal/connection/ConnectionManager.kt 0.00% 2 Missing and 1 partial :warning:
...id/cardreader/internal/wrappers/TerminalWrapper.kt 0.00% 1 Missing :warning:
Additional details and impacted files
@@             Coverage Diff              @@
##              trunk   #12568      +/-   ##
============================================
- Coverage     40.58%   40.58%   -0.01%     
  Complexity     5674     5674              
============================================
  Files          1229     1229              
  Lines         69287    69289       +2     
  Branches       9579     9581       +2     
============================================
- Hits          28119    28118       -1     
- Misses        38584    38586       +2     
- Partials       2584     2585       +1     
Flag Coverage Δ
40.58% <0.00%> (-0.01%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Sep 09 '24 21:09 codecov-commenter