Skip to content

feat: open a drive from the sign-in screen without signing in - #2333

Open
vilenarios wants to merge 1 commit into
devfrom
open-drive-from-login
Open

vilenarios wants to merge 1 commit into
devfrom
open-drive-from-login

Conversation

@vilenarios

Copy link
Copy Markdown
Collaborator

What

A visitor with a drive link or a Drive ID can open that drive from the sign-in screen. No wallet, no account, no second step. Public drives need nothing else; a private drive opens with the drive key it was shared with (a password cannot open one without the owner's wallet, so the dialog never asks for one). Signing in later keeps the drive.

  • Sign-in screen: one link under Log in / Sign up, "Open it without signing in", opening a dialog with one field that takes a Drive ID or any ArDrive link, including file links. It looks the drive up, shows a key field when the drive is private (pre-filled when the link carried the key), and Open drive writes the drive row and routes to it. The explorer shows "Syncing drive" from the first frame; the files appear when the sync ends.
  • Router: openDriveAsVisitor starts the drive's sync as the explorer builds (from the cubit factory for a fresh explorer, from the route-link follower for one already open). signInKeepingDrive keeps the drive across login, so a visitor who signs in lands back on it. A private drive whose key is not in memory (a reload with the key stripped from the URL) gets the key prompt once; cancelling uses Land on Your drives or sign in when the attach dialog is cancelled #2325's landing.
  • Carry-over: ProfileCubit.unlockDefaultProfile awaits DriveDao.persistInMemoryDriveKeys before emitting ProfileLoggedIn, so a private drive opened as a visitor gets its key encrypted onto the row and keeps working after login. No memory fallback in getDriveKey: the drive-state sync relies on "private row with no key" meaning nothing to open an artifact with.
  • Visitor strip above the explorer with Sign in. The top bar's Log in keeps the drive instead of logging out. The New button offers a visitor "Open another drive".
  • Visitor leaks closed (each gated the way its neighbours already were): Create snapshot in the desktop drive menu and the Snapshots tab, License add/update in the details panel, Your drives in the sync-indicator menu, the create-drive cards on the empty page, private thumbnails (memory-key fallback), mobile share-to-app, and new-window preview on private drives.

Two pre-existing bugs fixed on the way

A freshly opened drive flashed "Drive not synced" for about a second before its files:

  1. DriveDetailCubit._handleFolderNotFound emitted the unsynced state without the running-sync gate the normal folder read applies.
  2. SyncCubit.syncMetadataOnly emitted SyncIdle unconditionally for a visitor, over the single-drive sync the explorer had just started. The signed-in branch already guarded this with _finishMetadataSync.

Also ActivityCubit.performUninterruptableActivity is now typed Future<void> (it always returned one) and releases ActivityInProgress in a finally.

Verification

  • flutter analyze clean for lib/ and test/; full flutter test: 3732 passed, 0 failed before the rebase, and the affected suites (1222 tests) after it.
  • New tests: drive_link_input_test, open_drive_cubit_test, open_drive_modal_test, visitor_banner_test, profile_card_login_test, drive_dao_visitor_keys_test, visitor_metadata_sync_test, plus router tests for the new methods.
  • Browser, on a local release build with tool/web_e2e/ and the test wallet's drives: public open by ID from the landing (three drives), open another drive from the New button, private open by keyed share link, reload with and without the key, cancel on the key prompt, sign in from the strip landing back on the drive, a second tab, the visitor's drive menu, phone width. All passed. The staging share-link path was probed first to confirm the attach dialog already waited for close.

Follow-ups, not in this PR

  • A visitor reopening a keyless private drive sees a red "Sync incomplete" note from the start-up sync before the key prompt (pre-existing; that sync could skip private drives whose key is not in memory).
  • The profile menu's Log out did not fire for a visitor in the harness; worth a manual check.
  • Mobile share-to-app and the Snapshots tab / License row gates are covered by tests and review, not the browser.
  • Strings are in app_en.arb only, as the other ARB files already lack the newer attach strings.

🤖 Generated with Claude Code

A visitor with a drive link or a Drive ID opens that drive from the landing
card. No wallet, no account, no second step. Public drives need nothing else;
a private drive opens with the drive key it was shared with. Signing in later
keeps the drive.

- landing card: one link, "Open it without signing in", opening a dialog
  that takes a Drive ID or any ArDrive link (including file links) through
  the route parser, looks the drive up, asks for a key when it is private,
  writes the drive row with no profile key and hands off to the router
- router: openDriveAsVisitor starts the drive's sync as the explorer builds
  (from the cubit factory and the route-link follower), signInKeepingDrive
  keeps the drive across login, and a private drive whose key is not in
  memory is prompted for once; cancelling lands on sign in
- carry-over: ProfileCubit awaits DriveDao.persistInMemoryDriveKeys before
  announcing the login, so a private drive opened as a visitor survives
- visitor strip above the explorer with Sign in; the top bar's Log in keeps
  the drive instead of logging out; the New button offers Open another drive
- visitor leaks closed: Create snapshot (desktop menu, Snapshots tab),
  License add/update, Your drives in the sync menu, the create-drive cards,
  private thumbnails, mobile share-to-app, new-window preview on private
  drives
- two pre-existing causes of a "Drive not synced" flash on a freshly opened
  drive: DriveDetailCubit's folder-not-found path emitted the unsynced state
  without the running-sync gate, and SyncCubit.syncMetadataOnly emitted idle
  over a running single-drive sync for a visitor
- ActivityCubit.performUninterruptableActivity is typed Future<void> and
  releases the flag in a finally

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 21, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 24 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: ardriveapp/ardrive-web/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9b486be8-33c3-4d08-a04a-c265d4343ac7
📥 Commits

Reviewing files that changed from the base of the PR and between ec2eae6 and 5d81548.

📒 Files selected for processing: 35
  • lib/app_shell.dart
  • lib/authentication/login/blocs/open_drive_cubit.dart
  • lib/authentication/login/blocs/open_drive_state.dart
  • lib/authentication/login/views/landing_view.dart
  • lib/authentication/login/views/modals/open_drive_modal.dart
  • lib/blocs/activity/activity_cubit.dart
  • lib/blocs/drive_detail/drive_detail_cubit.dart
  • lib/blocs/profile/profile_cubit.dart
  • lib/components/app_top_bar.dart
  • lib/components/banners/visitor_banner.dart
  • lib/components/details_panel.dart
  • lib/components/new_button/new_button.dart
  • lib/components/profile_card.dart
  • lib/components/snapshots_tab/snapshots_tab.dart
  • lib/drive_explorer/thumbnail/repository/thumbnail_repository.dart
  • lib/l10n/app_en.arb
  • lib/models/daos/drive_dao/drive_dao.dart
  • lib/pages/app_router_delegate.dart
  • lib/pages/drive_detail/components/drive_explorer_item_tile.dart
  • lib/pages/drive_detail/drive_detail_page.dart
  • lib/pages/no_drives/no_drives_page.dart
  • lib/sharing/sharing_file_listener.dart
  • lib/sync/domain/cubit/sync_cubit.dart
  • lib/utils/drive_link_input.dart
  • lib/utils/plausible_event_tracker/plausible_custom_events.dart
  • lib/utils/plausible_event_tracker/plausible_event_tracker.dart
  • lib/utils/plausible_event_tracker/plausible_page_view_events.dart
  • test/authentication/login/blocs/open_drive_cubit_test.dart
  • test/authentication/login/views/open_drive_modal_test.dart
  • test/components/profile_card_login_test.dart
  • test/components/visitor_banner_test.dart
  • test/models/daos/drive_dao_visitor_keys_test.dart
  • test/pages/app_router_delegate_test.dart
  • test/sync/domain/cubit/visitor_metadata_sync_test.dart
  • test/utils/drive_link_input_test.dart
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

This branch has not been deployed

No deployments
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.

1 participant