Refactor UpdateViewModel to use new UpdateState
Done! I've successfully refactored UpdateViewModel.swift to use the new UpdateState exclusively:
✅ Removed the old State enum and related properties (progress, details, error)
✅ Renamed state2 to state
✅ Updated all computed properties to work with the new UpdateState and its associated values
The refactoring extracts data directly from the UpdateState cases (e.g., update.appcastItem.displayVersionString for version, download.progress for download percentage).
✅ Successfully refactored the update system to use UpdateState exclusively. All files updated and the build passes:
- UpdateViewModel.swift: Removed old
Stateenum, renamedstate2→state, updated all computed properties - UpdateDriver.swift: Changed all
state2references tostate - UpdateBadge.swift: Extracts progress from
UpdateStateassociated values - UpdatePill.swift: Uses new
isIdlehelper instead of equality check - UpdatePopoverView.swift: Extracts details/progress/error from
UpdateStatecases - AppDelegate.swift: Replaced demo code with real Sparkle actions
✅ Demo mode reinstated using the new UpdateState. The demo now:
- Shows checking state with a cancel callback
- Transitions to "not found" state (since we can't easily mock SUAppcastItem)
- Includes full download/extract simulation helpers (triggered by install action)
- All actions properly use the new state's associated values
Great! There's a +[SUAppcastItem emptyAppcastItem] class method in Sparkle. Let me use that:
✅ Demo mode now uses SUAppcastItem.empty() to show an update available state with a mock item that can be installed to trigger the download/extract/install flow.