Skip to content

In-app apartment purchase flow#2912

Draft
hugokallstrom wants to merge 22 commits intodevelopfrom
feat/in-app-apartment-purchase
Draft

In-app apartment purchase flow#2912
hugokallstrom wants to merge 22 commits intodevelopfrom
feat/in-app-apartment-purchase

Conversation

@hugokallstrom
Copy link
Copy Markdown
Contributor

Summary

  • Adds a native Compose purchase flow for SE_APARTMENT_RENT and SE_APARTMENT_BRF, replacing the current link-out to hedvig.com
  • Uses the existing ShopSession + PriceIntent GraphQL API (same as racoon web)
  • New feature-purchase-apartment module with form → tier selection → summary → BankID signing → success flow
  • BankID QR code fallback when the app is not installed
  • Tier cards grouped by coverage level with deductible selection within each tier

Details

  • Form screen: Collects street, zip code, living space, number of co-insured
  • Tier selection: Shows Bas/Standard/Max cards with deductible options per tier
  • Summary: Shows selected product, tier, deductible, and price with discount display
  • Signing: Auto-opens BankID app if installed, shows live QR code if not
  • Entry point: Cross-sell clicks on insurance tab route to in-app flow (hardcoded for testing)

Test plan

  • Tap any cross-sell on insurance tab → opens form screen
  • Fill in address details → tap "Beräkna pris" → navigates to tier selection
  • Select tier and deductible → tap "Fortsätt" → navigates to summary
  • Tap "Signera med BankID" → signing flow with QR code or BankID app
  • After signing → navigates to success screen
  • Back/close from any screen works correctly

🤖 Generated with Claude Code

hugokallstrom and others added 22 commits March 31, 2026 15:52
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Wire the new apartment purchase feature into the app by adding its nav graph
to HedvigNavHost, DI module to ApplicationModule, and navigation callback to
InsuranceGraph. Also handle the new CrossSellInfoType.Purchase in the cross-sell
sheet's exhaustive when expression.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Parses the storeUrl to detect apartment products (hyresratt/bostadsratt
in the URL path) and routes them to the native purchase flow instead of
opening the browser.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
HedvigScaffold already provides a scrollable Column, so adding
verticalScroll inside it caused infinite height constraints.

Also hardcode all cross-sell clicks to route to in-app purchase
for testing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…croll

Removes nested verticalScroll + weight(1f) that caused infinite height
crash. Uses HedvigScaffold which handles scrolling internally.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Text state was managed in the Molecule presenter via events, causing a
round-trip delay on each keystroke that produced cursor jumping and
text disappearing. Now text fields use local remember { mutableStateOf }
in the composable and only send values to the presenter on submit.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…droid)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Without remember, state was recreated on every recomposition,
preventing tier selection and navigation from working.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Detects if BankID app is installed via PackageManager. If installed,
auto-opens the app (existing behavior). If not installed, shows a
live QR code that can be scanned from another device.

Uses the same ZXing-based QR rendering pattern as the login flow.
The liveQrCodeData is already returned by the signing poll query
and updates dynamically.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…orm and summary UI

- Fix signing->success navigation getting stuck by using Unit as LaunchedEffect
  key instead of state (fires once when entering Success/Failed branch)
- Group tier offers by tierDisplayName with deductible radio selector per tier,
  defaulting to lowest deductible
- Add horizontal padding (16dp) to form content and subtitle text
- Show strikethrough gross price on summary when discounted
- Show deductible display in summary card
- Fix HedvigButton missing required enabled parameter in QR code screen

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…tion

Three fixes for the signing flow:
1. Poll immediately on first iteration instead of waiting 2s
2. Use FetchPolicy.NetworkOnly to skip Apollo cache (was returning
   stale QR code data and stale signing status)
3. Use a hasNavigated flag for success/failure navigation instead of
   LaunchedEffect(Unit) which could fail on recomposition

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The purchase graph is already popped when navigating to Success, so
typedPopBackStack for the graph fails and falls through to finishApp().
Use plain popBackStack() instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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