Skip to content

Commit

Permalink
Disable update nag for non-admin users
Browse files Browse the repository at this point in the history
  • Loading branch information
dz0ny committed Mar 14, 2024
1 parent 64539fa commit 96c8e58
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Pareto/AppHandlers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class AppHandlers: NSObject, NetworkHandlerObserver {
statusBar?.statusItem?.isVisible = !(statusBar?.claimsPassed ?? true)
}
}

public indirect enum Error: Swift.Error {
case teamLinkinFailed
}
Expand Down Expand Up @@ -205,6 +205,12 @@ class AppHandlers: NSObject, NetworkHandlerObserver {
}

func checkForRelease() {

if !SystemUser.current.isAdmin {
os_log("non-admin user cannot update the app")
return
}

DispatchQueue.global(qos: .userInteractive).async { [self] in
let currentVersion = Bundle.main.version
if let release = try? updater!.getLatestRelease() {
Expand All @@ -217,7 +223,7 @@ class AppHandlers: NSObject, NetworkHandlerObserver {
if let zipURL = release.assets.filter({ $0.browser_download_url.path.hasSuffix(".zip") }).first {
let done = updater!.downloadAndUpdate(withAsset: zipURL)
// Failed to update
if !done {
if !done && !SystemUser.current.isAdmin {
Defaults[.updateNag] = true
}
}
Expand Down

0 comments on commit 96c8e58

Please sign in to comment.