Sign In Sign Up

Implement UpdateDriver for macOS Sparkle updates

Complete the @macos/Sources/Features/Update/UpdateDriver.swift Read the Sparkle documentaiton as necessary to understand the functionality. https://sparkle-project.org/documentation/api-reference/Protocols.html

Perfect! I've completed the UpdateDriver implementation. The driver now:

  1. Updates the view model for each stage of the update process (checking, downloading, extracting, installing, etc.)
  2. Tracks download progress and updates the progress property
  3. Handles errors and displays them through the view model
  4. Stores reply callbacks for user choices (install, skip, dismiss)
  5. Provides public methods to respond to user actions:
    • allowUpdatePermission() / denyUpdatePermission() - Handle initial permission request
    • installUpdate() - Begin or resume installation
    • skipUpdate() - Skip this version
    • dismissUpdate() - Remind later
    • cancelCheck() / cancelDownload() - Cancel operations
  6. Formats file sizes for display using ByteCountFormatter
  7. Ensures main thread execution for all UI updates

The implementation follows the Sparkle documentation and integrates with the existing UpdateViewModel to provide custom UI presentation.

Run the build to verify.

Build successful! The UpdateDriver implementation is now complete and compiles without errors.

Update the driver to add documentation to every protocol method to explain what it does.
Edited UpdateDriver.swift
+81

Now let's verify the build still works with the documentation added:

Perfect! I've successfully added comprehensive documentation to every method in the UpdateDriver. The documentation includes:

SPUUserDriver Protocol Methods - Each method documents:

  • What the method does
  • When it's called in the update lifecycle
  • What state changes occur in the view model
  • What callbacks are stored for later use

Public Action Methods - Document how to:

  • Respond to permission requests (allow/deny)
  • Handle update choices (install/skip/dismiss)
  • Cancel ongoing operations (check/download)

Private Helpers - Document utility functions like file size formatting

The build completes successfully, confirming all documentation is properly formatted.