[PM-11610] feat: Change TOTP countdown circle color to urgent when ≤ 7 seconds remain#2579
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2579 +/- ##
==========================================
- Coverage 87.17% 86.09% -1.09%
==========================================
Files 1886 2114 +228
Lines 166863 181482 +14619
==========================================
+ Hits 145463 156242 +10779
- Misses 21400 25240 +3840 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…7 seconds remain Consolidates TOTPCodeModel, TOTPExpirationCalculator, TOTPCountdownTimer, and TOTPCountdownTimerView from BitwardenShared and AuthenticatorShared into BitwardenKit, eliminating duplication and fixing the Authenticator's outdated color palette. Adds timerColor() to switch the circle from tintPrimary to error color at the Constants.totpUrgentCountdownThreshold (7 second) boundary. Also fixes a pre-existing trailing-space bug in TOTPCodeModel.displayCode.
09f51e3 to
73f71b4
Compare
… by extracting variables
…from BitwardenKit test imports
…OTPCountdownTimerView
…intermediate variables
|
This was the original Claude plan: |
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE This PR consolidates the duplicated Code Review DetailsNo actionable findings. |
|
Great job! No new security vulnerabilities introduced in this pull request |
| repeats: true, | ||
| block: { _ in | ||
| self.updateCountdown() | ||
| block: { [weak self] _ in |
| onExpiration: { resume() }, | ||
| ) | ||
| } | ||
| _ = subject |
There was a problem hiding this comment.
Without it, the compiler complains about writing to subject without ever reading it, though the test still passes. Claude also generated an explanation that the line also prevents an aggressively optimizing compiler from deallocating the now-weak object before resume is called, so keeping it prevents that potentiality in the future.
I'm so-so on that, because the test passes with out it, but I think I'd rather keep it to avoid the warning.

🎟️ Tracking
PM-11610
📔 Objective
Consolidates duplicated TOTP types (
TOTPCodeModel,TOTPExpirationCalculator,TOTPCountdownTimer,TOTPCountdownTimerView) fromBitwardenSharedandAuthenticatorSharedintoBitwardenKit, then implements the PM-11610 color change: the countdown circle turns red (SharedAsset.Colors.danger) when ≤Constants.totpUrgentCountdownThreshold(7) seconds remain, and shows the primary blue (SharedAsset.Colors.tintPrimary) otherwise. This also fixes the Authenticator's outdated timer color palette and a pre-existing trailing-space bug inTOTPCodeModel.displayCode.📷 Screenshots