From 70654ae6bca1e96fc5e20f5c68d688b8f61b4ae3 Mon Sep 17 00:00:00 2001 From: Nico Verbruggen Date: Mon, 15 Jul 2024 22:26:30 +0200 Subject: [PATCH] Cleanup package --- Package.swift | 3 +-- README.md | 2 -- Sources/AppUpdater/API/UpdateCheck.swift | 4 +--- Sources/AppUpdater/Support/Alert.swift | 12 ++++++------ 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/Package.swift b/Package.swift index f2832d5..55c69ed 100644 --- a/Package.swift +++ b/Package.swift @@ -5,13 +5,12 @@ import PackageDescription let package = Package( name: "NVAppUpdater", - defaultLocalization: "en", platforms: [.macOS(.v11)], products: [ .library(name: "NVAppUpdater", targets: ["NVAppUpdater"]), ], dependencies: [ - .package(name: "NVAlert", path: "/Users/nicoverbruggen/Code/SwiftPM/NVAlert") + .package(name: "NVAlert", path: "/Users/nicoverbruggen/Code/SwiftPM/NVAlert"), // .package(url: "https://github.com/nicoverbruggen/NVAlert", branch: "main") ], targets: [ diff --git a/README.md b/README.md index 6a0a885..5c89f1c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # NVAppUpdater Package -**Important**: 👷‍♂️ This package is currently **under construction**, and may change at any time. - ## What is this? This is a package that helps you build a self-updater for a given macOS application. It is supposed to act as an alternative to [Sparkle](https://sparkle-project.org/). diff --git a/Sources/AppUpdater/API/UpdateCheck.swift b/Sources/AppUpdater/API/UpdateCheck.swift index f601edd..a429ccc 100644 --- a/Sources/AppUpdater/API/UpdateCheck.swift +++ b/Sources/AppUpdater/API/UpdateCheck.swift @@ -142,8 +142,6 @@ open class UpdateCheck private func presentNewerVersionAvailable() async { Log.text("A newer version is available!") - let current = AppVersion.fromCurrentVersion() - let alert = await NVAlert().withInformation( title: translations.updateAvailableTitle .replacingOccurrences(of: "%@", with: Executable.name), @@ -164,7 +162,7 @@ open class UpdateCheck if let callback = self.releaseNotesUrlCallback, let url = callback(self.caskFile) { - await alert.withSecondary(text: translations.buttonViewReleaseNotes) { _ in + let _ = await alert.withSecondary(text: translations.buttonViewReleaseNotes) { _ in NSWorkspace.shared.open(url) } } diff --git a/Sources/AppUpdater/Support/Alert.swift b/Sources/AppUpdater/Support/Alert.swift index 3513890..84aed84 100644 --- a/Sources/AppUpdater/Support/Alert.swift +++ b/Sources/AppUpdater/Support/Alert.swift @@ -32,12 +32,12 @@ class Alert { alertStyle: NSAlert.Style = .informational, callback: (() -> Void)? = nil ) async { - let alert = await NSAlert() + let alert = NSAlert() alert.messageText = title alert.informativeText = description - await alert.addButton(withTitle: "OK") + alert.addButton(withTitle: "OK") alert.alertStyle = alertStyle - await alert.runModal() + alert.runModal() if callback != nil { callback!() } @@ -50,14 +50,14 @@ class Alert { options: [String], cancel: Bool = false ) async -> NSApplication.ModalResponse { - let alert = await NSAlert() + let alert = NSAlert() alert.messageText = title alert.informativeText = description for option in options { - await alert.addButton(withTitle: option) + alert.addButton(withTitle: option) } alert.alertStyle = .informational - return await alert.runModal() + return alert.runModal() } }