Skip to content

fix(connections): stop Export Options sheet from resizing and save via fileExporter#1739

Merged
datlechin merged 1 commit into
mainfrom
fix/connection-export-options-sheet
Jun 20, 2026
Merged

fix(connections): stop Export Options sheet from resizing and save via fileExporter#1739
datlechin merged 1 commit into
mainfrom
fix/connection-export-options-sheet

Conversation

@datlechin

Copy link
Copy Markdown
Member

What

Reworks the Welcome window's Export Options sheet (right-click a connection > Export) so it behaves like a native macOS dialog.

Why

Three defects, all from the view fighting macOS conventions:

  1. Resized on toggle. A grouped Form that conditionally added/removed Sections, with a fixed width but no height, made the sheet jump when "Include Credentials" was turned on.
  2. Over-chromed. Form(.formStyle(.grouped)) inside hand-built title/divider/footer chrome rendered a card-in-a-card, inconsistent with the sibling import sheet.
  3. Fragile save flow. Export dismissed the sheet, slept 200ms, re-acquired NSApp.keyWindow, then opened an NSSavePanel by hand, hand-rolling what .fileExporter already does (and what the import side already uses via .fileImporter).

What changed

  • Plain VStack/Grid layout in one fixed frame(width: 440, height: 300). Passphrase fields reveal in pre-sized space; the validation message sits in a reserved slot, so the window never resizes.
  • Save now uses SwiftUI .fileExporter with a new ConnectionExportDocument: FileDocument. Removed the dismiss + Task.sleep(200ms) + NSApp.keyWindow workaround.
  • Passphrase rules extracted into a pure, testable ConnectionExportPassphraseState enum; Export stays disabled until valid, with inline warnings.
  • ConnectionExportService gained Data-returning exportData / exportEncryptedData; the existing URL writers now call them (signatures unchanged).

Pro gating and security (passphrase zeroed once the ciphertext is built; the document holds only encrypted bytes) are preserved.

Tests

New ConnectionExportDataTests: plaintext and encrypted round-trips (right and wrong passphrase) plus validator-state cases. This is the first coverage of the export pipeline.

The system save panel is a system dialog and is not UI-automatable, so the save step itself is not covered by a UI test.

Notes

SwiftLint --strict passes on the changed files. The numbered steps in docs/features/connection-sharing.mdx stay accurate (the flow is unchanged), so no docs text change.

@datlechin datlechin merged commit 4f3a037 into main Jun 20, 2026
3 of 4 checks passed
@datlechin datlechin deleted the fix/connection-export-options-sheet branch June 20, 2026 13:51
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