Skip to content

fix(app): let the plans sheet select the plan the user already has - #20474

Merged
mdmohsin7 merged 3 commits into
mainfrom
fix/plans-sheet-select-current-plan
Oct 3, 2026
Merged

mdmohsin7 merged 3 commits into
mainfrom
fix/plans-sheet-select-current-plan

Conversation

@mdmohsin7

@mdmohsin7 mdmohsin7 commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

Summary

On the plans sheet, the card for the user's current price ignored taps. So after picking a different tier under one billing period and switching to the other, the user couldn't select their current plan there.

Example: an Unlimited monthly subscriber picks Plus under Yearly, then switches to Monthly. Tapping Unlimited does nothing, and Plus stays highlighted. The only way back was to switch to Yearly, pick Unlimited there, and switch to Monthly again.

The cause is onTap: isActive ? () {} : onTap in _buildDynamicPlanOption. The backend marks a price is_active when it is the subscription's current price or its scheduled one (backend/routers/payment.py). This tap guard dates back to 5897725 (Aug 2025), so it isn't from the recent UX work.

Change

  • plans_sheet.dart: every plan card can be selected, including the active price.
  • Continue button: the ignored tap was what stopped users "upgrading" onto the price they already pay for. That rule now lives in shouldShowPlanContinueButton, which takes a new selectedPriceIsCurrent and hides Continue when the selected tier and billing period is an active price. The same tier on the other period still shows Continue, so a monthly user can still switch to annual.
  • UsageProvider.debugSetAvailablePlans: a @visibleForTesting hook, next to the existing debugSetSubscription, so the sheet can be tested without a network fetch.

Product invariants affected

none

Failure class

Failure-Class: none

This is a single-widget affordance bug. None of the suggested classes describe it.

Verification

  • New test/widgets/plans_sheet_selection_test.dart, using an account on Unlimited monthly:

    1. Pick Plus under Yearly.
    2. Switch to Monthly.
    3. Tap Unlimited. Unlimited is selected and Continue is hidden.
    4. Switch to Yearly. Unlimited stays selected and Continue shows.

    It passes with the fix. Without the fix it fails at step 3, the Unlimited tap under Monthly.

  • test/utils/plan_pricing_test.dart has a new case for selectedPriceIsCurrent. It passes, along with test/widgets/usage_page_redesign_test.dart and test/providers/usage_provider_test.dart.

  • flutter analyze on the changed files: no issues.

  • scripts/pr-preflight --pr-body-file <this body>: passes.

  • Not yet checked on a device.

🤖 Generated with Claude Code

Review in cubic

Mirrors debugSetSubscription so the plans sheet can be driven without a
network fetch.
The card for the user's current (or scheduled) price swallowed taps, so
selecting a different tier under one billing period and switching to the
other left that tier highlighted: the current plan's card there could not
be selected back. For example, an Unlimited monthly user who picked Plus
under Yearly could not select Unlimited under Monthly without going back
to Yearly first.

Every card now selects. The no-op tap was what stopped an "upgrade" onto
the price already paid; that now lives in shouldShowPlanContinueButton,
which hides Continue when the selected tier and period is an active
price. Same tier on the other period still shows Continue (monthly ->
annual).

Verification:
- flutter test test/widgets/plans_sheet_selection_test.dart: passes; it
  fails without the fix at the Unlimited-under-Monthly tap.
- flutter test test/utils/plan_pricing_test.dart,
  test/widgets/usage_page_redesign_test.dart,
  test/providers/usage_provider_test.dart: all pass.
- flutter analyze on the changed files: no issues.

Failure-Class: none

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 6 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread app/lib/utils/plan_pricing.dart Resolved
mdmohsin7 added a commit that referenced this pull request Oct 3, 2026
…0476)

## Summary

`main` fails **Dart Analyze & Tests** at 8fb7dc1, so every app PR is
red. The analyzer ratchet reports an error-severity diagnostic:

```
RETURN_OF_INVALID_TYPE_FROM_CLOSURE app/test/widgets/capturing_finish_swipe_back_test.dart:120
The returned type 'List<dynamic>' isn't returnable from a 'Future<PeopleListResponse?>' function
```

Two changes collided without a textual conflict:
- 677ee83 ("retain known People stats when scans are truncated")
changed `PeopleProvider.loadPeople` to return
`Future<PeopleListResponse?>`.
- f0f2790 (#20375) added this test, which passes `() async => []`.

Each was green on its own branch.

## Change

The test passes `const PeopleListResponse(people: [])`, the same shape
the other People tests use. This is a test-only change; no app code
changes.

## Product invariants affected

none

## Verification

- `flutter analyze` over the whole app: 0 errors.
- `flutter test test/widgets/capturing_finish_swipe_back_test.dart`: 2
tests pass.
- Seen failing on PR #20474's run 37137363033 (job 111244602814).

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/20476?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
@mdmohsin7
mdmohsin7 merged commit d6aa5a8 into main Oct 3, 2026
46 of 48 checks passed
@mdmohsin7
mdmohsin7 deleted the fix/plans-sheet-select-current-plan branch October 3, 2026 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant