INNER CODE UNIT · Swift
checkForUpdates
AgentiLoop/Agent · Agent/UpdateChecker.swift:36
func checkForUpdates() {
guard !isChecking else { return }
isChecking = true
Task {
defer { isChecking = false }
do {
guard let latest = try await fetchLatestDMG() else {
showAlert(title: "Check for Updates",
message: "No downloadable release was found on GitHub.")
return
}
let current = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "0"
if isVersion(latest.version, newerThan: current) {
promptDownload(latest, currentVersion: current)
} else {
showAlert(title: "You're up to date!",
message: "Agent! \(current) is the latest version.")
}