Add caret to subscriptions and only open purchase detail if there is detailed actions available#2775
Add caret to subscriptions and only open purchase detail if there is detailed actions available#2775
Conversation
📸 Snapshot Test26 modified, 545 unchanged
🛸 Powered by Emerge Tools |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2775 +/- ##
=======================================
Coverage 79.22% 79.22%
=======================================
Files 347 347
Lines 13911 13911
Branches 1884 1884
=======================================
Hits 11021 11021
Misses 2109 2109
Partials 781 781 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
This PR improves the purchase information UI by adding visual indicators (carets) to all clickable purchase cards and preventing navigation to detail screens when no actions are available. Previously, carets only appeared on non-subscription purchases, and users could click on any purchase card even when the detail screen had no actionable items.
Key Changes:
- Added caret indicators to subscription purchases to match non-subscription purchases
- Implemented
purchasesWithActionsset to track which purchases have subscription-specific actions available - Modified click handlers to only allow navigation when purchases have associated actions
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| CustomerCenterState.kt | Added purchasesWithActions field to track purchases with available actions |
| CustomerCenterViewModel.kt | Implemented logic to compute and populate purchasesWithActions, and prevent navigation when no detail actions exist |
| InternalCustomerCenter.kt | Updated purchase selection logic to check if purchase is in purchasesWithActions before allowing selection |
| RelevantPurchasesListView.kt | Passed purchasesWithActions through to child components and updated click handler condition |
| PurchaseInformationCardView.kt | Modified caret display logic to show for all clickable purchases regardless of subscription type |
| PurchaseInformationCardViewTest.kt | Added tests verifying clickability for subscription and lifetime purchases |
| CustomerCenterViewModelTests.kt | Added comprehensive tests for purchasesWithActions computation and navigation behavior |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...com/revenuecat/purchases/ui/revenuecatui/customercenter/views/PurchaseInformationCardView.kt
Show resolved
Hide resolved
| isTrial = false, | ||
| isCancelled = true, | ||
| isLifetime = false, | ||
| isLifetime = true, |
There was a problem hiding this comment.
yes, this was wrong test data setup
...com/revenuecat/purchases/ui/revenuecatui/customercenter/viewmodel/CustomerCenterViewModel.kt
Outdated
Show resolved
Hide resolved
| // Only allow selection if there are multiple purchases and the purchase has actions | ||
| if (state.purchases.size > 1 && purchase in state.purchasesWithActions) { |
There was a problem hiding this comment.
What purchase would have no actions at all? 🤔
I wonder if this check is necessary. In iOS we always navigate, even if there are no actions.
There was a problem hiding this comment.
A purchase can have no detail-screen actions when it's a non-Google subscription (no Cancel/Resubscribe from our config), or it's expired with no Resubscribe path, or the management screen only has general paths (e.g. Restore, Contact support) and no subscription specific paths for that purchase. In those cases the detail screen would be empty.
The check avoids navigating to an empty detail view and only shows the caret when there’s at least one action (e.g. Cancel/Resubscribe). If we want to align with iOS and always navigate even when the detail is empty, we can remove the check but I think this is nicer? Idk
Co-authored-by: Cursor <cursoragent@cursor.com>
We were only showing caret right in the in app purchases, not in the subscriptions, which was confusing since it wasn't easy to understand when things were clickable.
We were also allowing clicks even if there was no particular action in the detailed view, so this PR also fixes that. This showcases what I mean, and it also shows the wrong carets:
Screen_recording_20251024_182630.webm