feat(client): native clipboard via expo-clipboard #218

Closed
opened 2026-06-21 16:39:17 +00:00 by james · 0 comments
Owner

Context

The Account screen reveals a freshly-minted Personal Access Token's plaintext exactly once with a "Copy" affordance. On web (the PWA target) this uses navigator.clipboard.writeText. On native (Android, Flatpak), navigator.clipboard doesn't exist, so the screen falls back to "manual copy" — the user holds the plaintext on screen and copies it by hand.

expo-clipboard is the proper native answer; the platform shim was deferred while the universal client was being scaffolded.

Source

apps/client/app/(app)/account.tsx lines 42-45:

Clipboard: navigator.clipboard works fine on RN Web (the PWA target). Native builds (#211) will swap in expo-clipboard via a platform shim; until then we keep the plaintext on screen for manual copy on those platforms.

PR #205 ("Out of scope"):

Native-only expo-clipboard; web's navigator.clipboard covers the PWA target.

Scope

  • Add expo-clipboard to apps/client/.
  • Replace the inline navigator.clipboard call in account.tsx with a small lib/clipboard.ts shim: setStringAsync from expo-clipboard on native, navigator.clipboard.writeText on web.
  • Surface the "Copied" feedback consistently across platforms.
  • Confirm there is no other place in the client today that needs clipboard — if there is, sweep it.

Acceptance criteria

  • pnpm -F @carol/client test covers the shim's web + native branches.
  • Manual smoke on Android: mint a PAT, tap Copy, paste into another app — round-trips.
  • No regression on web.
  • apps/client/README.md documents the new dep (if it requires any native permission, which expo-clipboard does not in practice).

Composes with

  • #176 (universal client epic).
  • #135 (closed — PATs).
## Context The Account screen reveals a freshly-minted Personal Access Token's plaintext exactly once with a "Copy" affordance. On web (the PWA target) this uses `navigator.clipboard.writeText`. On native (Android, Flatpak), `navigator.clipboard` doesn't exist, so the screen falls back to "manual copy" — the user holds the plaintext on screen and copies it by hand. `expo-clipboard` is the proper native answer; the platform shim was deferred while the universal client was being scaffolded. ## Source `apps/client/app/(app)/account.tsx` lines 42-45: > Clipboard: navigator.clipboard works fine on RN Web (the PWA target). Native builds (#211) will swap in expo-clipboard via a platform shim; until then we keep the plaintext on screen for manual copy on those platforms. PR #205 ("Out of scope"): > Native-only `expo-clipboard`; web's `navigator.clipboard` covers the PWA target. ## Scope - Add `expo-clipboard` to `apps/client/`. - Replace the inline `navigator.clipboard` call in `account.tsx` with a small `lib/clipboard.ts` shim: `setStringAsync` from `expo-clipboard` on native, `navigator.clipboard.writeText` on web. - Surface the "Copied" feedback consistently across platforms. - Confirm there is no other place in the client today that needs clipboard — if there is, sweep it. ## Acceptance criteria - [ ] `pnpm -F @carol/client test` covers the shim's web + native branches. - [ ] Manual smoke on Android: mint a PAT, tap Copy, paste into another app — round-trips. - [ ] No regression on web. - [ ] `apps/client/README.md` documents the new dep (if it requires any native permission, which `expo-clipboard` does not in practice). ## Composes with - #176 (universal client epic). - #135 (closed — PATs).
james closed this issue 2026-06-23 16:05:47 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
james/carol#218
No description provided.