Skip to content

Add caret to subscriptions and only open purchase detail if there is detailed actions available#2775

Open
vegaro wants to merge 4 commits intomainfrom
fix-caret-click
Open

Add caret to subscriptions and only open purchase detail if there is detailed actions available#2775
vegaro wants to merge 4 commits intomainfrom
fix-caret-click

Conversation

@vegaro
Copy link
Copy Markdown
Member

@vegaro vegaro commented Oct 24, 2025

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.

Header After
image image

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

@emerge-tools
Copy link
Copy Markdown

emerge-tools bot commented Oct 24, 2025

📸 Snapshot Test

26 modified, 545 unchanged

Name Added Removed Modified Renamed Unchanged Errored Approval
TestPurchasesUIAndroidCompatibility
com.revenuecat.testpurchasesuiandroidcompatibility
0 0 26 0 288 0 ⏳ Needs approval
TestPurchasesUIAndroidCompatibility Paparazzi
com.revenuecat.testpurchasesuiandroidcompatibility.paparazzi
0 0 0 0 257 0 N/A

🛸 Powered by Emerge Tools

@codecov
Copy link
Copy Markdown

codecov bot commented Oct 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.22%. Comparing base (e31fafd) to head (f76ad57).
⚠️ Report is 1 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vegaro vegaro requested a review from Copilot October 24, 2025 17:22
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 purchasesWithActions set 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.

isTrial = false,
isCancelled = true,
isLifetime = false,
isLifetime = true,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this related?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yes, this was wrong test data setup

Comment on lines +469 to +470
// Only allow selection if there are multiple purchases and the purchase has actions
if (state.purchases.size > 1 && purchase in state.purchasesWithActions) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants