-
Notifications
You must be signed in to change notification settings - Fork 132
[Dynamic Dashboard] Reviews card: business logic #11477
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
Conversation
Generated by 🚫 Danger |
📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.
|
val viewState = combine(refreshTrigger, status) { refresh, status -> Pair(refresh, status) } | ||
.transformLatest { (refresh, status) -> | ||
emit(ViewState.Loading) | ||
emitAll( | ||
observeMostRecentReviews(forceRefresh = refresh.isForced, status = status) | ||
.map { result -> | ||
result.fold( | ||
onSuccess = { reviews -> | ||
ViewState.Success(reviews) | ||
}, | ||
onFailure = { ViewState.Error } | ||
) | ||
} | ||
) | ||
} | ||
.asLiveData() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic follows approach 2
on what we decided, as it's quite simple to implement for cards with existing caching, I think it would make sense to use it even if iOS team don't, WDYT?
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## trunk #11477 +/- ##
============================================
- Coverage 40.84% 40.78% -0.06%
Complexity 5180 5180
============================================
Files 1068 1070 +2
Lines 62283 62374 +91
Branches 8495 8521 +26
============================================
+ Hits 25437 25438 +1
- Misses 34559 34649 +90
Partials 2287 2287 ☔ View full report in Codecov by Sentry. |
5a0487f
to
5b1befd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I test the PR, even after logging out and clearing the storage the Reviews card is always shown by default.
@0nko Yes, this is fixed on the next PR, this happens because the logic of adding only M1 cards by default wasn't agreed on, and it wasn't added to this PR. |
Okay, I just mentioned that because the test instructions say |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Part of: #11474
Description
This PR adds the business logic part of the reviews card, I wanted to create this PR in this state to keep it small, and to have a chance to discuss how to approach the new cards with the feature flag.
The UI, the navigation to review details and handling of error state will be added on separate PRs.
Testing instructions
Images/gif
RELEASE-NOTES.txt
if necessary. Use the "[Internal]" label for non-user-facing changes.