Skip to content

feat(otp): double-click-to-copy + per-account OTP cache (#300)#307

Merged
lshw54 merged 2 commits into
codefrom
fix/issue-300-otp-dblclick-and-cache
Jun 18, 2026
Merged

feat(otp): double-click-to-copy + per-account OTP cache (#300)#307
lshw54 merged 2 commits into
codefrom
fix/issue-300-otp-dblclick-and-cache

Conversation

@lshw54

@lshw54 lshw54 commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

What

Fixes the two OTP items in #300 (regression + feature request vs WPF 5.9.2):

  1. Double-click copy (regression) — double-clicking the generated OTP used to auto-copy it to the clipboard; the rewrite dropped that, leaving the dedicated copy icon as the only path.
  2. OTP caching (feature request) — switching between sub-accounts resets the generated OTP instead of keeping it. Cache OTPs per sub-account so valid tokens stay accessible when toggling.

Fix

src/pages/AccountList.vue:

  • Double-click copy@dblclick on the OTP field copies the current OTP via the existing clipboard helper, with a GetOtpSuccessAndCopy toast (the copy icon stays silent; a double-click has no persistent affordance, so explicit feedback is what confirms the copy).
  • Per-account cache — a Map<sid, otp> records each account's last OTP; the selectedSid watcher restores the cached value on row change instead of unconditionally blanking. Cleared on game switch and on logout. No time-based expiry by design — Start Game always routes through a fresh fetch, so a cached token is never auto-launched.

Closes #300

lshw54 added 2 commits June 19, 2026 03:31
…300)

Two OTP UX regressions/requests vs WPF 5.9.2:
1. Regression — double-clicking the generated OTP used to auto-copy it;
   the rewrite left the dedicated copy icon as the only path. Restore
   the gesture: AccountList's OTP field now copies on dblclick (with a
   GetOtpSuccessAndCopy toast, since a double-click has no persistent
   affordance to confirm the copy landed).
2. Feature — switching between sub-accounts blanked the OTP field. Add a
   per-sid OTP cache so each account's last token is restored when the
   user toggles back, instead of resetting. Cache is session/list-scoped
   (cleared on game switch + logout); no time-based expiry by design —
   Start Game always routes through a fresh fetch, so a cached value is
   never auto-launched off.
@lshw54 lshw54 added the enhancement New feature or request label Jun 18, 2026
@lshw54 lshw54 changed the title fix(otp): double-click-to-copy + per-account OTP cache (#300) feat(otp): double-click-to-copy + per-account OTP cache (#300) Jun 18, 2026
@lshw54 lshw54 merged commit 083c0c7 into code Jun 18, 2026
3 checks passed
@lshw54 lshw54 deleted the fix/issue-300-otp-dblclick-and-cache branch June 18, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

一次性密碼雙擊複製 & 一次性密碼緩存

1 participant