Skip to content

[Min/Max Quantities Editing Support] Networking & Model #11611

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

Merged
merged 14 commits into from
Jun 17, 2024

Conversation

toupper
Copy link
Contributor

@toupper toupper commented May 29, 2024

⚠️ This PR depends on wordpress-mobile/WordPress-FluxC-Android#3022

Closes: #11590

Description

With this PR we add support for the new REST API additions on the Min/Max Quantities extension. The changes are mostly in the model: the only user-facing change is that now quantity rules in variations need to override the parent product rules to display the rules entry, otherwise they're hidden. With this we reach parity with iOS.

Testing instructions

[Videos are recorded on iOS, but they're applicable to Android]

Products

Store without the Min/Max Quantities plugin installed. We don't show the Min/Max Quantities row in product details:

  1. Go to a store without the Min/Max Quantities installed.
  2. Open the app, and go to the products tab.
  3. Tap on any product.
  4. You don't see any row about the Min/Max Quantities:

Simulator Screen Recording - iPhone 15 Pro - 2024-05-13 at 12 36 40

Store with the Min/Max Quantities plugin installed but a product with no rules. We don't show the Min/Max Quantities row in product details:

  1. Go to a store without the Min/Max Quantities installed.
  2. Open the app, and go to the products tab.
  3. Tap on any product.
  4. You don't see any row about the Min/Max Quantities:

Simulator Screen Recording - iPhone 15 Pro - 2024-05-13 at 12 47 41

Store with the Min/Max Quantities plugin installed and a product with rules. We show the Min/Max Quantities row in product details and allow navigation:

  1. Go to a store without the Min/Max Quantities installed.
  2. Open the app, and go to the products tab.
  3. Tap on any product.
  4. You don't see the row about the Min/Max Quantities. Tap on that.
  5. You navigate to the Min/Max Quantities detail.
Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-05-13.at.12.49.05.mp4
image

Product Variations

Store without the Min/Max Quantities plugin installed. We don't show the Min/Max Quantities row in product variation details:

  1. Go to a store without the Min/Max Quantities installed.
  2. Open the app, and go to the products tab.
  3. Tap on any product with variations.
  4. Tap on any variation,
  5. You don't see any row about the Min/Max Quantities:

Simulator Screen Recording - iPhone 15 - 2024-05-15 at 10 25 12

Store with the Min/Max Quantities plugin installed but a variation with no rules. We don't show the Min/Max Quantities row in product details:

  1. Go to a store with the Min/Max Quantities installed.
  2. Open the app, and go to the products tab.
  3. Tap on any product with variations.
  4. Tap on any variation,
  5. You don't see any row about the Min/Max Quantities (same as GIF above)

Store with the Min/Max Quantities plugin installed, a variation with rules, but the parent product disables quantity rules for variations. We don't show the Min/Max Quantities row in product details:

image
  1. Go to a store with the Min/Max Quantities installed.
  2. Open the app, and go to the products tab.
  3. Tap on any product with variations. The product should check combine variation in the Quantity Rules section in wp-admin.
  4. Tap on the variation with rules.
  5. You don't see any row about the Min/Max Quantities (same as GIF above)

Store with the Min/Max Quantities plugin installed, a variation with rules, and the parent product enables quantity rules for variations. We show the Min/Max Quantities row in product details:

Simulator Screen Recording - iPhone 15 - 2024-05-15 at 10 47 06

Images/gif

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

@toupper toupper added feature: product details Related to adding or editing products, includes product settings. category: woo extensions Related to WC extensions or plugins. labels May 29, 2024
@toupper toupper added this to the 19.0 milestone May 29, 2024
@toupper toupper requested a review from atorresveiga May 29, 2024 12:44
@toupper toupper changed the title Issue/11590 min max quantities networking model [Min/Max Quantities Editing Support] Networking & Model May 29, 2024
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.

Great work @toupper!
Thanks for the detailed test cases description, it help me to ensure that everything was working as expected.

LGTM! :shipit:

@atorresveiga
Copy link
Contributor

Before merging it, please note that detekt is failing

@wpmobilebot
Copy link
Collaborator

Found 1 violations:

The PR caused the following dependency changes:

expand

-+--- org.wordpress:fluxc:2.85.0
-|    +--- org.wordpress:wellsql:2.0.0
-|    |    +--- androidx.annotation:annotation:1.2.0 -> 1.7.0 (*)
-|    |    \--- org.wordpress.wellsql:wellsql-annotations:2.0.0
-|    +--- org.wordpress.fluxc:fluxc-annotations:2.85.0
-|    +--- org.greenrobot:eventbus:3.3.1 (*)
-|    +--- com.squareup.okhttp3:okhttp:4.9.0 -> 4.12.0 (*)
-|    +--- com.android.volley:volley:1.1.1 -> 1.2.0
-|    +--- androidx.paging:paging-runtime:2.1.2
-|    |    +--- androidx.paging:paging-common:2.1.2
-|    |    |    +--- androidx.annotation:annotation:1.0.0 -> 1.7.0 (*)
-|    |    |    \--- androidx.arch.core:core-common:2.0.0 -> 2.2.0 (*)
-|    |    +--- androidx.arch.core:core-runtime:2.0.0 -> 2.2.0 (*)
-|    |    +--- androidx.lifecycle:lifecycle-runtime:2.0.0 -> 2.6.2 (*)
-|    |    +--- androidx.lifecycle:lifecycle-livedata:2.0.0 -> 2.6.2 (*)
-|    |    \--- androidx.recyclerview:recyclerview:1.0.0 -> 1.3.2 (*)
-|    +--- com.goterl:lazysodium-android:5.0.2
-|    +--- net.java.dev.jna:jna:5.5.0
-|    +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.20 -> 1.9.10 (*)
-|    +--- org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.6.20 -> 1.9.22
-|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.9.22 (*)
-|    +--- androidx.appcompat:appcompat:1.0.2 -> 1.6.1 (*)
-|    +--- androidx.recyclerview:recyclerview:1.0.0 -> 1.3.2 (*)
-|    +--- androidx.exifinterface:exifinterface:1.0.0 -> 1.3.6
-|    |    \--- androidx.annotation:annotation:1.2.0 -> 1.7.0 (*)
-|    +--- androidx.security:security-crypto:1.0.0 -> 1.1.0-alpha03
-|    |    +--- androidx.annotation:annotation:1.1.0 -> 1.7.0 (*)
-|    |    +--- com.google.crypto.tink:tink-android:1.5.0
-|    |    \--- androidx.collection:collection:1.1.0 -> 1.4.0 (*)
-|    +--- com.squareup.okhttp3:okhttp-urlconnection:4.9.0
-|    |    +--- com.squareup.okhttp3:okhttp:4.9.0 -> 4.12.0 (*)
-|    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.10 -> 1.9.10 (*)
-|    +--- com.google.code.gson:gson:2.8.5 -> 2.10.1
-|    +--- org.apache.commons:commons-text:1.10.0 (*)
-|    +--- androidx.room:room-runtime:2.4.2 -> 2.5.2 (*)
-|    +--- androidx.room:room-ktx:2.4.2 -> 2.5.2
-|    |    +--- androidx.room:room-common:2.5.2 (*)
-|    |    +--- androidx.room:room-runtime:2.5.2 (*)
-|    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.7.20 -> 1.9.22 (*)
-|    |    \--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4 -> 1.7.3 (*)
-|    +--- com.google.dagger:dagger:2.42 -> 2.50
-|    |    \--- javax.inject:javax.inject:1
-|    +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9 -> 1.7.3 (*)
-|    \--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9 -> 1.7.3 (*)
++--- org.wordpress:fluxc:trunk-133baec149a2d4f4f947667b7f489f01a811da94
+|    +--- org.wordpress:wellsql:2.0.0
+|    |    +--- androidx.annotation:annotation:1.2.0 -> 1.7.0 (*)
+|    |    \--- org.wordpress.wellsql:wellsql-annotations:2.0.0
+|    +--- org.wordpress.fluxc:fluxc-annotations:trunk-133baec149a2d4f4f947667b7f489f01a811da94
+|    +--- org.greenrobot:eventbus:3.3.1 (*)
+|    +--- com.squareup.okhttp3:okhttp:4.9.0 -> 4.12.0 (*)
+|    +--- com.android.volley:volley:1.1.1 -> 1.2.0
+|    +--- androidx.paging:paging-runtime:2.1.2
+|    |    +--- androidx.paging:paging-common:2.1.2
+|    |    |    +--- androidx.annotation:annotation:1.0.0 -> 1.7.0 (*)
+|    |    |    \--- androidx.arch.core:core-common:2.0.0 -> 2.2.0 (*)
+|    |    +--- androidx.arch.core:core-runtime:2.0.0 -> 2.2.0 (*)
+|    |    +--- androidx.lifecycle:lifecycle-runtime:2.0.0 -> 2.6.2 (*)
+|    |    +--- androidx.lifecycle:lifecycle-livedata:2.0.0 -> 2.6.2 (*)
+|    |    \--- androidx.recyclerview:recyclerview:1.0.0 -> 1.3.2 (*)
+|    +--- com.goterl:lazysodium-android:5.0.2
+|    +--- net.java.dev.jna:jna:5.5.0
+|    +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.20 -> 1.9.10 (*)
+|    +--- org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.6.20 -> 1.9.22
+|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.9.22 (*)
+|    +--- androidx.appcompat:appcompat:1.0.2 -> 1.6.1 (*)
+|    +--- androidx.recyclerview:recyclerview:1.0.0 -> 1.3.2 (*)
+|    +--- androidx.exifinterface:exifinterface:1.0.0 -> 1.3.6
+|    |    \--- androidx.annotation:annotation:1.2.0 -> 1.7.0 (*)
+|    +--- androidx.security:security-crypto:1.0.0 -> 1.1.0-alpha03
+|    |    +--- androidx.annotation:annotation:1.1.0 -> 1.7.0 (*)
+|    |    +--- com.google.crypto.tink:tink-android:1.5.0
+|    |    \--- androidx.collection:collection:1.1.0 -> 1.4.0 (*)
+|    +--- com.squareup.okhttp3:okhttp-urlconnection:4.9.0
+|    |    +--- com.squareup.okhttp3:okhttp:4.9.0 -> 4.12.0 (*)
+|    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.10 -> 1.9.10 (*)
+|    +--- com.google.code.gson:gson:2.8.5 -> 2.10.1
+|    +--- org.apache.commons:commons-text:1.10.0 (*)
+|    +--- androidx.room:room-runtime:2.4.2 -> 2.5.2 (*)
+|    +--- androidx.room:room-ktx:2.4.2 -> 2.5.2
+|    |    +--- androidx.room:room-common:2.5.2 (*)
+|    |    +--- androidx.room:room-runtime:2.5.2 (*)
+|    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.7.20 -> 1.9.22 (*)
+|    |    \--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4 -> 1.7.3 (*)
+|    +--- com.google.dagger:dagger:2.42 -> 2.50
+|    |    \--- javax.inject:javax.inject:1
+|    +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9 -> 1.7.3 (*)
+|    \--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9 -> 1.7.3 (*)
-\--- org.wordpress.fluxc.plugins:woocommerce:2.85.0
-     +--- org.wordpress:wellsql:2.0.0 (*)
-     +--- org.wordpress.fluxc:fluxc-annotations:2.85.0
-     +--- androidx.room:room-ktx:2.4.2 -> 2.5.2 (*)
-     +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.20 -> 1.9.10 (*)
-     +--- org.wordpress:fluxc:2.85.0 (*)
-     +--- com.google.code.gson:gson:2.8.5 -> 2.10.1
-     +--- com.google.dagger:dagger:2.42 -> 2.50 (*)
-     +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9 -> 1.7.3 (*)
-     +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9 -> 1.7.3 (*)
-     \--- androidx.room:room-runtime:2.4.2 -> 2.5.2 (*)
+\--- org.wordpress.fluxc.plugins:woocommerce:trunk-133baec149a2d4f4f947667b7f489f01a811da94
+     +--- org.wordpress:wellsql:2.0.0 (*)
+     +--- org.wordpress.fluxc:fluxc-annotations:trunk-133baec149a2d4f4f947667b7f489f01a811da94
+     +--- androidx.room:room-ktx:2.4.2 -> 2.5.2 (*)
+     +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.20 -> 1.9.10 (*)
+     +--- org.wordpress:fluxc:trunk-133baec149a2d4f4f947667b7f489f01a811da94 (*)
+     +--- com.google.code.gson:gson:2.8.5 -> 2.10.1
+     +--- com.google.dagger:dagger:2.42 -> 2.50 (*)
+     +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9 -> 1.7.3 (*)
+     +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9 -> 1.7.3 (*)
+     \--- androidx.room:room-runtime:2.4.2 -> 2.5.2 (*)

Please review and act accordingly

@wpmobilebot
Copy link
Collaborator

📲 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
FlavorJalapeno
Build TypeDebug
Commit0899bc5
Direct Downloadwoocommerce-prototype-build-pr11611-0899bc5.apk

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 33.33333% with 80 lines in your changes missing coverage. Please review.

Project coverage is 40.25%. Comparing base (56719db) to head (0899bc5).

Files Patch % Lines
...erce/android/model/SubscriptionProductVariation.kt 0.00% 39 Missing ⚠️
.../com/woocommerce/android/model/ProductVariation.kt 55.17% 4 Missing and 9 partials ⚠️
...in/kotlin/com/woocommerce/android/model/Product.kt 55.55% 4 Missing and 8 partials ⚠️
...i/products/variations/VariationDetailRepository.kt 0.00% 7 Missing ⚠️
...oid/ui/products/details/ProductDetailRepository.kt 0.00% 6 Missing ⚠️
...cts/variations/GetProductVariationQuantityRules.kt 62.50% 0 Missing and 3 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              trunk   #11611      +/-   ##
============================================
- Coverage     40.28%   40.25%   -0.04%     
+ Complexity     5333     5329       -4     
============================================
  Files          1133     1132       -1     
  Lines         65148    65214      +66     
  Branches       9006     9042      +36     
============================================
+ Hits          26243    26250       +7     
- Misses        36504    36549      +45     
- Partials       2401     2415      +14     

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

@toupper toupper merged commit 7028982 into trunk Jun 17, 2024
14 checks passed
@toupper toupper deleted the issue/11590-min-max-quantities-networking-model branch June 17, 2024 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: woo extensions Related to WC extensions or plugins. 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.

[Min/Max Quantities] Adapt Model and Networking to the new REST API
5 participants