Skip to content

Commit

Permalink
feat: do not open safari when change save location
Browse files Browse the repository at this point in the history
If Safari is not running, do not open it, only send messages to the extension when Safari is running.
  • Loading branch information
ACTCD committed Sep 28, 2024
1 parent c38c3a3 commit 16bbb3d
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions xcode/App-Mac/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,16 @@ class ViewController: NSViewController {
// update user interface text display
self.saveLocation.stringValue = url.absoluteString
self.saveLocation.toolTip = url.absoluteString
// notify browser extension of relevant updates
sendExtensionMessage(
name: "SAVE_LOCATION_CHANGED",
userInfo: [
"saveLocation": url.absoluteString.removingPercentEncoding ?? url.absoluteString,
"returnApp": true
]
)
// notify browser extension of relevant updates only when Safari is running
if !NSRunningApplication.runningApplications(withBundleIdentifier: "com.apple.Safari").isEmpty {
sendExtensionMessage(
name: "SAVE_LOCATION_CHANGED",
userInfo: [
"saveLocation": url.absoluteString.removingPercentEncoding ?? url.absoluteString,
"returnApp": true
]
)
}
})
}

Expand Down

0 comments on commit 16bbb3d

Please sign in to comment.