Skip to content

Conversation

@hafizrahman
Copy link
Contributor

@hafizrahman hafizrahman commented Jun 14, 2023

Part of: #9216
Ref: pe5sF9-1AH-p2

Description

This PR deals with adding the navigation and UI for the new product sharing bottom sheet dialog, which now includes a feature to get sharing message generated with AI. It also hides this feature in a feature flag for now.

This is just a UI PR and there is no actual functionality yet. The code in the viewmodel is subject to change when the functionality is added in, so it's not necessary to focus on it too much.

The design is based on the following design for iOS:

In this PR, the three screen will look like below:

Default Generating
Screenshot_20230615_141321 Screenshot_20230615_141340
Regenerate option shown
Screenshot 2023-06-15 at 14 16 08

Note
Due to platform differences, some design elements might look different. This is especially true for the shimmer / loading elements and "Generating..." loading animation. These use existing components specific in the Android version.

Testing instructions

To check the "Default" and "Generating" UI:

  1. Start app, go to Products list and select a published Product,
  2. Tap Share on the option on top right,
  3. the "Default" product sharing design should be shown. Please check the design.
  4. Tap the "Write with AI" button. The "Generating" loading UI design should be shown. Please check the design.

To check the "Regenerate" UI:

At the moment this is not shown in the app itself, but please check the ProductSharingBottomSheet file and check the included previews there, which include the "DefaultUIWithRegenerateButton" preview.

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Jun 14, 2023

You can test the changes on this Pull Request by downloading an installable build, or scanning this QR code:

# Conflicts:
#	WooCommerce/src/main/kotlin/com/woocommerce/android/util/FeatureFlag.kt
@hafizrahman hafizrahman changed the title Feature/ai share description UI AI: Generate product sharing message part 1: UI Jun 15, 2023
@hafizrahman hafizrahman added the feature: product details Related to adding or editing products, includes product settings. label Jun 15, 2023
@peril-woocommerce
Copy link

peril-woocommerce bot commented Jun 15, 2023

Warnings
⚠️ This PR is assigned to a milestone which is closing in less than 2 days Please, make sure to get it merged by then or assign it to a later expiring milestone
⚠️ PR has more than 300 lines of code changing. Consider splitting into smaller PRs if possible.

Generated by 🚫 dangerJS

@hafizrahman hafizrahman added the compose Uses Jetpack Compose framework label Jun 15, 2023
@hafizrahman hafizrahman added this to the 14.1 milestone Jun 15, 2023
@hafizrahman hafizrahman marked this pull request as ready for review June 15, 2023 07:23
@codecov-commenter
Copy link

codecov-commenter commented Jun 15, 2023

Codecov Report

Patch coverage: 0.48% and project coverage change: -0.22 ⚠️

Comparison is base (d7fb7fb) 44.31% compared to head (3b4b2b3) 44.09%.

❗ Current head 3b4b2b3 differs from pull request most recent head dd8949c. Consider uploading reports for the commit dd8949c to get more accurate results

Additional details and impacted files
@@             Coverage Diff              @@
##              trunk    #9224      +/-   ##
============================================
- Coverage     44.31%   44.09%   -0.22%     
+ Complexity     4267     4251      -16     
============================================
  Files           856      857       +1     
  Lines         45170    45333     +163     
  Branches       5920     5945      +25     
============================================
- Hits          20018    19991      -27     
- Misses        23399    23593     +194     
+ Partials       1753     1749       -4     
Impacted Files Coverage Δ
...erce/android/ui/products/ProductDetailViewModel.kt 40.77% <0.00%> (-0.39%) ⬇️
...rce/android/ui/products/ProductNavigationTarget.kt 16.96% <0.00%> (-0.80%) ⬇️
...oocommerce/android/ui/products/ProductNavigator.kt 0.00% <0.00%> (ø)
...e/android/ui/products/ProductSharingBottomSheet.kt 0.00% <0.00%> (ø)
...rce/android/ui/products/ProductSharingViewModel.kt 0.00% <0.00%> (ø)
...kotlin/com/woocommerce/android/util/FeatureFlag.kt 72.54% <50.00%> (-0.93%) ⬇️

... and 9 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

)
}

else -> { /* nothing to show for Loading state. */ }
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm curious, why add a LoadingState in the view model if you are handling the "Loadin" using the viewState.isGenerating ??

Copy link
Contributor Author

@hafizrahman hafizrahman Jun 16, 2023

Choose a reason for hiding this comment

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

Yeah, I ended up removing it in the next PR 76480e7

At that point in the project I wasn't sure if the AI will automatically generate when the share menu item is tapped, hence the LoadingState was added.

@JorgeMucientes
Copy link
Contributor

JorgeMucientes commented Jun 16, 2023

Code looks good and UI looks good too! Great job @hafizrahman 🏆 . I liked you added the RTL previews too! I left I minor question, non-blocking though!

PS: I took the liberty of resolving the FeatureFlag file merge conflicts

@JorgeMucientes JorgeMucientes enabled auto-merge June 16, 2023 13:28
@JorgeMucientes JorgeMucientes merged commit b870ef9 into trunk Jun 16, 2023
@JorgeMucientes JorgeMucientes deleted the feature/ai-share-description-ui branch June 16, 2023 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compose Uses Jetpack Compose framework feature: product details Related to adding or editing products, includes product settings.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants