mirror of
https://github.com/nicoverbruggen/NVAppUpdater.git
synced 2025-08-10 10:40:08 +02:00
Cleanup
This commit is contained in:
@@ -24,7 +24,7 @@ As a separate target (for a macOS app), you need to add the following file:
|
|||||||
import Cocoa
|
import Cocoa
|
||||||
import AppUpdater
|
import AppUpdater
|
||||||
|
|
||||||
let delegate = AppSelfUpdater(
|
let delegate = SelfUpdater(
|
||||||
appName: "My App",
|
appName: "My App",
|
||||||
bundleIdentifiers: ["com.example.my-app"],
|
bundleIdentifiers: ["com.example.my-app"],
|
||||||
baseUpdaterPath: "~/.config/com.example.my-app/updater"
|
baseUpdaterPath: "~/.config/com.example.my-app/updater"
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import Cocoa
|
import Cocoa
|
||||||
|
|
||||||
open class AppSelfUpdater: NSObject, NSApplicationDelegate {
|
open class SelfUpdater: NSObject, NSApplicationDelegate {
|
||||||
|
|
||||||
// MARK: - Requires Configuration
|
// MARK: - Requires Configuration
|
||||||
|
|
||||||
@@ -41,9 +41,12 @@ open class AppSelfUpdater: NSObject, NSApplicationDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func installUpdate() async {
|
func installUpdate() async {
|
||||||
print("APP SELF-UPDATER by Nico Verbruggen")
|
|
||||||
print("Configured for \(self.appName)\n\(self.bundleIdentifiers)")
|
|
||||||
print("===========================================")
|
print("===========================================")
|
||||||
|
print("\(Executable.name), version \(Executable.fullVersion)")
|
||||||
|
print("Using AppUpdater by Nico Verbruggen")
|
||||||
|
print("===========================================")
|
||||||
|
|
||||||
|
print("Configured for \(self.appName) bundles: \(self.bundleIdentifiers)")
|
||||||
|
|
||||||
self.updaterPath = self.baseUpdaterPath
|
self.updaterPath = self.baseUpdaterPath
|
||||||
.replacingOccurrences(of: "~", with: NSHomeDirectory())
|
.replacingOccurrences(of: "~", with: NSHomeDirectory())
|
||||||
@@ -171,3 +174,8 @@ open class AppSelfUpdater: NSObject, NSApplicationDelegate {
|
|||||||
return "/Applications/\(app)"
|
return "/Applications/\(app)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct ReleaseManifest: Codable {
|
||||||
|
let url: String
|
||||||
|
let sha256: String
|
||||||
|
}
|
30
Sources/AppUpdater/Support/Executable.swift
Normal file
30
Sources/AppUpdater/Support/Executable.swift
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
//
|
||||||
|
// Created by Nico Verbruggen on 30/05/2024.
|
||||||
|
// Copyright © 2024 Nico Verbruggen. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
class Executable {
|
||||||
|
static var name: String {
|
||||||
|
Bundle.main.infoDictionary?["CFBundleName"] as! String
|
||||||
|
}
|
||||||
|
|
||||||
|
static var identifier: String {
|
||||||
|
Bundle.main.infoDictionary?["CFBundleIdentifier"] as! String
|
||||||
|
}
|
||||||
|
|
||||||
|
static var fullVersion: String {
|
||||||
|
let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as! String
|
||||||
|
let build = Bundle.main.infoDictionary?["CFBundleVersion"] as! String
|
||||||
|
return "\(version) (\(build))"
|
||||||
|
}
|
||||||
|
|
||||||
|
static var bundleVersion: String {
|
||||||
|
return Bundle.main.infoDictionary?["CFBundleVersion"] as! String
|
||||||
|
}
|
||||||
|
|
||||||
|
static var shortVersion: String {
|
||||||
|
return Bundle.main.infoDictionary?["CFBundleShortVersionString"] as! String
|
||||||
|
}
|
||||||
|
}
|
@@ -1,9 +0,0 @@
|
|||||||
//
|
|
||||||
// Created by Nico Verbruggen on 26/05/2024.
|
|
||||||
// Copyright © 2024 Nico Verbruggen. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
struct ReleaseManifest: Codable {
|
|
||||||
let url: String
|
|
||||||
let sha256: String
|
|
||||||
}
|
|
Reference in New Issue
Block a user