trackslash
VAULT-7 P2

HOTP/TOTP: current code size inconsistent between code types

0
All issues

Description

HOTP and TOTP codes don't display their current code at a consistent size. HOTP codes in particular sometimes render the number narrower.

Wanted

  • The current code should always render at the same size across all code types (HOTP and TOTP).

Sub-issues

0

Linked issues

0

GitHub

0

No branches or pull requests linked.

Comments

1
Bradley

Fixed in https://github.com/badbundle/vault-app/pull/600 (merged as f5c00db3).

Root cause: the code was the only line on a card that could shrink freely. The HOTP card's refresh button made its bottom row taller than the TOTP card's timer bar, so whenever a card was tight (a two-line issuer, a narrow phone or a large text size), the HOTP code shrank and the TOTP code didn't.

Fix:

  • Both card types now draw the code with one shared OTPPreviewCodeText view that holds its vertical size, so only the card's width decides the code's size.
  • The HOTP bottom row now takes only the bar's height.
  • A second bug in OTPCodeTextView is fixed too: with 7-digit codes the last digit stayed full size while the other chunks shrank. Every chunk now scales evenly.
  • New OTPCodePreviewCodeSizeSnapshotTests render HOTP and TOTP cards side by side, including the tight cases.