Sign In Sign Up

Remove deprecated UpdateUIActions from codebase

I think we can get rid of UpdateUIActions. They're not used anymore since our UpdateState has callbacks.

The user is saying that UpdateUIActions can be removed because UpdateState now has callbacks that make it obsolete. Let me search for UpdateUIActions to understand where it's used and confirm it's not needed anymore.

I should:

  1. Search for UpdateUIActions in the codebase
  2. Search for UpdateState to understand the callbacks
  3. Verify that UpdateUIActions is indeed not used
  4. Remove it if confirmed

Let me start by searching for these.

I'll search for UpdateUIActions and UpdateState to verify they're not used and can be safely removed.

UpdateUIActions 7 matches
UpdateState 10 matches

I can see UpdateUIActions is still being used in the popover views. The callbacks are in the UpdateState enum cases (like cancel in Checking, reply in UpdateAvailable, etc.), but the UI actions are still being referenced. Let me check AppDelegate.swift to see how these are wired together:

You're right - the UpdateUIActions just wraps the callbacks that are already in UpdateState. The views can call the callbacks directly from the state. Let me refactor to remove UpdateUIActions:

Updated TODOs
Updated TODOs
@@ -7,11 +7,8 @@
struct UpdatePopoverView: View {
    /// The update view model that provides the current state and information
    @ObservedObject var model: UpdateViewModel
    
    /// The actions that can be performed on updates
    let actions: UpdateUIActions
    
    /// Environment value for dismissing the popover
    @Environment(\.dismiss) private var dismiss
    
    var body: some View {
@@ -62,17 +62,19 @@
            }
            
            HStack(spacing: 8) {
                Button("Not Now") {
                    actions.denyAutoChecks()
                    guard case let .permissionRequest(req) = model.state else { return }
                    req.reply(.init(automaticUpdateChecks: false, sendSystemProfile: false))
                    dismiss()
                }
                .keyboardShortcut(.cancelAction)
                
                Spacer()
                
                Button("Allow") {
                    actions.allowAutoChecks()
                    guard case let .permissionRequest(req) = model.state else { return }
                    req.reply(.init(automaticUpdateChecks: true, sendSystemProfile: false))
                    dismiss()
                }
                .keyboardShortcut(.defaultAction)
                .buttonStyle(.borderedProminent)