Remove deprecated UpdateUIActions from codebase
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:
- Search for UpdateUIActions in the codebase
- Search for UpdateState to understand the callbacks
- Verify that UpdateUIActions is indeed not used
- 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.
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:
@@ -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)
Thread
Reference Thread
T-5c8f7208-fcad-4f62-a212-65c7c2d61346