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

[Coupons] Handle Coupons disabled situation on Coupons List screen

Open hafizrahman opened this issue 3 years ago • 4 comments
trafficstars

Closes: #6359

Warning : Do not merge

This PR requires the following PR to be merged first: https://github.com/wordpress-mobile/WordPress-FluxC-Android/pull/2449

Description

Coupons is a feature that can be enabled/disabled in wp-admin.

This PR allows the app to gracefully handle the situation where Coupons is disabled in wp-admin. The app will:

  • Show a screen informing merchants that Coupons is disabled,
  • Also add a button for enabling Coupons directly from the app.

Testing instructions

  1. Disable Coupons in wp-admin by unchecking the option in WooCommerce > Settings > General tab > "Enable coupons",
  2. Run app and make sure Coupons Management is enabled in Settings > Beta Features.
  3. Go to Hub Menu > Coupons,
  4. Make sure the Coupons disabled notice screen is shown,
  5. Tap the Enable Coupons button,
  6. Once it is done, make sure the screen either loads some Coupons (if you already have some in the test site), or show the empty Coupons screen.

Video

https://user-images.githubusercontent.com/266376/175510819-535bfec9-b71a-49b7-8c6d-62633f712af8.mov

hafizrahman avatar Jun 24 '22 05:06 hafizrahman

You can trigger optional UI/connected tests for these changes by visiting CircleCI here.

peril-woocommerce[bot] avatar Jun 24 '22 05:06 peril-woocommerce[bot]

Found 1 violations:

The PR caused the following dependency changes:

expand

-+--- org.wordpress:fluxc:1.45.1
-|    +--- org.wordpress:wellsql:1.7.0
-|    |    \--- org.wordpress.wellsql:wellsql-annotations:1.7.0
-|    +--- org.wordpress.fluxc:fluxc-annotations:1.45.1
-|    +--- org.greenrobot:eventbus:3.3.1 (*)
-|    +--- com.squareup.okhttp3:okhttp:4.9.0 -> 4.9.3 (*)
-|    +--- 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.3.0
-|    |    |    \--- androidx.arch.core:core-common:2.0.0 -> 2.1.0 (*)
-|    |    +--- androidx.arch.core:core-runtime:2.0.0 -> 2.1.0 (*)
-|    |    +--- androidx.lifecycle:lifecycle-runtime:2.0.0 -> 2.4.1 (*)
-|    |    +--- androidx.lifecycle:lifecycle-livedata:2.0.0 -> 2.4.1 (*)
-|    |    \--- androidx.recyclerview:recyclerview:1.0.0 -> 1.2.1 (*)
-|    +--- com.goterl:lazysodium-android:5.0.2
-|    +--- net.java.dev.jna:jna:5.5.0
-|    +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10 (*)
-|    +--- org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.6.10
-|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.6.10 (*)
-|    +--- androidx.appcompat:appcompat:1.0.2 -> 1.4.1 (*)
-|    +--- androidx.recyclerview:recyclerview:1.0.0 -> 1.2.1 (*)
-|    +--- androidx.exifinterface:exifinterface:1.0.0 -> 1.3.3
-|    |    \--- androidx.annotation:annotation:1.2.0 -> 1.3.0
-|    +--- com.squareup.okhttp3:okhttp-urlconnection:4.9.0 -> 4.9.2
-|    |    +--- com.squareup.okhttp3:okhttp:4.9.2 -> 4.9.3 (*)
-|    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.10 -> 1.6.10 (*)
-|    +--- com.google.code.gson:gson:2.8.5 -> 2.9.0
-|    +--- org.apache.commons:commons-text:1.1 -> 1.8 (*)
-|    +--- androidx.room:room-runtime:2.4.2
-|    |    +--- androidx.room:room-common:2.4.2
-|    |    |    \--- androidx.annotation:annotation:1.1.0 -> 1.3.0
-|    |    +--- androidx.sqlite:sqlite-framework:2.2.0
-|    |    |    +--- androidx.annotation:annotation:1.0.0 -> 1.3.0
-|    |    |    \--- androidx.sqlite:sqlite:2.2.0
-|    |    |         \--- androidx.annotation:annotation:1.0.0 -> 1.3.0
-|    |    +--- androidx.sqlite:sqlite:2.2.0 (*)
-|    |    +--- androidx.arch.core:core-runtime:2.0.1 -> 2.1.0 (*)
-|    |    \--- androidx.annotation:annotation-experimental:1.1.0
-|    +--- androidx.room:room-ktx:2.4.2
-|    |    +--- androidx.room:room-common:2.4.2 (*)
-|    |    +--- androidx.room:room-runtime:2.4.2 (*)
-|    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.6.10 (*)
-|    |    \--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2 -> 1.6.1 (*)
-|    +--- com.google.dagger:dagger:2.29.1 -> 2.41
-|    |    \--- javax.inject:javax.inject:1
-|    +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9 -> 1.6.1 (*)
-|    \--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9 -> 1.6.1 (*)
++--- org.wordpress:fluxc:2449-5836662f803f509df8614e86b60019c3a6a47016
+|    +--- org.wordpress:wellsql:1.7.0
+|    |    \--- org.wordpress.wellsql:wellsql-annotations:1.7.0
+|    +--- org.wordpress.fluxc:fluxc-annotations:2449-5836662f803f509df8614e86b60019c3a6a47016
+|    +--- org.greenrobot:eventbus:3.3.1 (*)
+|    +--- com.squareup.okhttp3:okhttp:4.9.0 -> 4.9.3 (*)
+|    +--- 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.3.0
+|    |    |    \--- androidx.arch.core:core-common:2.0.0 -> 2.1.0 (*)
+|    |    +--- androidx.arch.core:core-runtime:2.0.0 -> 2.1.0 (*)
+|    |    +--- androidx.lifecycle:lifecycle-runtime:2.0.0 -> 2.4.1 (*)
+|    |    +--- androidx.lifecycle:lifecycle-livedata:2.0.0 -> 2.4.1 (*)
+|    |    \--- androidx.recyclerview:recyclerview:1.0.0 -> 1.2.1 (*)
+|    +--- com.goterl:lazysodium-android:5.0.2
+|    +--- net.java.dev.jna:jna:5.5.0
+|    +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10 (*)
+|    +--- org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.6.10
+|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.6.10 (*)
+|    +--- androidx.appcompat:appcompat:1.0.2 -> 1.4.1 (*)
+|    +--- androidx.recyclerview:recyclerview:1.0.0 -> 1.2.1 (*)
+|    +--- androidx.exifinterface:exifinterface:1.0.0 -> 1.3.3
+|    |    \--- androidx.annotation:annotation:1.2.0 -> 1.3.0
+|    +--- com.squareup.okhttp3:okhttp-urlconnection:4.9.0 -> 4.9.2
+|    |    +--- com.squareup.okhttp3:okhttp:4.9.2 -> 4.9.3 (*)
+|    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.10 -> 1.6.10 (*)
+|    +--- com.google.code.gson:gson:2.8.5 -> 2.9.0
+|    +--- org.apache.commons:commons-text:1.1 -> 1.8 (*)
+|    +--- androidx.room:room-runtime:2.4.2
+|    |    +--- androidx.room:room-common:2.4.2
+|    |    |    \--- androidx.annotation:annotation:1.1.0 -> 1.3.0
+|    |    +--- androidx.sqlite:sqlite-framework:2.2.0
+|    |    |    +--- androidx.annotation:annotation:1.0.0 -> 1.3.0
+|    |    |    \--- androidx.sqlite:sqlite:2.2.0
+|    |    |         \--- androidx.annotation:annotation:1.0.0 -> 1.3.0
+|    |    +--- androidx.sqlite:sqlite:2.2.0 (*)
+|    |    +--- androidx.arch.core:core-runtime:2.0.1 -> 2.1.0 (*)
+|    |    \--- androidx.annotation:annotation-experimental:1.1.0
+|    +--- androidx.room:room-ktx:2.4.2
+|    |    +--- androidx.room:room-common:2.4.2 (*)
+|    |    +--- androidx.room:room-runtime:2.4.2 (*)
+|    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.6.10 (*)
+|    |    \--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2 -> 1.6.1 (*)
+|    +--- com.google.dagger:dagger:2.29.1 -> 2.41
+|    |    \--- javax.inject:javax.inject:1
+|    +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9 -> 1.6.1 (*)
+|    \--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9 -> 1.6.1 (*)
-\--- org.wordpress.fluxc.plugins:woocommerce:1.45.1
-     +--- org.wordpress:wellsql:1.7.0 (*)
-     +--- org.wordpress.fluxc:fluxc-annotations:1.45.1
-     +--- androidx.room:room-ktx:2.4.2 (*)
-     +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10 (*)
-     +--- org.wordpress:fluxc:1.45.1 (*)
-     +--- org.apache.commons:commons-lang3:3.7 -> 3.9
-     +--- com.google.code.gson:gson:2.8.5 -> 2.9.0
-     +--- com.google.dagger:dagger:2.29.1 -> 2.41 (*)
-     +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9 -> 1.6.1 (*)
-     +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9 -> 1.6.1 (*)
-     \--- androidx.room:room-runtime:2.4.2 (*)
+\--- org.wordpress.fluxc.plugins:woocommerce:2449-5836662f803f509df8614e86b60019c3a6a47016
+     +--- org.wordpress:wellsql:1.7.0 (*)
+     +--- org.wordpress.fluxc:fluxc-annotations:2449-5836662f803f509df8614e86b60019c3a6a47016
+     +--- androidx.room:room-ktx:2.4.2 (*)
+     +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10 (*)
+     +--- org.wordpress:fluxc:2449-5836662f803f509df8614e86b60019c3a6a47016 (*)
+     +--- org.apache.commons:commons-lang3:3.7 -> 3.9
+     +--- com.google.code.gson:gson:2.8.5 -> 2.9.0
+     +--- com.google.dagger:dagger:2.29.1 -> 2.41 (*)
+     +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9 -> 1.6.1 (*)
+     +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9 -> 1.6.1 (*)
+     \--- androidx.room:room-runtime:2.4.2 (*)

Please review and act accordingly

<this is a auto generated comment from violation-comments-lib F7F8ASD8123FSDF>

<ACCUMULATED-VIOLATIONS>

wpmobilebot avatar Jun 24 '22 05:06 wpmobilebot

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

wpmobilebot avatar Jun 24 '22 05:06 wpmobilebot

Codecov Report

Merging #6809 (cc3488b) into trunk (754675a) will increase coverage by 0.05%. The diff coverage is 90.24%.

@@             Coverage Diff              @@
##              trunk    #6809      +/-   ##
============================================
+ Coverage     44.91%   44.96%   +0.05%     
- Complexity     2966     2967       +1     
============================================
  Files           533      533              
  Lines         29187    29219      +32     
  Branches       3861     3865       +4     
============================================
+ Hits          13109    13139      +30     
  Misses        14861    14861              
- Partials       1217     1219       +2     
Impacted Files Coverage Δ
...commerce/android/ui/coupons/CouponListViewModel.kt 86.33% <90.24%> (+2.21%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov-commenter avatar Jun 24 '22 11:06 codecov-commenter

Closing for now as we're pausing work on this project. We can always return to it later.

hafizrahman avatar Aug 11 '22 06:08 hafizrahman