Skip to content

Grand bain/entry flow pool touches - Grand bain entry flow: scan sheet and length counter - #172

Closed
SalimMc wants to merge 4 commits into
mainfrom
grand-bain/entry-flow-pool-touches
Closed

SalimMc wants to merge 4 commits into
mainfrom
grand-bain/entry-flow-pool-touches

Conversation

@SalimMc

@SalimMc SalimMc commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

What

Part of the "Grand bain" redesign, covering the entry flow from the scan to logging the swim. There are three commits, one per change.

1. Count a swim in pool lengths (model/swim/SwimDistance.kt)

Pure functions, no UI:

  • POOL_LENGTHS_METERS = listOf(25, 50).
  • metersToLengths(meters, poolLength): the number of whole lengths, or null when the metres are not a whole number of lengths (or nothing was swum).
  • stepLengths(meters, poolLength, delta): adds or removes lengths.
    • A typed distance that is not a whole number of lengths is first rounded down to one.
    • The result stays between 0 and the largest number of whole lengths within MAX_SWIM_DISTANCE_METERS.
    • Rejects a pool length ≤ 0.
  • changePoolLength(meters, from, to): keeps the number of lengths when the user switches pool length.
    • Metres that were typed (not a whole number of lengths) are kept as they are.
    • So is a distance that would go past the maximum.

2. Pool stay screen (ui/poolstay/PoolStayScreen.kt)

  • Length counter above the distance field:
    • 25 m / 50 m pool chips;
    • −/+ buttons around a large length count, between two lane ropes.
  • The metres field stays the single source of truth.
    • The counter only writes metres into it, so the user can still type the metres directly.
    • Metres that are not whole lengths show a dash.
    • Going back to 0 clears the field, so Save is disabled again.
  • Cancel window: the check icon now sits in ripples that spread once when the screen appears.
  • Scrolling: the content is still centred, but can now scroll, so the keyboard never hides Save on a small phone.
  • The ViewModel, the save flow and the existing test tags are unchanged. New tags:
    • LENGTHS_COUNT, LENGTHS_PLUS, LENGTHS_MINUS;
    • poolLength(m).

3. Scan confirmation sheet (ui/subscription/SubscriptionQuickViewScreen.kt)

  • The "Accepted" button moves into a rounded bottom sheet (CONFIRM_SHEET) under the pass. The sheet shows:
    • ripples;
    • the question "Did the gate let you in?";
    • "Declined? Keep the pass up and scan again.".
  • The rule is unchanged: a declined scan is not recorded, because nothing is stored until Accepted is tapped.

New shared drawing (ui/theme/)

  • Ripples.kt: concentric rings that spread out once, with outer rings starting later (rippleRadius).
  • LaneRope.kt: a cord with capsule floats, red near both walls (RED_FLOATS_AT_WALLS = 3) and blue/white between (laneFloatColor).
  • Both are plain shapes in theme colors (no images) and never animate forever.

Tests

  • SwimDistanceTest: whole lengths and the null cases; stepping, rounding down and limits; rejecting a pool length of 0; keeping lengths across pool sizes and the edge cases where the distance is kept.
  • PoolStayScreenTest:
    • the counter fills the metres;
    • switching to a 50 m pool keeps the lengths and saves their metres (4 lengths → 200 m);
    • a dash shows for 1210 m;
    • going back to zero disables Save.
  • SubscriptionQuickViewScreenTest: the sheet shows the question and the declined-scan hint.
  • RipplesTest, LaneRopeTest: ring radii and float colors.
  • Ran locally: ./gradlew testDebugUnitTest --tests '*.ui.theme.*' --tests '*.ui.poolstay.*' --tests '*.ui.subscription.SubscriptionQuickView*' --tests '*.model.swim.*' and ktfmtCheck pass. The full ./gradlew check was not run on this branch; CI runs it.

How to review

  • Scan → the sheet under the pass → Accepted.
  • On the pool stay screen, wait for the cancel window to end, then:
    • tap + a few times;
    • switch to the 50 m pool;
    • type 1210 → the counter shows a dash.
  • This PR is independent of the other grand bain PRs and can be merged on its own.

🤖 Generated with Claude Code

SalimMc and others added 4 commits October 30, 2026 18:36
Convert metres to whole lengths of a 25 m or 50 m pool, step the
distance one length at a time within the limits, and keep the number
of lengths when the pool length changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The distance can now be counted in lengths of a 25 m or 50 m pool,
between two lane ropes; the metres field stays the source of truth.
The welcome check sits in spreading ripples, and the screen scrolls
so the keyboard never hides Save.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Accepted button moves into a sheet under the pass that asks the
question and explains that a declined scan just means scanning again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Feature/entry flow pool touches - Grand bain entry flow: scan sheet and length counter
@SalimMc
SalimMc requested a review from SamiPr0 October 30, 2026 18:58
@SalimMc SalimMc self-assigned this Oct 30, 2026
@sonarqubecloud

Copy link
Copy Markdown

@SamiPr0 SamiPr0 closed this Oct 31, 2026
@SamiPr0
SamiPr0 deleted the grand-bain/entry-flow-pool-touches branch October 31, 2026 21:15
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.

2 participants