Skip to content

let users download their TAPSIGNER backup when setup fails partway#648

Open
guptapratykshh wants to merge 1 commit into
bitcoinppl:masterfrom
guptapratykshh:fix/tapsigner-intermediate-backup-screen
Open

let users download their TAPSIGNER backup when setup fails partway#648
guptapratykshh wants to merge 1 commit into
bitcoinppl:masterfrom
guptapratykshh:fix/tapsigner-intermediate-backup-screen

Conversation

@guptapratykshh

@guptapratykshh guptapratykshh commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Fixes #308.

When TAPSIGNER setup fails after the backup step has succeeded, show an intermediate screen with a download backup button instead of a generic error so users do not lose the backup the card already created.

Summary by CodeRabbit

Release Notes

  • New Features

    • Backup download option now available during Tap Signer setup recovery when backup data is present
    • New recovery status screen guides users when backup information is available
  • Bug Fixes

    • Improved setup recovery process with enhanced retry and continuation logic

@coderabbitai

coderabbitai Bot commented Apr 16, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@praveenperera has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 21 minutes and 44 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 21 minutes and 44 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3f9d72cb-2d71-43de-9af4-0481469928a7

📥 Commits

Reviewing files that changed from the base of the PR and between f196ece and 9714744.

📒 Files selected for processing (2)
  • android/app/src/main/java/org/bitcoinppl/cove/flows/TapSignerFlow/TapSignerSetupRetryView.kt
  • ios/Cove/Flows/TapSignerFlow/TapSignerSetupRetryView.swift
📝 Walkthrough

Walkthrough

The change modifies TapSignerSetupRetryView to conditionally display an intermediate UI state when backup data exists after a setup failure. It introduces backup download functionality via ShareLink, calls the backup save method on view appearance, and refactors shared logic into reusable functions.

Changes

Cohort / File(s) Summary
TapSignerSetupRetryView Enhancement
ios/Cove/Flows/TapSignerFlow/TapSignerSetupRetryView.swift
Added availableBackup computed property to conditionally extract backup bytes. Introduced intermediateBody(backup:) view builder displaying "Almost there" state with backup download link and continue button. Extracted runContinueSetup() to consolidate retry/continue logic and refactored reusable header and patternBackground view builders. Updated preview to #Preview("Continue from backup").

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 When backup bytes are safely stored,
No error screen shall be deplored!
Download, continue, almost there—
The TapSigner flows with gentle care! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title directly matches the primary objective: allowing users to download their TAPSIGNER backup when setup fails partway, which is exactly what the changes implement.
Linked Issues check ✅ Passed The PR fully implements the coding requirements from issue #308: it displays an intermediate screen with backup download functionality instead of a generic error when TAPSIGNER setup fails after the backup step.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the linked issue: the refactoring of retry/continue logic, new intermediate UI state, and backup download feature are all required for the objective. No unrelated changes were introduced.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps

greptile-apps Bot commented Apr 16, 2026

Copy link
Copy Markdown

Greptile Summary

This PR addresses issue #308 by introducing an intermediate screen in TapSignerSetupRetryView that surfaces a "Download Backup" button when setup fails after the backup step has already completed. The logic is cleanly split into errorBody (no backup available — continueFromInit) and intermediateBody (backup data present — continueFromBackup / continueFromDerive), with shared components extracted to header, patternBackground, and runContinueSetup().

Confidence Score: 5/5

Safe to merge — the core logic is correct, all remaining findings are P2 style suggestions.

The availableBackup switch correctly maps the two backup-carrying response cases and returns nil for the others. Backup is saved to the keychain on screen appearance and the ShareLink makes it downloadable. The runContinueSetup refactor is a clean extraction with no behavior change. Only P2 style issues remain.

No files require special attention beyond the two P2 style suggestions in TapSignerSetupRetryView.swift.

Important Files Changed

Filename Overview
ios/Cove/Flows/TapSignerFlow/TapSignerSetupRetryView.swift Adds intermediate screen with download-backup ShareLink when setup fails after backup step; logic is correct but onAppear placement could be cleaner and .cornerRadius is deprecated.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[TapSignerSetupRetry] --> B{availableBackup?}
    B -- "nil\n(continueFromInit or complete)" --> C[errorBody]
    B -- "Data\n(continueFromBackup or continueFromDerive)" --> D[intermediateBody]

    C --> E[Retry button]
    E --> F[runContinueSetup]

    D --> G[saveTapSignerBackup\non keychain\nonAppear]
    D --> H[ShareLink\nDownload Backup]
    D --> I[Continue button]
    I --> F

    F --> J{nfc.continueSetup}
    J -- ".success(.complete)" --> K[resetRoute to setupSuccess]
    J -- ".success(incomplete)" --> L[Close sheet\nShow error alert]
    J -- ".failure(error)" --> L
Loading

Reviews (1): Last reviewed commit: "Let users download their TAPSIGNER backu..." | Re-trigger Greptile

Comment thread ios/Cove/Flows/TapSignerFlow/TapSignerSetupRetryView.swift Outdated
Comment thread ios/Cove/Flows/TapSignerFlow/TapSignerSetupRetryView.swift Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@ios/Cove/Flows/TapSignerFlow/TapSignerSetupRetryView.swift`:
- Around line 70-73: Add an "in-flight" guard and bind UI disabled state so
repeated taps can't call runContinueSetup() concurrently: introduce a Bool state
(e.g., isRunningSetup) that runContinueSetup() checks/sets at start and clears
on completion/failure, early-returning if already true; update both Button
actions (the Retry button and the other action buttons referenced around
runContinueSetup() calls) to be disabled when isRunningSetup is true and to
reflect the disabled state in their styling so taps are ignored while an NFC
call is in progress.
- Line 205: Update the user-facing failure string in the TapSignerSetupRetryView
case .tapSignerSetupFailed to use the verb form "set up" and consistent product
casing—replace "Failed to setup TapSigner" with "Failed to set up TapSigner" in
the .tapSignerSetupFailed(message: ...) call.
- Around line 145-147: Replace the .onAppear usage that calls
app.saveTapSignerBackup(tapSigner, backup) in TapSignerSetupRetryView with a
.task(id: backup) so the save only runs when the backup value changes; locate
the block where .onAppear { let _ = app.saveTapSignerBackup(tapSigner, backup) }
is used and change it to a .task(id: backup) that invokes saveTapSignerBackup
(awaiting it if it’s async) to prevent duplicate saves when the view reappears.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6767c71d-9f25-4524-8a63-03a4cab448a2

📥 Commits

Reviewing files that changed from the base of the PR and between ea30e0c and f196ece.

📒 Files selected for processing (1)
  • ios/Cove/Flows/TapSignerFlow/TapSignerSetupRetryView.swift

Comment thread ios/Cove/Flows/TapSignerFlow/TapSignerSetupRetryView.swift
Comment thread ios/Cove/Flows/TapSignerFlow/TapSignerSetupRetryView.swift Outdated
Comment thread ios/Cove/Flows/TapSignerFlow/TapSignerSetupRetryView.swift Outdated
Comment thread ios/Cove/Flows/TapSignerFlow/TapSignerSetupRetryView.swift Outdated
Comment thread ios/Cove/Flows/TapSignerFlow/TapSignerSetupRetryView.swift Outdated
@guptapratykshh guptapratykshh force-pushed the fix/tapsigner-intermediate-backup-screen branch 4 times, most recently from 3f87e93 to 1588866 Compare April 17, 2026 04:38

@praveenperera praveenperera left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we bring this change over to android too?

@guptapratykshh guptapratykshh force-pushed the fix/tapsigner-intermediate-backup-screen branch from 1588866 to 47d556a Compare April 18, 2026 04:55
When the backup step succeeds but a later step (derive or change
pin) fails, surface the backup with a download button and a
continue action instead of a generic error. Otherwise the user
loses the only copy of the backup the card just created.

Closes bitcoinppl#308.
@praveenperera praveenperera force-pushed the fix/tapsigner-intermediate-backup-screen branch from 47d556a to 9714744 Compare April 20, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TAPSIGNER intermediate screens

2 participants