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

Issue/11323 new product image picker #12610

Merged
merged 15 commits into from
Sep 16, 2024
Merged

Conversation

JorgeMucientes
Copy link
Contributor

@JorgeMucientes JorgeMucientes commented Sep 13, 2024

Closes: #11323

Description

Adds a new product image picker within Blaze campaign creation flow.

  • A new item is available in the media picker dialog displayed when editing Ad image
  • A new fragment is loaded when selecting the option Choose existing product photo

This PR doesn't add any unit tests because there's barely any logic. It is mostly a simple UI and handling navigation.

Testing information

  1. Trigger Blaze campaign creation flow
  2. Select a product that doesn't have any image
  3. Tap Edit Ad > Change image > Choose existing product photo
  4. Check empty case is handled.

Repeat the above steps and select a product with multiple images.

  1. Select any of the available images and check how the UI is updated accordingly
  2. Click save and notice how the Ad image is updated

Images/gif

PickProductImage.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.
323

@JorgeMucientes JorgeMucientes added feature: blaze Related to the Blaze project type: task An internally driven task. unit-tests-exemption labels Sep 13, 2024
@dangermattic
Copy link
Collaborator

dangermattic commented Sep 13, 2024

1 Warning
⚠️ Class ProductImagePickerViewModel is missing tests, but unit-tests-exemption label was set to ignore this.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Sep 13, 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
Commit267d001
Direct Downloadwoocommerce-wear-prototype-build-pr12610-267d001.apk

@JorgeMucientes JorgeMucientes added this to the 20.5 milestone Sep 13, 2024
@JorgeMucientes JorgeMucientes marked this pull request as ready for review September 13, 2024 14:58
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class ProductImagePickerFragment : BaseFragment() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thought of adding this new fragment in products.images package, but i think that would be more confusing as there's already ProductImagesFragment and related classes to handle product images. While this feature might be handy in the future, currently it is very specific to the Blaze feature. For those reasons, I'm keeping it inside the blaze package.

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Sep 13, 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
Commit267d001
Direct Downloadwoocommerce-prototype-build-pr12610-267d001.apk

@codecov-commenter
Copy link

codecov-commenter commented Sep 13, 2024

Codecov Report

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

Project coverage is 40.59%. Comparing base (9acb6ce) to head (267d001).
Report is 58 commits behind head on trunk.

Files with missing lines Patch % Lines
...i/blaze/creation/ad/ProductImagePickerViewModel.kt 0.00% 27 Missing ⚠️
...reation/ad/BlazeCampaignCreationEditAdViewModel.kt 0.00% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              trunk   #12610      +/-   ##
============================================
- Coverage     40.61%   40.59%   -0.02%     
+ Complexity     5682     5681       -1     
============================================
  Files          1229     1230       +1     
  Lines         69124    69155      +31     
  Branches       9574     9576       +2     
============================================
- Hits          28076    28075       -1     
- Misses        38466    38497      +31     
- Partials       2582     2583       +1     

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

@irfano irfano self-assigned this Sep 15, 2024

@Composable
fun ProductImagePickerScreen(
viewState: ProductImagePickerViewModel.ViewState,
Copy link
Contributor

Choose a reason for hiding this comment

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

  • We referenced ProductImagePickerViewModel here, but it can be removed since we imported com.woocommerce.android.ui.blaze.creation.ad.ProductImagePickerViewModel.ViewState. I suggest removing import com.woocommerce.android.ui.blaze.creation.ad.ProductImagePickerViewModel.ViewState and also referencing ProductImagePickerViewModel in ProductImageGrid for consistency.
  • Also we can remove Product.

image

@JorgeMucientes
Copy link
Contributor Author

Hey @irfano thanks for the feedback!! I've addressed the import issues. A bit differently, though, I left the fully qualified names so it's easier to check what type of object it's being issued. For example, instead of Image, I added Product.Image. Same for the viewState.

As per the talkback service, good catch. However, I'm not sure how useful would it be to add the "photo taken on $date" in this case. I mean, it doesn't seem like the date is very relevant data in this context to help identify which picture is being selec4ed. I've added a short content description to improve the experience a bit.

Let me know if there's anything else that should be addressed before this PR can be approved :)

Copy link
Contributor

@irfano irfano left a comment

Choose a reason for hiding this comment

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

It's better now. Thank you for changes. LGTM! 👍🏻

@irfano irfano merged commit 2a89ace into trunk Sep 16, 2024
14 checks passed
@irfano irfano deleted the issue/11323-new-product-image-picker branch September 16, 2024 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: blaze Related to the Blaze project type: task An internally driven task. unit-tests-exemption
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Blaze Campaign Creation Ad Image Picker
5 participants