INNER CODE UNIT · Swift
promptDownload
AgentiLoop/Agent · Agent/UpdateChecker.swift:105
private func promptDownload(_ latest: LatestDMG, currentVersion: String) {
let alert = NSAlert()
alert.messageText = "A new version of Agent! is available"
alert.informativeText = "Agent! \(latest.version) is available — you have \(currentVersion). Would you like to download it now?"
alert.alertStyle = .informational
alert.addButton(withTitle: "Download")
alert.addButton(withTitle: "Later")
if alert.runModal() == .alertFirstButtonReturn {
NSWorkspace.shared.open(latest.url)
}
}
private func showAlert(title: String, message: String) {
let alert = NSAlert()
alert.messageText = title
alert.informativeText = message
alert.alertStyle = .informational
alert.addButton(withTitle: "OK")