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

[Shipping Labels Revamp] Add Package template loading and recovery feedback #13236

Merged
merged 14 commits into from
Jan 4, 2025

Conversation

ThomazFB
Copy link
Contributor

@ThomazFB ThomazFB commented Jan 2, 2025

Why

As it is, the current Package Selection flow handles a Custom package being saved as a template as an optimistic operation, but after some team discussions, we decided to keep direct feedback to the user to allow them to know if it failed or not.

How

This PR introduces not only loading feedback for the Custom package creation but also an Error dialog that suggests the user use the package without saving it as a template if the problem persists as a quick solution for any custom package creation unavailability on the store.

Screen Capture

Error Handling

Screen_recording_20250102_194433.mp4

Loading feedback

Screen_recording_20250102_200127.mp4

How to Test

Scenario 1 - Loading feedback

  1. Go to the Package selection flow during the new Shipping Labels creation flow
  2. Define a Custom package and mark the save as template checkbox
  3. Complete the form and add the package
  4. Ensure the loading feedback is displayed and dismissed as expected

Scenario 2 - No Loading feedback

  1. Go to the Package selection flow during the new Shipping Labels creation flow
  2. Define a Custom package and DO NOT mark the save as template checkbox
  3. Complete the form and add the package
  4. Ensure no loading feedback was displayed, as the package didn't require any network request

Scenario 3 - Error handling

⚠️ In order to force an error scenario, I recommend hardcoding the WooShippingLabelPackageRepository.createCustomPackage function to the following:

    suspend fun createCustomPackage(
        site: SiteModel = selectedSite.get(),
        requestData: List<CustomPackageCreationRequestData>
    ): WooResult<List<PackageDAO>> {
        site.apply {  }
        requestData.apply {  }
        return WooResult(WooError(WooErrorType.GENERIC_ERROR, BaseRequest.GenericErrorType.UNKNOWN))
    }
  1. Go to the Package selection flow during the new Shipping Labels creation flow
  2. Define a Custom package and mark the save as template checkbox
  3. Complete the form and add the package
  4. Ensure the error dialog is displayed
  5. Hit the Proceed button and verify that the Package is selected to the Shipping Labels form

Update release notes:

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

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.

@ThomazFB ThomazFB added type: task An internally driven task. feature: shipping labels Related to creating, ordering, or printing shipping labels. labels Jan 2, 2025
@ThomazFB ThomazFB added this to the 21.4 milestone Jan 2, 2025
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Jan 2, 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 Name WooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commit99625db
Direct Downloadwoocommerce-wear-prototype-build-pr13236-99625db.apk

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Jan 2, 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 Name WooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commit99625db
Direct Downloadwoocommerce-prototype-build-pr13236-99625db.apk

@codecov-commenter
Copy link

codecov-commenter commented Jan 2, 2025

Codecov Report

Attention: Patch coverage is 68.00000% with 16 lines in your changes missing coverage. Please review.

Project coverage is 40.63%. Comparing base (bcbbde1) to head (5029816).

Files with missing lines Patch % Lines
...ckages/WooShippingLabelPackageCreationViewModel.kt 46.66% 13 Missing and 3 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              trunk   #13236      +/-   ##
============================================
- Coverage     40.64%   40.63%   -0.02%     
+ Complexity     6387     6385       -2     
============================================
  Files          1351     1351              
  Lines         77444    77449       +5     
  Branches      10650    10655       +5     
============================================
- Hits          31479    31469      -10     
- Misses        43186    43200      +14     
- Partials       2779     2780       +1     

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

@ThomazFB ThomazFB marked this pull request as ready for review January 2, 2025 23:12
@ThomazFB ThomazFB requested a review from atorresveiga January 2, 2025 23:13
@atorresveiga atorresveiga self-assigned this Jan 3, 2025
Copy link
Contributor

@atorresveiga atorresveiga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this, Thomaz. Nice touch enabling continued flow when the package saving fails.

LGTM! :shipit:

Alejo added 2 commits January 4, 2025 12:23
…oading-feedback

# Conflicts:
#	WooCommerce/src/main/kotlin/com/woocommerce/android/ui/orders/wooshippinglabels/packages/WooShippingLabelPackageCreationViewModel.kt
#	WooCommerce/src/main/kotlin/com/woocommerce/android/ui/orders/wooshippinglabels/packages/datasource/FetchPredefinedPackagesFromStore.kt
@atorresveiga atorresveiga enabled auto-merge January 4, 2025 15:45
@atorresveiga atorresveiga merged commit e96624b into trunk Jan 4, 2025
15 checks passed
@atorresveiga atorresveiga deleted the issue/save-package-loading-feedback branch January 4, 2025 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: shipping labels Related to creating, ordering, or printing shipping labels. type: task An internally driven task.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants