File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -77,7 +77,19 @@ struct UpdateView: View {
7777 if computerinfo. recommendedUpdates. count > 0 {
7878
7979 Button ( action: {
80- openSoftwareUpdate ( )
80+ // If there is only one update, check if it's a Background Security Update
81+ if computerinfo. recommendedUpdates. count == 1 {
82+ if let update = computerinfo. recommendedUpdates. first {
83+ // Open Background Security Update prefpane when displayname contains it
84+ if update. displayName. contains ( " Background Security Improvement " ) {
85+ openBSI ( )
86+ } else {
87+ openSoftwareUpdate ( )
88+ }
89+ }
90+ } else {
91+ openSoftwareUpdate ( )
92+ }
8193 } ) {
8294 Text ( NSLocalizedString ( " UPDATE_NOW " , comment: " " ) )
8395 . font ( . system( . body, design: . rounded) )
@@ -214,7 +226,7 @@ struct UpdateView: View {
214226 }
215227 }
216228
217- // Open URL
229+ // Open Software Update prefpane in System Settings
218230 func openSoftwareUpdate( ) {
219231
220232 guard let url = URL ( string: " x-apple.systempreferences:com.apple.preferences.softwareupdate " ) else {
@@ -227,6 +239,18 @@ struct UpdateView: View {
227239 appDelegate. togglePopover ( nil )
228240
229241 }
242+
243+ // Open Software Update prefpane in System Settings
244+ func openBSI( ) {
245+ guard let url = URL ( string: " x-apple.systempreferences:com.apple.SecurityImprovements-Settings.extension " ) else {
246+ return
247+ }
248+
249+ NSWorkspace . shared. open ( url)
250+
251+ // Close popover
252+ appDelegate. togglePopover ( nil )
253+ }
230254}
231255
232256struct UpdateViewLegacy : View {
You can’t perform that action at this time.
0 commit comments