[BWA-99] feat: Add next TOTP code preview in Authenticator#6779
[BWA-99] feat: Add next TOTP code preview in Authenticator#6779SaintPatrck wants to merge 4 commits intomainfrom
Conversation
Allow users to see the upcoming TOTP code when the current code is about to expire (< 10 seconds remaining). Controlled by a "Show next code" toggle in Settings > Data, defaulting to off.
Bitwarden Claude Code ReviewOverall Assessment: APPROVE This PR adds a "next TOTP code" preview feature to the Authenticator app, displaying the upcoming verification code when fewer than 10 seconds remain before rotation. The implementation spans the full stack: data layer (second Code Review DetailsNo findings. The implementation is clean and well-structured:
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #6779 +/- ##
==========================================
+ Coverage 84.69% 85.41% +0.71%
==========================================
Files 850 958 +108
Lines 59258 61011 +1753
Branches 8598 8662 +64
==========================================
+ Hits 50188 52111 +1923
+ Misses 6070 5876 -194
- Partials 3000 3024 +24
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Great job! No new security vulnerabilities introduced in this pull request |
Cover SettingsDiskSourceImpl, SettingsRepositoryImpl, SettingsViewModel toggle/update handlers, and TotpCodeManager next code failure fallback.
...rc/main/kotlin/com/bitwarden/authenticator/data/authenticator/manager/TotpCodeManagerImpl.kt
Outdated
Show resolved
Hide resolved
.../com/bitwarden/authenticator/ui/authenticator/feature/util/VerificationCodeItemExtensions.kt
Outdated
Show resolved
Hide resolved
| ) { | ||
| val formattedNextCode = nextAuthCode | ||
| .chunked(size = 3) { "$it" } | ||
| .joinToString(separator = " ") |
There was a problem hiding this comment.
Shouldn't this be:
val formattedNextCode = nextAuthCode
.chunked(size = 3) { it.padEnd(length = 3, padChar = ' ') }
.joinToString(separator = " ")There was a problem hiding this comment.
Ohh, I didn't realize this is for the content description.
Do we want it chunked at all?
...lin/com/bitwarden/authenticator/ui/platform/components/listitem/VaultVerificationCodeItem.kt
Outdated
Show resolved
Hide resolved
.../bitwarden/authenticator/ui/authenticator/feature/util/VerificationCodeItemExtensionsTest.kt
Show resolved
Hide resolved
e07396b to
d2441b7
Compare
.../com/bitwarden/authenticator/ui/authenticator/feature/util/VerificationCodeItemExtensions.kt
Outdated
Show resolved
Hide resolved
d2441b7 to
f7f816f
Compare
| * @property timeLeftSeconds The seconds remaining until a new code is required. | ||
| * @property issueTime The time the verification code was issued. | ||
| * @property id The cipher id of the item. | ||
| * @property username The username associated with the item. |
There was a problem hiding this comment.
This was bugging me. Thank you for removing it. lol
| <string name="allow_camera_access">Allow camera access</string> | ||
| <string name="to_scan_your_card_we_need_access_to_your_camera">To scan your card, we’ll need access to your camera. You can change this anytime in your device settings.</string> | ||
| <string name="show_next_code">Show next code</string> | ||
| <string name="see_incoming_codes_in_the_list">See incoming codes in the list</string> |
There was a problem hiding this comment.
Should this say See upcoming codes in the list?
There was a problem hiding this comment.
This matches Figma (added a screenshot). "Upcoming" does sound a little better though. @RishikaSG-28 thoughts?
| <string name="to_scan_your_card_we_need_access_to_your_camera">To scan your card, we’ll need access to your camera. You can change this anytime in your device settings.</string> | ||
| <string name="show_next_code">Show next code</string> | ||
| <string name="see_incoming_codes_in_the_list">See incoming codes in the list</string> | ||
| <string name="next_code_x">Next code, %1$s</string> |
There was a problem hiding this comment.
Should this be Next code: %1$s?
There was a problem hiding this comment.
Hmm. Probably. This was a last minute addition on Claude's part. @RishikaSG-28 thoughts?

🎟️ Tracking
https://bitwarden.atlassian.net/browse/BWA-99
📔 Objective
Add a "next TOTP code" preview to the Authenticator app. When a verification code is about to expire (< 10 seconds remaining), the upcoming code is displayed below the current one, allowing users to pre-read the next code without waiting for rotation.
Key behaviors:
timeLeftSeconds < 10Implementation details:
generateTotp()SDK call withcurrentTime + periodSecondsDiskSource → Repository → ViewModel → Screenchain for the toggleVaultVerificationCodeItemcomposableItemListingViewModelandItemSearchViewModel📸 Screenshots
Settings
Disclaimer: Figma includes the new Switch row, but other settings are outdated.
Upcoming code
Screen_recording_20260410_090617.mp4