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/11508 coupons card 2 #11543

Merged
merged 12 commits into from
May 29, 2024
Merged

Issue/11508 coupons card 2 #11543

merged 12 commits into from
May 29, 2024

Conversation

hichamboushaba
Copy link
Member

@hichamboushaba hichamboushaba commented May 19, 2024

Part of: #11508

Description

This PR adds the following to the coupons Card:

  • Loading UI.
  • Empty View.
  • Coupons List UI.
  • Navigation to the coupons list.
  • Navigation to the coupon details when a coupon is clicked.

Testing instructions

  1. Prepare some test data: create some coupons, and add them to some orders (you can do it from wp-admin even for old orders).
  2. Open the app.
  3. Switch to different date ranges, and confirm the coupons are loaded, and that the empty view is shown when needed.
  4. Click on "View all coupons"
  5. Confirm the coupons list is shown.
  6. Go back, and click on one of the coupons.
  7. Confirm the coupon details screen is shown.

Images/gif

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

@hichamboushaba hichamboushaba added type: enhancement A request for an enhancement. status: do not merge Dependent on another PR, ready for review but not ready for merge. feature: My Store screen Related to home screen project labels May 19, 2024
@dangermattic
Copy link
Collaborator

dangermattic commented May 19, 2024

1 Warning
⚠️ This PR is larger than 300 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented May 19, 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
FlavorJalapeno
Build TypeDebug
Commita06914b
Direct Downloadwoocommerce-prototype-build-pr11543-a06914b.apk

@codecov-commenter
Copy link

codecov-commenter commented May 19, 2024

Codecov Report

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

Project coverage is 40.23%. Comparing base (dd01fde) to head (a06914b).
Report is 188 commits behind head on trunk.

Files Patch % Lines
...droid/ui/dashboard/coupons/DashboardCouponsCard.kt 0.00% 153 Missing ⚠️
.../ui/dashboard/coupons/DashboardCouponsViewModel.kt 0.00% 18 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              trunk   #11543      +/-   ##
============================================
- Coverage     40.33%   40.23%   -0.10%     
  Complexity     5200     5200              
============================================
  Files          1087     1087              
  Lines         63224    63371     +147     
  Branches       8667     8685      +18     
============================================
  Hits          25499    25499              
- Misses        35430    35577     +147     
  Partials       2295     2295              

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

@hichamboushaba hichamboushaba added this to the 18.8 milestone May 19, 2024
tint = colorResource(id = R.color.action_menu_fg_selector)
tint = MaterialTheme.colors.primary
Copy link
Member Author

Choose a reason for hiding this comment

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

Just an inconsistency that I noticed, we were using the wrong color for the menu button here.

Comment on lines +111 to +127
navController.navigateSafely(
DashboardFragmentDirections.actionDashboardToCouponListFragment()
)
navController.navigateSafely(
directions = CouponListFragmentDirections.actionCouponListFragmentToCouponDetailsFragment(
couponId = event.couponId
),
skipThrottling = true,
navOptions = navOptions {
popUpTo(R.id.dashboard)
anim {
enter = R.anim.default_enter_anim
exit = R.anim.default_exit_anim
popEnter = R.anim.default_pop_enter_anim
popExit = R.anim.default_pop_exit_anim
}
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Instead of duplicating the couponDetailsFragment destination, I decided to just perform two navigation actions to show the details.

Copy link
Contributor

Choose a reason for hiding this comment

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

I noticed that when I tap on a coupon and go back, the list isn't shown like for the reviews, but I'm back at the dashboard screen.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that's intentional, since we don't have to handle the undo behavior like in the reviews.

@hichamboushaba hichamboushaba marked this pull request as ready for review May 19, 2024 11:51
@hichamboushaba hichamboushaba requested a review from 0nko May 19, 2024 11:51
Comment on lines 200 to 204
WidgetError(
onContactSupportClicked = { /*TODO*/ },
onRetryClicked = { /*TODO*/ }
onContactSupportClicked = onContactSupportClick,
onRetryClicked = onRetryClick
)
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Here, we will need to differentiate between the two types of errors: a generic error, or when WCAdmin is disabled, this differentiation will be added during the work on #11544

@0nko 0nko self-assigned this May 20, 2024
Base automatically changed from issue/11508-coupons-card to trunk May 21, 2024 12:45
@hichamboushaba hichamboushaba removed the status: do not merge Dependent on another PR, ready for review but not ready for merge. label May 21, 2024
@backwardstruck backwardstruck modified the milestones: 18.8, 18.9 May 24, 2024
Copy link
Contributor

@0nko 0nko left a comment

Choose a reason for hiding this comment

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

I noticed a weird behavior when I deleted a coupon:

  1. I tapped on one of the coupons
  2. Deleted it from the coupon details menu
  3. When the app navigates back to the dashboard, the card shows the error screen and it's not possible to reload it

Comment on lines +111 to +127
navController.navigateSafely(
DashboardFragmentDirections.actionDashboardToCouponListFragment()
)
navController.navigateSafely(
directions = CouponListFragmentDirections.actionCouponListFragmentToCouponDetailsFragment(
couponId = event.couponId
),
skipThrottling = true,
navOptions = navOptions {
popUpTo(R.id.dashboard)
anim {
enter = R.anim.default_enter_anim
exit = R.anim.default_exit_anim
popEnter = R.anim.default_pop_enter_anim
popExit = R.anim.default_pop_exit_anim
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I noticed that when I tap on a coupon and go back, the list isn't shown like for the reviews, but I'm back at the dashboard screen.

This updates the logic to load 6 coupons instead of 3, then exclude deleted coupons, and map only the rest.
@hichamboushaba
Copy link
Member Author

Thanks @0nko for the review, and thanks for catching the mentioned issue, it should be fixed now, please check p1716911641960219/1716911637.747699-slack-C03L1NF1EA3 for an internal discussion around the solution.

@hichamboushaba hichamboushaba requested a review from 0nko May 28, 2024 17:30
Copy link
Contributor

@0nko 0nko 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 addressing the issue, nice job! :shipit:

@0nko 0nko merged commit 4d92f63 into trunk May 29, 2024
14 checks passed
@0nko 0nko deleted the issue/11508-coupons-card-2 branch May 29, 2024 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: My Store screen Related to home screen project type: enhancement A request for an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants