Skip to content

[BWA-99] feat: add next TOTP code preview to item list when countdown is near expiry#2565

Draft
fedemkr wants to merge 3 commits intomainfrom
training/bwa-99
Draft

[BWA-99] feat: add next TOTP code preview to item list when countdown is near expiry#2565
fedemkr wants to merge 3 commits intomainfrom
training/bwa-99

Conversation

@fedemkr
Copy link
Copy Markdown
Member

@fedemkr fedemkr commented Apr 22, 2026

🎟️ Tracking

BWA-99

📔 Objective

Adds a "Show next code" toggle to the Vault section of Authenticator Settings. When enabled and the TOTP countdown drops below 10 seconds, each item row displays the upcoming next-period code (smaller, below the current code), giving users a heads-up before the active code expires.

Implementation highlights:

  • New showNextCode: Bool persisted in AppSettingsStore (UserDefaults)
  • New TOTPService.getTotpCode(for:date:) overload generates the next-period code via the existing SDK generateTOTPCode(for:date:) path — no new SDK surface
  • refreshTotpCodes in AuthenticatorItemRepository fetches both current and next code; next-code failures are silently suppressed (try?) so the current code always renders
  • TOTPCountdownTimer exposes @Published secondsRemaining; TOTPCountdownTimerView propagates an isNearExpiration binding (seeded on .onAppear to avoid first-render delay) to ItemListItemRowView
  • Applies to both .totp and .sharedTotp item types

📸 Screenshots

fedemkr added 2 commits April 22, 2026 13:16
… is near expiry

Adds a "Show next code" toggle to Authenticator Settings (Vault section). When
enabled and the countdown timer drops below 10 seconds, each item row displays
the upcoming TOTP code below the current one. Next-code generation uses a
date-parameterized TOTPService overload; failures are silently suppressed so
the current code always shows.
… is near expiry

Adds a "Show next code" toggle to Authenticator Settings (Vault section). When
enabled and the countdown timer drops below 10 seconds, each item row displays
the upcoming TOTP code below the current one. Next-code generation uses a
date-parameterized TOTPService overload; failures are silently suppressed so
the current code always shows. Seeds isNearExpiration on view appear to avoid
a first-render delay when a row opens with < 10s already elapsed.
@github-actions github-actions Bot added app:password-manager Bitwarden Password Manager app context app:authenticator Bitwarden Authenticator app context t:feature labels Apr 22, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 22, 2026

Codecov Report

❌ Patch coverage is 86.53846% with 28 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.10%. Comparing base (d0cb942) to head (ae71d73).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...lt/Views/ItemListItemRow/ItemListItemRowView.swift 0.00% 16 Missing ⚠️
...Shared/UI/Vault/Views/TOTPCountdownTimerView.swift 0.00% 7 Missing ⚠️
...ared/UI/Vault/ItemList/ItemList/ItemListItem.swift 91.17% 3 Missing ⚠️
...ared/UI/Vault/ItemList/ItemList/ItemListView.swift 0.00% 1 Missing ⚠️
...t/Views/ItemListItemRow/ItemListItemRowState.swift 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2565      +/-   ##
==========================================
- Coverage   87.17%   86.10%   -1.08%     
==========================================
  Files        1885     2117     +232     
  Lines      166564   181606   +15042     
==========================================
+ Hits       145199   156364   +11165     
- Misses      21365    25242    +3877     

☔ 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.

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

Labels

app:authenticator Bitwarden Authenticator app context app:password-manager Bitwarden Password Manager app context t:feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant