Cleanup package

This commit is contained in:
2024-07-15 22:26:30 +02:00
parent 6cdffafa9a
commit 70654ae6bc
4 changed files with 8 additions and 13 deletions

View File

@ -5,13 +5,12 @@ import PackageDescription
let package = Package( let package = Package(
name: "NVAppUpdater", name: "NVAppUpdater",
defaultLocalization: "en",
platforms: [.macOS(.v11)], platforms: [.macOS(.v11)],
products: [ products: [
.library(name: "NVAppUpdater", targets: ["NVAppUpdater"]), .library(name: "NVAppUpdater", targets: ["NVAppUpdater"]),
], ],
dependencies: [ 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") // .package(url: "https://github.com/nicoverbruggen/NVAlert", branch: "main")
], ],
targets: [ targets: [

View File

@ -1,7 +1,5 @@
# NVAppUpdater Package # NVAppUpdater Package
**Important**: 👷‍♂️ This package is currently **under construction**, and may change at any time.
## What is this? ## 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/). 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/).

View File

@ -142,8 +142,6 @@ open class UpdateCheck
private func presentNewerVersionAvailable() async { private func presentNewerVersionAvailable() async {
Log.text("A newer version is available!") Log.text("A newer version is available!")
let current = AppVersion.fromCurrentVersion()
let alert = await NVAlert().withInformation( let alert = await NVAlert().withInformation(
title: translations.updateAvailableTitle title: translations.updateAvailableTitle
.replacingOccurrences(of: "%@", with: Executable.name), .replacingOccurrences(of: "%@", with: Executable.name),
@ -164,7 +162,7 @@ open class UpdateCheck
if let callback = self.releaseNotesUrlCallback, if let callback = self.releaseNotesUrlCallback,
let url = callback(self.caskFile) { let url = callback(self.caskFile) {
await alert.withSecondary(text: translations.buttonViewReleaseNotes) { _ in let _ = await alert.withSecondary(text: translations.buttonViewReleaseNotes) { _ in
NSWorkspace.shared.open(url) NSWorkspace.shared.open(url)
} }
} }

View File

@ -32,12 +32,12 @@ class Alert {
alertStyle: NSAlert.Style = .informational, alertStyle: NSAlert.Style = .informational,
callback: (() -> Void)? = nil callback: (() -> Void)? = nil
) async { ) async {
let alert = await NSAlert() let alert = NSAlert()
alert.messageText = title alert.messageText = title
alert.informativeText = description alert.informativeText = description
await alert.addButton(withTitle: "OK") alert.addButton(withTitle: "OK")
alert.alertStyle = alertStyle alert.alertStyle = alertStyle
await alert.runModal() alert.runModal()
if callback != nil { if callback != nil {
callback!() callback!()
} }
@ -50,14 +50,14 @@ class Alert {
options: [String], options: [String],
cancel: Bool = false cancel: Bool = false
) async -> NSApplication.ModalResponse { ) async -> NSApplication.ModalResponse {
let alert = await NSAlert() let alert = NSAlert()
alert.messageText = title alert.messageText = title
alert.informativeText = description alert.informativeText = description
for option in options { for option in options {
await alert.addButton(withTitle: option) alert.addButton(withTitle: option)
} }
alert.alertStyle = .informational alert.alertStyle = .informational
return await alert.runModal() return alert.runModal()
} }
} }