Skip to content

Add new sync screen for showing recovery code#7966

Open
CDRussell wants to merge 1 commit intodevelopfrom
feature/craig/sync-auto-recovery-new-sync-setup-screen
Open

Add new sync screen for showing recovery code#7966
CDRussell wants to merge 1 commit intodevelopfrom
feature/craig/sync-auto-recovery-new-sync-setup-screen

Conversation

@CDRussell
Copy link
Member

@CDRussell CDRussell commented Mar 13, 2026

Task/Issue URL: https://app.asana.com/1/137249556945/project/488551667048375/task/1213299640229975?focus=true

Description

Adds a new "Recover Your Data Easily" screen as an alternative to the existing recovery code screen during sync setup. The new screen includes a "Restore on App Reinstall" toggle that, when enabled, persists the recovery code and device ID to Block Store when the user taps Next or Back.

  • Gated by recoverDataEasilySetupScreen (INTERNAL — enabled for internal builds by default)
  • The toggle is shown only when syncAutoRestore is enabled and Block Store is available on the device
  • Toggle preference is persisted to DataStore so it is remembered if the screen is revisited (which will be needed in follow up PR)
  • On Next or Back: if toggle is ON, saves recovery code + device ID to Block Store; if OFF, clears any existing payload

Steps to test this PR

Notes

  • Prerequisites: Internal build installed on a device with Google Play Services, logged into a Google account.
  • Navigate to Settings > Sync Dev Settings to access Block Store controls and to launch the new screen directly.
  • ℹ️ Clearing app data does not restore Block Store data; it must be an uninstall/reinstall.
  • Suggested logcat filter: Sync-Recovery|Sync-AutoRestore

Scenario 1: recoverDataEasilySetupScreen OFF — old screen shown, no regression

  • Disable recoverDataEasilySetupScreen FF by hardcoding it to FALSE
  • Fresh install internalDebug
  • Set up Sync via Sync & Backup → Sync & Back Up This Device
  • Verify the old recovery code screen is shown (title: "Save Recovery Code")
  • Tap Next — verify sync setup continues normally

Scenario 2: recoverDataEasilySetupScreen ON, syncAutoRestore OFF — new screen shown, no toggle

  • Discard local changes, to return recoverDataEasilySetupScreen to INTERNAL
  • Fresh install
  • Set up Sync via Sync & Backup → Sync & Back Up This Device
  • Verify the new "Recover Your Data Easily" screen is shown
  • Verify the "Restore on App Reinstall" toggle is not visible
  • Tap Next — verify sync setup continues normally
  • Go to Sync Dev Settings → verify Block Store is empty (nothing was written)

Scenario 3: recoverDataEasilySetupScreen ON, syncAutoRestore ON — toggle ON, payload saved on Next

  • Set both recoverDataEasilySetupScreen and syncAutoRestore to INTERNAL
  • Fresh install
  • Set up Sync via Sync & Backup → Sync & Back Up This Device
  • Verify the new "Recover Your Data Easily" screen is shown with the toggle visible and ON by default
  • Tap Next
  • Go to Sync Dev Settings → verify Block Store shows a JSON payload containing both recovery_code and device_id

Scenario 4: recoverDataEasilySetupScreen ON, syncAutoRestore ON — toggle turned OFF, payload cleared

  • Clear app data and restart (clear data this time as you want a fresh slate)
  • Set up Sync. On the new screen, toggle "Restore on App Reinstall" to OFF
  • Tap Next
  • Go to Sync Dev Settings → verify Block Store is empty (payload was cleared)

Note

Medium Risk
Introduces a new sync setup screen and new persistence paths (DataStore + Block Store writes/clears) that affect account recovery behavior and device state. Risk is mitigated by feature-flag gating (recoverDataEasilySetupScreen) and additional unit test coverage, but flow/regression risk remains in setup navigation and storage availability checks.

Overview
Adds an alternative “Recover Your Data Easily” recovery-code step during sync setup (new RecoverDataFragment/RecoverDataViewModel + layout/drawables/strings), selected via a new recoverDataEasilySetupScreen feature toggle.

Extends auto-restore support by detecting Block Store availability (isAutoRestoreAvailable) and introducing a persisted Restore on App Reinstall user preference via a new DataStore (SyncAutoRestorePreferenceDataStore + DI wiring). When the toggle is enabled/disabled, the flow now writes or clears the recovery payload (recovery code + device id) in persistent storage on Next/Back.

Updates internal sync dev settings to refresh Block Store values on resume, add a one-tap “store current recovery code” action, and provide a shortcut to launch the new recovery screen; adds/updates unit tests around the new availability gating and setup-screen selection.

Written by Cursor Bugbot for commit 39f9946. Configure here.

@CDRussell CDRussell changed the base branch from feature/craig/sync-auto-recovery-headless-sync-setup to graphite-base/7966 March 16, 2026 10:43
@CDRussell CDRussell force-pushed the feature/craig/sync-auto-recovery-new-sync-setup-screen branch from b0005f4 to 53d8abb Compare March 16, 2026 10:43
@CDRussell CDRussell force-pushed the graphite-base/7966 branch 2 times, most recently from 5f402ce to fcb4307 Compare March 16, 2026 14:28
@CDRussell CDRussell force-pushed the feature/craig/sync-auto-recovery-new-sync-setup-screen branch from 53d8abb to b37c36f Compare March 16, 2026 14:28
@CDRussell CDRussell changed the base branch from graphite-base/7966 to feature/craig/sync-auto-recovery-prevent-orphaned-devices March 16, 2026 14:28
@CDRussell CDRussell force-pushed the feature/craig/sync-auto-recovery-new-sync-setup-screen branch 3 times, most recently from 78156d2 to 7d1de76 Compare March 16, 2026 15:46
@CDRussell CDRussell force-pushed the feature/craig/sync-auto-recovery-new-sync-setup-screen branch 2 times, most recently from c706b7f to 39f9946 Compare March 17, 2026 11:21
@CDRussell CDRussell marked this pull request as ready for review March 17, 2026 11:41
Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

@CDRussell CDRussell force-pushed the feature/craig/sync-auto-recovery-prevent-orphaned-devices branch from fcb4307 to bc12065 Compare March 18, 2026 10:40
@CDRussell CDRussell force-pushed the feature/craig/sync-auto-recovery-new-sync-setup-screen branch from 39f9946 to 41a2e18 Compare March 18, 2026 10:40
@CDRussell CDRussell force-pushed the feature/craig/sync-auto-recovery-new-sync-setup-screen branch from 41a2e18 to 984c575 Compare March 18, 2026 11:37
@CDRussell CDRussell force-pushed the feature/craig/sync-auto-recovery-prevent-orphaned-devices branch from bc12065 to 08db62c Compare March 18, 2026 11:37
@CDRussell CDRussell force-pushed the feature/craig/sync-auto-recovery-new-sync-setup-screen branch from 984c575 to a81b128 Compare March 18, 2026 11:37
@CDRussell CDRussell force-pushed the feature/craig/sync-auto-recovery-prevent-orphaned-devices branch from 08db62c to eaf246f Compare March 18, 2026 11:37
@CDRussell CDRussell force-pushed the feature/craig/sync-auto-recovery-prevent-orphaned-devices branch 2 times, most recently from 29313e2 to 4b355b1 Compare March 18, 2026 12:02
@CDRussell CDRussell force-pushed the feature/craig/sync-auto-recovery-new-sync-setup-screen branch from a81b128 to ae61b9d Compare March 18, 2026 12:02
@CDRussell CDRussell changed the base branch from feature/craig/sync-auto-recovery-prevent-orphaned-devices to graphite-base/7966 March 18, 2026 12:16
@CDRussell CDRussell force-pushed the graphite-base/7966 branch from 4b355b1 to a0f9e2d Compare March 18, 2026 12:16
@CDRussell CDRussell force-pushed the feature/craig/sync-auto-recovery-new-sync-setup-screen branch from ae61b9d to 0939797 Compare March 18, 2026 12:16
@graphite-app graphite-app bot changed the base branch from graphite-base/7966 to develop March 18, 2026 12:17
@CDRussell CDRussell force-pushed the feature/craig/sync-auto-recovery-new-sync-setup-screen branch 2 times, most recently from 42b11dd to be6df5e Compare March 18, 2026 13:47
@CDRussell CDRussell force-pushed the feature/craig/sync-auto-recovery-new-sync-setup-screen branch from be6df5e to 59f6888 Compare March 18, 2026 17:11
@CDRussell CDRussell force-pushed the feature/craig/sync-auto-recovery-new-sync-setup-screen branch from 59f6888 to 91ef838 Compare March 19, 2026 10:42
@CDRussell CDRussell requested a review from CrisBarreiro March 19, 2026 10:53
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.

2 participants