aboutsummaryrefslogtreecommitdiff
path: root/Hotline/State/AppUpdate.swift
diff options
context:
space:
mode:
Diffstat (limited to 'Hotline/State/AppUpdate.swift')
-rw-r--r--Hotline/State/AppUpdate.swift9
1 files changed, 3 insertions, 6 deletions
diff --git a/Hotline/State/AppUpdate.swift b/Hotline/State/AppUpdate.swift
index 601859e..558a296 100644
--- a/Hotline/State/AppUpdate.swift
+++ b/Hotline/State/AppUpdate.swift
@@ -35,8 +35,6 @@ final class AppUpdate {
case manual
}
- // MARK: - Public State
-
var isChecking = false
var isDownloading = false
var showWindow = false
@@ -55,7 +53,7 @@ final class AppUpdate {
private let remindDateKey = "update.remind.date"
private let lastPromptedVersionKey = "update.last.prompt.version"
- // MARK: - Public API
+ // MARK: - API
func checkForUpdatesOnLaunch() async {
await checkForUpdates(trigger: .automatic)
@@ -100,7 +98,7 @@ final class AppUpdate {
resetAndCloseWindow()
}
- // MARK: - Internal Logic
+ // MARK: - Implementation
private func checkForUpdates(trigger: CheckTrigger) async {
await MainActor.run {
@@ -259,8 +257,7 @@ final class AppUpdate {
private func downloadRelease(_ release: UpdateReleaseInfo) async {
do {
let (temporaryURL, _) = try await URLSession.shared.download(from: release.downloadURL)
- let downloadsDirectory = FileManager.default.urls(for: .downloadsDirectory, in: .userDomainMask).first!
- let destinationURL = downloadsDirectory.appendingPathComponent(release.assetName)
+ let destinationURL = URL.downloadsDirectory.appendingPathComponent(release.assetName)
if FileManager.default.fileExists(atPath: destinationURL.path) {
try? FileManager.default.removeItem(at: destinationURL)