Skip to content

Free, open-source macOS cleaner. CleanMyMac alternative with zero telemetry. Native SwiftUI, scheduled auto-cleaning, Xcode/Homebrew/system cache cleanup. MIT licensed.

Check app releases from Settings

BinaryBearsLLC619dbf78dc94
diff --git a/PureMac.xcodeproj/project.pbxproj b/PureMac.xcodeproj/project.pbxproj
index bcc1b3d..1952ee3 100644
--- a/PureMac.xcodeproj/project.pbxproj
+++ b/PureMac.xcodeproj/project.pbxproj
@@ -90,6 +90,8 @@
FBEE9208E222616A8DF1FE75 /* ProviderPaths.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8AFB912A9A6CFDCB972E978F /* ProviderPaths.swift */; };
FDA30FE6349CA01C8D859F04 /* OrphanListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B71E8F62DB76D85F41F9A2E9 /* OrphanListView.swift */; };
FF6B92CAF96A58625A56A1C0 /* ProtectionAudit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F9B44A9C1B4065126789622 /* ProtectionAudit.swift */; };
+ 726848F8F1CA1E1829107904 /* UpdateServiceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E132B636229ED538463A35E /* UpdateServiceTests.swift */; };
+ C9A572DBF932E601574B64E6 /* AppUpdateSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 583DCE8B0BCE0F50893B6734 /* AppUpdateSettingsView.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -210,6 +212,8 @@
F661A0F64CF93E482CB1728F /* DashboardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DashboardView.swift; sourceTree = "<group>"; };
F77B9D7D5353CD42BD03ADBB /* ApplicationUpdaterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApplicationUpdaterTests.swift; sourceTree = "<group>"; };
F9DCBD97CC88D77AE8DB01A4 /* PermissionCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PermissionCoordinator.swift; sourceTree = "<group>"; };
+ 6E132B636229ED538463A35E /* UpdateServiceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdateServiceTests.swift; sourceTree = "<group>"; };
+ 583DCE8B0BCE0F50893B6734 /* AppUpdateSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppUpdateSettingsView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -236,6 +240,7 @@
261FB8D961FEC76F15EA523A /* PureMacTests */ = {
isa = PBXGroup;
children = (
+ 6E132B636229ED538463A35E /* UpdateServiceTests.swift */,
491771F923C93FD61A263893 /* AppLanguagePreferencesTests.swift */,
F77B9D7D5353CD42BD03ADBB /* ApplicationUpdaterTests.swift */,
752603285F7DBBA12BB3AA91 /* AppStateTests.swift */,
@@ -331,6 +336,7 @@
7BC68AB045DA6E5299FD3CB6 /* Settings */ = {
isa = PBXGroup;
children = (
+ 583DCE8B0BCE0F50893B6734 /* AppUpdateSettingsView.swift */,
3A8D39C3C250F26302EC45AB /* SettingsView.swift */,
);
path = Settings;
@@ -565,6 +571,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
+ C9A572DBF932E601574B64E6 /* AppUpdateSettingsView.swift in Sources */,
DC32253D26D0E29762006DA0 /* AppBundleDragHandle.swift in Sources */,
4F754D89F4CE5142BE384062 /* AppConstants.swift in Sources */,
1B0D043102FDB245312A5147 /* AppFilesView.swift in Sources */,
@@ -635,6 +642,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
+ 726848F8F1CA1E1829107904 /* UpdateServiceTests.swift in Sources */,
59B3096E2AE8ED0397B16798 /* AppLanguagePreferencesTests.swift in Sources */,
E2403D82F00D749C9AD4A6D4 /* AppStateTests.swift in Sources */,
D15B7A053D69D4348D9DCD88 /* ApplicationUpdaterTests.swift in Sources */,
diff --git a/PureMac/PureMacApp.swift b/PureMac/PureMacApp.swift
index aa96b83..fbb29a9 100644
--- a/PureMac/PureMacApp.swift
+++ b/PureMac/PureMacApp.swift
@@ -120,6 +120,9 @@ struct PureMacApp: App {
CommandGroup(replacing: .newItem) {}
CommandMenu("Updates") {
Button("Check for Updates") {
+ appState.showUpdateSettings = true
+ WindowOpener.shared.showMainWindow()
+ NSApp.activate(ignoringOtherApps: true)
UpdateService.shared.checkForUpdates()
}
.keyboardShortcut("u", modifiers: [.command, .shift])
diff --git a/PureMac/Services/MenuBarController.swift b/PureMac/Services/MenuBarController.swift
index 115c8c3..ca676f4 100644
--- a/PureMac/Services/MenuBarController.swift
+++ b/PureMac/Services/MenuBarController.swift
@@ -11,6 +11,16 @@ import Combine
final class WindowOpener {
static let shared = WindowOpener()
var open: ((String) -> Void)?
+ weak var mainWindow: NSWindow?
+
+ func showMainWindow() {
+ if let mainWindow, mainWindow.isVisible || mainWindow.isMiniaturized {
+ mainWindow.deminiaturize(nil)
+ mainWindow.makeKeyAndOrderFront(nil)
+ } else {
+ open?("main")
+ }
+ }
private init() {}
}
diff --git a/PureMac/Services/UpdateService.swift b/PureMac/Services/UpdateService.swift
index a46db1a..75e8e5f 100644
--- a/PureMac/Services/UpdateService.swift
+++ b/PureMac/Services/UpdateService.swift
@@ -1,43 +1,142 @@
import Foundation
-import AppKit
-#if canImport(Sparkle)
-import Sparkle
-#endif
+/// Numeric release versions. Only app tags (vMAJOR.MINOR[.PATCH]) are accepted;
+/// the repository also publishes cli-v... releases which must never win.
+struct AppReleaseVersion: Comparable {
+ let components: [Int]
+ let prerelease: String?
+ init?(_ string: String) {
+ var value = string
+ if value.hasPrefix("v") { value.removeFirst() }
+ let parts = value.split(separator: "-", maxSplits: 1, omittingEmptySubsequences: false)
+ let numbers = parts[0].split(separator: ".", omittingEmptySubsequences: false)
+ guard (2...3).contains(numbers.count),
+ numbers.allSatisfy({ !$0.isEmpty && $0.utf8.allSatisfy { (48...57).contains($0) } }) else { return nil }
+ let parsed = numbers.compactMap { Int($0) }
+ guard parsed.count == numbers.count else { return nil }
+ if parts.count == 2 {
+ guard !parts[1].isEmpty,
+ parts[1].utf8.allSatisfy({ (48...57).contains($0) || (65...90).contains($0) || (97...122).contains($0) || $0 == 46 || $0 == 45 }) else { return nil }
+ }
+ components = parsed + Array(repeating: 0, count: 3 - parsed.count)
+ prerelease = parts.count == 2 ? String(parts[1]) : nil
+ }
+
+ static func < (lhs: Self, rhs: Self) -> Bool {
+ if lhs.components != rhs.components {
+ return lhs.components.lexicographicallyPrecedes(rhs.components)
+ }
+ switch (lhs.prerelease, rhs.prerelease) {
+ case (nil, nil), (nil, _?): return false
+ case (_?, nil): return true
+ case let (left?, right?): return left.compare(right, options: .numeric) == .orderedAscending
+ }
+ }
+}
+
+struct AppRelease: Decodable, Equatable {
+ struct Asset: Decodable, Equatable { let name: String }
+ let tagName: String
+ let htmlURL: URL
+ let draft: Bool
+ let prerelease: Bool
+ let assets: [Asset]
+
+ enum CodingKeys: String, CodingKey {
+ case tagName = "tag_name", htmlURL = "html_url", draft, prerelease, assets
+ }
+
+ var version: AppReleaseVersion? { AppReleaseVersion(tagName) }
+
+ var isStableAppRelease: Bool {
+ guard !draft, !prerelease, let version, version.prerelease == nil,
+ htmlURL.scheme == "https", htmlURL.host == "github.com",
+ htmlURL.user == nil, htmlURL.password == nil, htmlURL.port == nil,
+ htmlURL.path.hasPrefix("/momenbasel/PureMac/releases/tag/") else { return false }
+ return assets.contains {
+ let name = $0.name.lowercased()
+ return (name.hasPrefix("puremac-") || name == "puremac.zip" || name == "puremac.dmg")
+ && !name.contains("cli") && (name.hasSuffix(".zip") || name.hasSuffix(".dmg"))
+ }
+ }
+}
+
+@MainActor
final class UpdateService: ObservableObject {
static let shared = UpdateService()
+ nonisolated static let installedVersion = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "—"
+ nonisolated static let installedBuild = Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as? String ?? "—"
+ nonisolated static let releasesURL = URL(string: "https://github.com/momenbasel/PureMac/releases")!
- #if canImport(Sparkle)
- private var updaterController: SPUStandardUpdaterController?
- #endif
-
- private init() {
- #if canImport(Sparkle)
- // Do not start automatic checking by default; keep control minimal.
- updaterController = SPUStandardUpdaterController(startingUpdater: false, updaterDelegate: nil, userDriverDelegate: nil)
- #endif
+ enum State: Equatable {
+ case idle, checking
+ case available(AppRelease)
+ case upToDate
+ case failed(String)
}
- func checkForUpdates() {
- #if canImport(Sparkle)
- DispatchQueue.main.async {
- // Only start the Sparkle updater if an appcast/feed URL is configured.
- if let _ = Bundle.main.object(forInfoDictionaryKey: "SUFeedURL") as? String {
- self.updaterController?.startUpdater()
- self.updaterController?.updater.checkForUpdates()
- } else {
- // Fallback: open Releases page when no feed is configured.
- if let url = URL(string: "https://github.com/momenbasel/PureMac/releases/latest") {
- NSWorkspace.shared.open(url)
- }
+ enum CheckError: LocalizedError {
+ case invalidVersion, noRelease, rateLimited, serverError
+ var errorDescription: String? {
+ switch self {
+ case .invalidVersion: return String(localized: "This build has no readable version. Open the releases page to check manually.")
+ case .noRelease: return String(localized: "No stable PureMac app release was found. Try again later.")
+ case .rateLimited: return String(localized: "GitHub is receiving too many requests. Please try again later.")
+ case .serverError: return String(localized: "The release service is unavailable. Please try again later.")
}
}
- #else
- // Fallback: open Releases page
- if let url = URL(string: "https://github.com/momenbasel/PureMac/releases/latest") {
- NSWorkspace.shared.open(url)
+ }
+
+ @Published private(set) var state: State = .idle
+ @Published private(set) var lastChecked: Date?
+ var isChecking: Bool { state == .checking }
+ private let currentVersion: String
+ private let fetch: (URLRequest) async throws -> (Data, URLResponse)
+
+ init(currentVersion: String = UpdateService.installedVersion,
+ fetch: @escaping (URLRequest) async throws -> (Data, URLResponse) = { try await URLSession.shared.data(for: $0) }) {
+ self.currentVersion = currentVersion
+ self.fetch = fetch
+ }
+
+ func checkForUpdates() {
+ Task { await check() }
+ }
+
+ func check() async {
+ guard !isChecking else { return }
+ state = .checking
+ do {
+ guard let installed = AppReleaseVersion(currentVersion) else { throw CheckError.invalidVersion }
+ // Fetch a page rather than /latest: the latest release may be CLI.
+ var request = URLRequest(url: URL(string: "https://api.github.com/repos/momenbasel/PureMac/releases?per_page=100")!)
+ request.timeoutInterval = 20
+ request.cachePolicy = .reloadIgnoringLocalCacheData
+ request.setValue("application/vnd.github+json", forHTTPHeaderField: "Accept")
+ request.setValue("PureMac-Update-Check", forHTTPHeaderField: "User-Agent")
+ let (data, response) = try await fetch(request)
+ try Task.checkCancellation()
+ guard let http = response as? HTTPURLResponse else { throw CheckError.serverError }
+ if http.statusCode == 403 || http.statusCode == 429 { throw CheckError.rateLimited }
+ guard http.statusCode == 200 else { throw CheckError.serverError }
+ let release = try Self.latestAppRelease(in: data)
+ guard let latest = release.version else { throw CheckError.noRelease }
+ state = latest > installed ? .available(release) : .upToDate
+ lastChecked = Date()
+ } catch is CancellationError {
+ state = .idle
+ } catch {
+ state = .failed(error.localizedDescription)
}
- #endif
+ }
+
+ nonisolated static func latestAppRelease(in data: Data) throws -> AppRelease {
+ let releases = try JSONDecoder().decode([AppRelease].self, from: data)
+ guard let latest = releases.filter(\.isStableAppRelease).max(by: {
+ // isStableAppRelease validated both versions.
+ $0.version! < $1.version!
+ }) else { throw CheckError.noRelease }
+ return latest
}
}
diff --git a/PureMac/ViewModels/AppState.swift b/PureMac/ViewModels/AppState.swift
index 55a4713..509ef60 100644
--- a/PureMac/ViewModels/AppState.swift
+++ b/PureMac/ViewModels/AppState.swift
@@ -50,6 +50,7 @@ final class ScanProgressTicker: ObservableObject {
final class AppState: ObservableObject {
let languageAtLaunch = AppLanguage.current
@Published var settingsNeedLanguageRestart = false
+ @Published var showUpdateSettings = false
typealias AppFileScanner = @MainActor (
_ app: InstalledApp,
_ locations: Locations,
diff --git a/PureMac/Views/Components/MenuBarMonitorView.swift b/PureMac/Views/Components/MenuBarMonitorView.swift
index ca100a1..900064b 100644
--- a/PureMac/Views/Components/MenuBarMonitorView.swift
+++ b/PureMac/Views/Components/MenuBarMonitorView.swift
@@ -11,6 +11,19 @@ struct WindowOpenerCapture: View {
Color.clear
.frame(width: 0, height: 0)
.onAppear { WindowOpener.shared.open = { id in openWindow(id: id) } }
+ .background(MainWindowReference())
+ }
+}
+
+private struct MainWindowReference: NSViewRepresentable {
+ func makeNSView(context: Context) -> ReferenceView { ReferenceView() }
+ func updateNSView(_ nsView: ReferenceView, context: Context) {}
+
+ final class ReferenceView: NSView {
+ override func viewDidMoveToWindow() {
+ super.viewDidMoveToWindow()
+ if let window { WindowOpener.shared.mainWindow = window }
+ }
}
}
diff --git a/PureMac/Views/MainWindow.swift b/PureMac/Views/MainWindow.swift
index 16165ad..6349eeb 100644
--- a/PureMac/Views/MainWindow.swift
+++ b/PureMac/Views/MainWindow.swift
@@ -45,8 +45,13 @@ struct MainWindow: View {
selectSection(.apps)
appState.pendingExternalApp = nil
}
+ .onChange(of: appState.showUpdateSettings) { showUpdates in
+ if showUpdates { selectSection(.settings) }
+ }
.onAppear {
- if appState.pendingExternalApp != nil {
+ if appState.showUpdateSettings {
+ selectSection(.settings)
+ } else if appState.pendingExternalApp != nil {
selectSection(.apps)
appState.pendingExternalApp = nil
} else if let selectedSection {
diff --git a/PureMac/Views/Settings/AppUpdateSettingsView.swift b/PureMac/Views/Settings/AppUpdateSettingsView.swift
new file mode 100644
index 0000000..616c13c
--- /dev/null
+++ b/PureMac/Views/Settings/AppUpdateSettingsView.swift
@@ -0,0 +1,89 @@
+import AppKit
+import SwiftUI
+
+struct AppUpdateSettingsView: View {
+ @ObservedObject private var updater = UpdateService.shared
+ @AppStorage("settings.updates.installationMethod") private var installationMethod = "download"
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 14) {
+ HStack(spacing: 12) {
+ VStack(alignment: .leading, spacing: 4) {
+ Text("Keep PureMac up to date")
+ .font(.system(size: 13, weight: .semibold))
+ Text("Checks the official app releases on GitHub.")
+ .font(.caption)
+ .foregroundStyle(.secondary)
+ }
+ Spacer()
+ if updater.isChecking { ProgressView().controlSize(.small) }
+ Button("Check for Updates") { updater.checkForUpdates() }
+ .disabled(updater.isChecking)
+ .accessibilityIdentifier("settings.checkForUpdates")
+ }
+
+ status
+
+ if let checked = updater.lastChecked {
+ Text(String(format: String(localized: "Last checked: %@"), checked.formatted(date: .abbreviated, time: .shortened)))
+ .font(.caption)
+ .foregroundStyle(.secondary)
+ }
+
+ Divider()
+ Picker("Update method", selection: $installationMethod) {
+ Text("Download (DMG / ZIP)").tag("download")
+ Text("Homebrew").tag("homebrew")
+ }
+ if installationMethod == "homebrew" {
+ Text("To update with Homebrew, run this command in Terminal. The cask may follow the GitHub release a little later.")
+ .font(.caption)
+ .foregroundStyle(.secondary)
+ HStack {
+ Text("brew update && brew upgrade --cask puremac")
+ .font(.system(size: 11, design: .monospaced))
+ .textSelection(.enabled)
+ Spacer()
+ Button("Copy command") {
+ NSPasteboard.general.clearContents()
+ NSPasteboard.general.setString("brew update && brew upgrade --cask puremac", forType: .string)
+ }
+ }
+ } else {
+ Text("Download the new app from the release page, quit PureMac, then replace it in Applications.")
+ .font(.caption)
+ .foregroundStyle(.secondary)
+ }
+ Link("View releases", destination: UpdateService.releasesURL)
+ }
+ .padding(.vertical, 4)
+ }
+
+ @ViewBuilder
+ private var status: some View {
+ switch updater.state {
+ case .idle:
+ EmptyView()
+ case .checking:
+ Label("Checking for updates…", systemImage: "arrow.triangle.2.circlepath")
+ .foregroundStyle(.secondary)
+ case .available(let release):
+ VStack(alignment: .leading, spacing: 8) {
+ Label(String(format: String(localized: "PureMac %@ is available"), release.tagName), systemImage: "arrow.down.circle.fill")
+ .foregroundStyle(Tint.accent)
+ Link("Open release page", destination: release.htmlURL)
+ }
+ case .upToDate:
+ Label("You're using the latest available version of PureMac.", systemImage: "checkmark.circle.fill")
+ .foregroundStyle(Tint.green)
+ case .failed(let message):
+ VStack(alignment: .leading, spacing: 4) {
+ Label("Couldn't check for updates", systemImage: "exclamationmark.triangle")
+ .foregroundStyle(Tint.orange)
+ Text(message)
+ .font(.caption)
+ .foregroundStyle(.secondary)
+ }
+ }
+ }
+}
diff --git a/PureMac/Views/Settings/SettingsView.swift b/PureMac/Views/Settings/SettingsView.swift
index 483daf6..1d156a9 100644
--- a/PureMac/Views/Settings/SettingsView.swift
+++ b/PureMac/Views/Settings/SettingsView.swift
@@ -14,7 +14,7 @@ struct SettingsView: View {
case general = "General"
case cleaning = "Cleaning"
case schedule = "Schedule"
- case about = "About"
+ case about = "Updates"
var id: String { rawValue }
var icon: String {
@@ -22,7 +22,7 @@ struct SettingsView: View {
case .general: return "slider.horizontal.3"
case .cleaning: return "trash"
case .schedule: return "clock"
- case .about: return "info.circle"
+ case .about: return "arrow.triangle.2.circlepath"
}
}
}
@@ -39,6 +39,14 @@ struct SettingsView: View {
.foregroundStyle(.secondary)
}
Spacer()
+ VStack(alignment: .trailing, spacing: 3) {
+ Text(String(format: String(localized: "Version %@"), UpdateService.installedVersion))
+ Text(String(format: String(localized: "Build %@"), UpdateService.installedBuild))
+ .foregroundStyle(.tertiary)
+ }
+ .font(.system(size: 11))
+ .foregroundStyle(.secondary)
+ .textSelection(.enabled)
}
.padding(.horizontal, 4)
@@ -68,12 +76,20 @@ struct SettingsView: View {
.background(AmbientBackdrop())
.tint(Tint.accent)
.navigationTitle("Settings")
+ .onAppear { showRequestedUpdates() }
+ .onChange(of: appState.showUpdateSettings) { _ in showRequestedUpdates() }
.sheet(isPresented: Binding(
get: { standalone && permission.isRequesting && permission.presentation == .settingsWindow },
set: { if !$0 && standalone && permission.presentation == .settingsWindow { permission.dismiss(callRetry: false) } }
)) { PermissionSheet() }
}
+ private func showRequestedUpdates() {
+ if !standalone && appState.showUpdateSettings {
+ selectedTab = .about
+ appState.showUpdateSettings = false
+ }
+ }
}
// MARK: - General
@@ -464,7 +480,7 @@ struct AboutSettingsView: View {
Text(
String(
format: String(localized: "Version %@"),
- Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "1.0"
+ UpdateService.installedVersion
)
)
.foregroundStyle(.secondary)
@@ -475,6 +491,10 @@ struct AboutSettingsView: View {
}
}
+ Section("Updates") {
+ AppUpdateSettingsView()
+ }
+
Section {
Link("GitHub Repository", destination: URL(string: "https://github.com/momenbasel/PureMac")!)
Link("Report an Issue", destination: URL(string: "https://github.com/momenbasel/PureMac/issues")!)
diff --git a/PureMac/ar.lproj/Localizable.strings b/PureMac/ar.lproj/Localizable.strings
index cca33b2..76a41cf 100644
--- a/PureMac/ar.lproj/Localizable.strings
+++ b/PureMac/ar.lproj/Localizable.strings
@@ -871,6 +871,26 @@
"tmutil is not available on this Mac." = "tmutil is not available on this Mac.";
/* Additional interface strings. */
+"Build %@" = "Build %@";
"Check access" = "Check access";
+"Checking for updates…" = "Checking for updates…";
+"Checks the official app releases on GitHub." = "Checks the official app releases on GitHub.";
+"Copy command" = "Copy command";
+"Download (DMG / ZIP)" = "Download (DMG / ZIP)";
+"Download the new app from the release page, quit PureMac, then replace it in Applications." = "Download the new app from the release page, quit PureMac, then replace it in Applications.";
+"GitHub is receiving too many requests. Please try again later." = "GitHub is receiving too many requests. Please try again later.";
+"Homebrew" = "Homebrew";
+"Keep PureMac up to date" = "Keep PureMac up to date";
+"Last checked: %@" = "Last checked: %@";
"Make PureMac work your way." = "Make PureMac work your way.";
+"No stable PureMac app release was found. Try again later." = "No stable PureMac app release was found. Try again later.";
+"Open release page" = "Open release page";
+"PureMac %@ is available" = "PureMac %@ is available";
"Settings" = "Settings";
+"The release service is unavailable. Please try again later." = "The release service is unavailable. Please try again later.";
+"This build has no readable version. Open the releases page to check manually." = "This build has no readable version. Open the releases page to check manually.";
+"To update with Homebrew, run this command in Terminal. The cask may follow the GitHub release a little later." = "To update with Homebrew, run this command in Terminal. The cask may follow the GitHub release a little later.";
+"Update method" = "Update method";
+
+"View releases" = "View releases";
+"You're using the latest available version of PureMac." = "You're using the latest available version of PureMac.";
diff --git a/PureMac/de.lproj/Localizable.strings b/PureMac/de.lproj/Localizable.strings
index 97a5576..3f59810 100644
--- a/PureMac/de.lproj/Localizable.strings
+++ b/PureMac/de.lproj/Localizable.strings
@@ -874,3 +874,24 @@
"Check access" = "Check access";
"Make PureMac work your way." = "Make PureMac work your way.";
"Settings" = "Settings";
+
+/* Release check (#170): English fallbacks */
+"Build %@" = "Build %@";
+"Checking for updates…" = "Checking for updates…";
+"Checks the official app releases on GitHub." = "Checks the official app releases on GitHub.";
+"Copy command" = "Copy command";
+"Download (DMG / ZIP)" = "Download (DMG / ZIP)";
+"Download the new app from the release page, quit PureMac, then replace it in Applications." = "Download the new app from the release page, quit PureMac, then replace it in Applications.";
+"GitHub is receiving too many requests. Please try again later." = "GitHub is receiving too many requests. Please try again later.";
+"Homebrew" = "Homebrew";
+"Keep PureMac up to date" = "Keep PureMac up to date";
+"Last checked: %@" = "Last checked: %@";
+"No stable PureMac app release was found. Try again later." = "No stable PureMac app release was found. Try again later.";
+"Open release page" = "Open release page";
+"PureMac %@ is available" = "PureMac %@ is available";
+"The release service is unavailable. Please try again later." = "The release service is unavailable. Please try again later.";
+"This build has no readable version. Open the releases page to check manually." = "This build has no readable version. Open the releases page to check manually.";
+"To update with Homebrew, run this command in Terminal. The cask may follow the GitHub release a little later." = "To update with Homebrew, run this command in Terminal. The cask may follow the GitHub release a little later.";
+"Update method" = "Update method";
+"View releases" = "View releases";
+"You're using the latest available version of PureMac." = "You're using the latest available version of PureMac.";
diff --git a/PureMac/en.lproj/Localizable.strings b/PureMac/en.lproj/Localizable.strings
index bac61de..7905c88 100644
--- a/PureMac/en.lproj/Localizable.strings
+++ b/PureMac/en.lproj/Localizable.strings
@@ -871,6 +871,26 @@
"tmutil is not available on this Mac." = "tmutil is not available on this Mac.";
/* Additional interface strings. */
+"Build %@" = "Build %@";
"Check access" = "Check access";
+"Checking for updates…" = "Checking for updates…";
+"Checks the official app releases on GitHub." = "Checks the official app releases on GitHub.";
+"Copy command" = "Copy command";
+"Download (DMG / ZIP)" = "Download (DMG / ZIP)";
+"Download the new app from the release page, quit PureMac, then replace it in Applications." = "Download the new app from the release page, quit PureMac, then replace it in Applications.";
+"GitHub is receiving too many requests. Please try again later." = "GitHub is receiving too many requests. Please try again later.";
+"Homebrew" = "Homebrew";
+"Keep PureMac up to date" = "Keep PureMac up to date";
+"Last checked: %@" = "Last checked: %@";
"Make PureMac work your way." = "Make PureMac work your way.";
+"No stable PureMac app release was found. Try again later." = "No stable PureMac app release was found. Try again later.";
+"Open release page" = "Open release page";
+"PureMac %@ is available" = "PureMac %@ is available";
"Settings" = "Settings";
+"The release service is unavailable. Please try again later." = "The release service is unavailable. Please try again later.";
+"This build has no readable version. Open the releases page to check manually." = "This build has no readable version. Open the releases page to check manually.";
+"To update with Homebrew, run this command in Terminal. The cask may follow the GitHub release a little later." = "To update with Homebrew, run this command in Terminal. The cask may follow the GitHub release a little later.";
+"Update method" = "Update method";
+
+"View releases" = "View releases";
+"You're using the latest available version of PureMac." = "You're using the latest available version of PureMac.";
diff --git a/PureMac/es.lproj/Localizable.strings b/PureMac/es.lproj/Localizable.strings
index 4c316c9..a4dd85a 100644
--- a/PureMac/es.lproj/Localizable.strings
+++ b/PureMac/es.lproj/Localizable.strings
@@ -871,6 +871,26 @@
"tmutil is not available on this Mac." = "tmutil is not available on this Mac.";
/* Additional interface strings. */
+"Build %@" = "Build %@";
"Check access" = "Check access";
+"Checking for updates…" = "Checking for updates…";
+"Checks the official app releases on GitHub." = "Checks the official app releases on GitHub.";
+"Copy command" = "Copy command";
+"Download (DMG / ZIP)" = "Download (DMG / ZIP)";
+"Download the new app from the release page, quit PureMac, then replace it in Applications." = "Download the new app from the release page, quit PureMac, then replace it in Applications.";
+"GitHub is receiving too many requests. Please try again later." = "GitHub is receiving too many requests. Please try again later.";
+"Homebrew" = "Homebrew";
+"Keep PureMac up to date" = "Keep PureMac up to date";
+"Last checked: %@" = "Last checked: %@";
"Make PureMac work your way." = "Make PureMac work your way.";
+"No stable PureMac app release was found. Try again later." = "No stable PureMac app release was found. Try again later.";
+"Open release page" = "Open release page";
+"PureMac %@ is available" = "PureMac %@ is available";
"Settings" = "Settings";
+"The release service is unavailable. Please try again later." = "The release service is unavailable. Please try again later.";
+"This build has no readable version. Open the releases page to check manually." = "This build has no readable version. Open the releases page to check manually.";
+"To update with Homebrew, run this command in Terminal. The cask may follow the GitHub release a little later." = "To update with Homebrew, run this command in Terminal. The cask may follow the GitHub release a little later.";
+"Update method" = "Update method";
+
+"View releases" = "View releases";
+"You're using the latest available version of PureMac." = "You're using the latest available version of PureMac.";
diff --git a/PureMac/fr.lproj/Localizable.strings b/PureMac/fr.lproj/Localizable.strings
index 9c2ff72..76a0498 100644
--- a/PureMac/fr.lproj/Localizable.strings
+++ b/PureMac/fr.lproj/Localizable.strings
@@ -867,6 +867,26 @@
"tmutil is not available on this Mac." = "tmutil is not available on this Mac.";
/* Additional interface strings. */
+"Build %@" = "Build %@";
"Check access" = "Check access";
+"Checking for updates…" = "Checking for updates…";
+"Checks the official app releases on GitHub." = "Checks the official app releases on GitHub.";
+"Copy command" = "Copy command";
+"Download (DMG / ZIP)" = "Download (DMG / ZIP)";
+"Download the new app from the release page, quit PureMac, then replace it in Applications." = "Download the new app from the release page, quit PureMac, then replace it in Applications.";
+"GitHub is receiving too many requests. Please try again later." = "GitHub is receiving too many requests. Please try again later.";
+"Homebrew" = "Homebrew";
+"Keep PureMac up to date" = "Keep PureMac up to date";
+"Last checked: %@" = "Last checked: %@";
"Make PureMac work your way." = "Make PureMac work your way.";
+"No stable PureMac app release was found. Try again later." = "No stable PureMac app release was found. Try again later.";
+"Open release page" = "Open release page";
+"PureMac %@ is available" = "PureMac %@ is available";
"Settings" = "Settings";
+"The release service is unavailable. Please try again later." = "The release service is unavailable. Please try again later.";
+"This build has no readable version. Open the releases page to check manually." = "This build has no readable version. Open the releases page to check manually.";
+"To update with Homebrew, run this command in Terminal. The cask may follow the GitHub release a little later." = "To update with Homebrew, run this command in Terminal. The cask may follow the GitHub release a little later.";
+"Update method" = "Update method";
+
+"View releases" = "View releases";
+"You're using the latest available version of PureMac." = "You're using the latest available version of PureMac.";
diff --git a/PureMac/ja.lproj/Localizable.strings b/PureMac/ja.lproj/Localizable.strings
index 7c63964..7ba80f0 100644
--- a/PureMac/ja.lproj/Localizable.strings
+++ b/PureMac/ja.lproj/Localizable.strings
@@ -871,6 +871,26 @@
"tmutil is not available on this Mac." = "tmutil is not available on this Mac.";
/* Additional interface strings. */
+"Build %@" = "Build %@";
"Check access" = "Check access";
+"Checking for updates…" = "Checking for updates…";
+"Checks the official app releases on GitHub." = "Checks the official app releases on GitHub.";
+"Copy command" = "Copy command";
+"Download (DMG / ZIP)" = "Download (DMG / ZIP)";
+"Download the new app from the release page, quit PureMac, then replace it in Applications." = "Download the new app from the release page, quit PureMac, then replace it in Applications.";
+"GitHub is receiving too many requests. Please try again later." = "GitHub is receiving too many requests. Please try again later.";
+"Homebrew" = "Homebrew";
+"Keep PureMac up to date" = "Keep PureMac up to date";
+"Last checked: %@" = "Last checked: %@";
"Make PureMac work your way." = "Make PureMac work your way.";
+"No stable PureMac app release was found. Try again later." = "No stable PureMac app release was found. Try again later.";
+"Open release page" = "Open release page";
+"PureMac %@ is available" = "PureMac %@ is available";
"Settings" = "Settings";
+"The release service is unavailable. Please try again later." = "The release service is unavailable. Please try again later.";
+"This build has no readable version. Open the releases page to check manually." = "This build has no readable version. Open the releases page to check manually.";
+"To update with Homebrew, run this command in Terminal. The cask may follow the GitHub release a little later." = "To update with Homebrew, run this command in Terminal. The cask may follow the GitHub release a little later.";
+"Update method" = "Update method";
+
+"View releases" = "View releases";
+"You're using the latest available version of PureMac." = "You're using the latest available version of PureMac.";
diff --git a/PureMac/pl.lproj/Localizable.strings b/PureMac/pl.lproj/Localizable.strings
index c652b80..9fa43a0 100644
--- a/PureMac/pl.lproj/Localizable.strings
+++ b/PureMac/pl.lproj/Localizable.strings
@@ -871,6 +871,26 @@
"tmutil is not available on this Mac." = "tmutil is not available on this Mac.";
/* Additional interface strings. */
+"Build %@" = "Build %@";
"Check access" = "Check access";
+"Checking for updates…" = "Checking for updates…";
+"Checks the official app releases on GitHub." = "Checks the official app releases on GitHub.";
+"Copy command" = "Copy command";
+"Download (DMG / ZIP)" = "Download (DMG / ZIP)";
+"Download the new app from the release page, quit PureMac, then replace it in Applications." = "Download the new app from the release page, quit PureMac, then replace it in Applications.";
+"GitHub is receiving too many requests. Please try again later." = "GitHub is receiving too many requests. Please try again later.";
+"Homebrew" = "Homebrew";
+"Keep PureMac up to date" = "Keep PureMac up to date";
+"Last checked: %@" = "Last checked: %@";
"Make PureMac work your way." = "Make PureMac work your way.";
+"No stable PureMac app release was found. Try again later." = "No stable PureMac app release was found. Try again later.";
+"Open release page" = "Open release page";
+"PureMac %@ is available" = "PureMac %@ is available";
"Settings" = "Settings";
+"The release service is unavailable. Please try again later." = "The release service is unavailable. Please try again later.";
+"This build has no readable version. Open the releases page to check manually." = "This build has no readable version. Open the releases page to check manually.";
+"To update with Homebrew, run this command in Terminal. The cask may follow the GitHub release a little later." = "To update with Homebrew, run this command in Terminal. The cask may follow the GitHub release a little later.";
+"Update method" = "Update method";
+
+"View releases" = "View releases";
+"You're using the latest available version of PureMac." = "You're using the latest available version of PureMac.";
diff --git a/PureMac/pt-BR.lproj/Localizable.strings b/PureMac/pt-BR.lproj/Localizable.strings
index 1066f43..1844c1b 100644
--- a/PureMac/pt-BR.lproj/Localizable.strings
+++ b/PureMac/pt-BR.lproj/Localizable.strings
@@ -871,6 +871,26 @@
"tmutil is not available on this Mac." = "tmutil is not available on this Mac.";
/* Additional interface strings. */
+"Build %@" = "Build %@";
"Check access" = "Check access";
+"Checking for updates…" = "Checking for updates…";
+"Checks the official app releases on GitHub." = "Checks the official app releases on GitHub.";
+"Copy command" = "Copy command";
+"Download (DMG / ZIP)" = "Download (DMG / ZIP)";
+"Download the new app from the release page, quit PureMac, then replace it in Applications." = "Download the new app from the release page, quit PureMac, then replace it in Applications.";
+"GitHub is receiving too many requests. Please try again later." = "GitHub is receiving too many requests. Please try again later.";
+"Homebrew" = "Homebrew";
+"Keep PureMac up to date" = "Keep PureMac up to date";
+"Last checked: %@" = "Last checked: %@";
"Make PureMac work your way." = "Make PureMac work your way.";
+"No stable PureMac app release was found. Try again later." = "No stable PureMac app release was found. Try again later.";
+"Open release page" = "Open release page";
+"PureMac %@ is available" = "PureMac %@ is available";
"Settings" = "Settings";
+"The release service is unavailable. Please try again later." = "The release service is unavailable. Please try again later.";
+"This build has no readable version. Open the releases page to check manually." = "This build has no readable version. Open the releases page to check manually.";
+"To update with Homebrew, run this command in Terminal. The cask may follow the GitHub release a little later." = "To update with Homebrew, run this command in Terminal. The cask may follow the GitHub release a little later.";
+"Update method" = "Update method";
+
+"View releases" = "View releases";
+"You're using the latest available version of PureMac." = "You're using the latest available version of PureMac.";
diff --git a/PureMac/ru.lproj/Localizable.strings b/PureMac/ru.lproj/Localizable.strings
index f1a2061..a7084eb 100644
--- a/PureMac/ru.lproj/Localizable.strings
+++ b/PureMac/ru.lproj/Localizable.strings
@@ -871,6 +871,26 @@
"tmutil is not available on this Mac." = "tmutil is not available on this Mac.";
/* Additional interface strings. */
+"Build %@" = "Build %@";
"Check access" = "Check access";
+"Checking for updates…" = "Checking for updates…";
+"Checks the official app releases on GitHub." = "Checks the official app releases on GitHub.";
+"Copy command" = "Copy command";
+"Download (DMG / ZIP)" = "Download (DMG / ZIP)";
+"Download the new app from the release page, quit PureMac, then replace it in Applications." = "Download the new app from the release page, quit PureMac, then replace it in Applications.";
+"GitHub is receiving too many requests. Please try again later." = "GitHub is receiving too many requests. Please try again later.";
+"Homebrew" = "Homebrew";
+"Keep PureMac up to date" = "Keep PureMac up to date";
+"Last checked: %@" = "Last checked: %@";
"Make PureMac work your way." = "Make PureMac work your way.";
+"No stable PureMac app release was found. Try again later." = "No stable PureMac app release was found. Try again later.";
+"Open release page" = "Open release page";
+"PureMac %@ is available" = "PureMac %@ is available";
"Settings" = "Settings";
+"The release service is unavailable. Please try again later." = "The release service is unavailable. Please try again later.";
+"This build has no readable version. Open the releases page to check manually." = "This build has no readable version. Open the releases page to check manually.";
+"To update with Homebrew, run this command in Terminal. The cask may follow the GitHub release a little later." = "To update with Homebrew, run this command in Terminal. The cask may follow the GitHub release a little later.";
+"Update method" = "Update method";
+
+"View releases" = "View releases";
+"You're using the latest available version of PureMac." = "You're using the latest available version of PureMac.";
diff --git a/PureMac/uk.lproj/Localizable.strings b/PureMac/uk.lproj/Localizable.strings
index ac39ca8..8ce4be1 100644
--- a/PureMac/uk.lproj/Localizable.strings
+++ b/PureMac/uk.lproj/Localizable.strings
@@ -871,6 +871,26 @@
"tmutil is not available on this Mac." = "tmutil is not available on this Mac.";
/* Additional interface strings. */
+"Build %@" = "Build %@";
"Check access" = "Check access";
+"Checking for updates…" = "Checking for updates…";
+"Checks the official app releases on GitHub." = "Checks the official app releases on GitHub.";
+"Copy command" = "Copy command";
+"Download (DMG / ZIP)" = "Download (DMG / ZIP)";
+"Download the new app from the release page, quit PureMac, then replace it in Applications." = "Download the new app from the release page, quit PureMac, then replace it in Applications.";
+"GitHub is receiving too many requests. Please try again later." = "GitHub is receiving too many requests. Please try again later.";
+"Homebrew" = "Homebrew";
+"Keep PureMac up to date" = "Keep PureMac up to date";
+"Last checked: %@" = "Last checked: %@";
"Make PureMac work your way." = "Make PureMac work your way.";
+"No stable PureMac app release was found. Try again later." = "No stable PureMac app release was found. Try again later.";
+"Open release page" = "Open release page";
+"PureMac %@ is available" = "PureMac %@ is available";
"Settings" = "Settings";
+"The release service is unavailable. Please try again later." = "The release service is unavailable. Please try again later.";
+"This build has no readable version. Open the releases page to check manually." = "This build has no readable version. Open the releases page to check manually.";
+"To update with Homebrew, run this command in Terminal. The cask may follow the GitHub release a little later." = "To update with Homebrew, run this command in Terminal. The cask may follow the GitHub release a little later.";
+"Update method" = "Update method";
+
+"View releases" = "View releases";
+"You're using the latest available version of PureMac." = "You're using the latest available version of PureMac.";
diff --git a/PureMac/zh-Hans.lproj/Localizable.strings b/PureMac/zh-Hans.lproj/Localizable.strings
index 469888a..d67d79c 100644
--- a/PureMac/zh-Hans.lproj/Localizable.strings
+++ b/PureMac/zh-Hans.lproj/Localizable.strings
@@ -871,6 +871,26 @@
"tmutil is not available on this Mac." = "此 Mac 上无法使用 tmutil。";
/* Additional interface strings. */
+"Build %@" = "Build %@";
"Check access" = "Check access";
+"Checking for updates…" = "Checking for updates…";
+"Checks the official app releases on GitHub." = "Checks the official app releases on GitHub.";
+"Copy command" = "Copy command";
+"Download (DMG / ZIP)" = "Download (DMG / ZIP)";
+"Download the new app from the release page, quit PureMac, then replace it in Applications." = "Download the new app from the release page, quit PureMac, then replace it in Applications.";
+"GitHub is receiving too many requests. Please try again later." = "GitHub is receiving too many requests. Please try again later.";
+"Homebrew" = "Homebrew";
+"Keep PureMac up to date" = "Keep PureMac up to date";
+"Last checked: %@" = "Last checked: %@";
"Make PureMac work your way." = "Make PureMac work your way.";
+"No stable PureMac app release was found. Try again later." = "No stable PureMac app release was found. Try again later.";
+"Open release page" = "Open release page";
+"PureMac %@ is available" = "PureMac %@ is available";
"Settings" = "Settings";
+"The release service is unavailable. Please try again later." = "The release service is unavailable. Please try again later.";
+"This build has no readable version. Open the releases page to check manually." = "This build has no readable version. Open the releases page to check manually.";
+"To update with Homebrew, run this command in Terminal. The cask may follow the GitHub release a little later." = "To update with Homebrew, run this command in Terminal. The cask may follow the GitHub release a little later.";
+"Update method" = "Update method";
+
+"View releases" = "View releases";
+"You're using the latest available version of PureMac." = "You're using the latest available version of PureMac.";
diff --git a/PureMac/zh-Hant.lproj/Localizable.strings b/PureMac/zh-Hant.lproj/Localizable.strings
index 1661864..b64e9b7 100644
--- a/PureMac/zh-Hant.lproj/Localizable.strings
+++ b/PureMac/zh-Hant.lproj/Localizable.strings
@@ -871,6 +871,26 @@
"tmutil is not available on this Mac." = "tmutil is not available on this Mac.";
/* Additional interface strings. */
+"Build %@" = "Build %@";
"Check access" = "Check access";
+"Checking for updates…" = "Checking for updates…";
+"Checks the official app releases on GitHub." = "Checks the official app releases on GitHub.";
+"Copy command" = "Copy command";
+"Download (DMG / ZIP)" = "Download (DMG / ZIP)";
+"Download the new app from the release page, quit PureMac, then replace it in Applications." = "Download the new app from the release page, quit PureMac, then replace it in Applications.";
+"GitHub is receiving too many requests. Please try again later." = "GitHub is receiving too many requests. Please try again later.";
+"Homebrew" = "Homebrew";
+"Keep PureMac up to date" = "Keep PureMac up to date";
+"Last checked: %@" = "Last checked: %@";
"Make PureMac work your way." = "Make PureMac work your way.";
+"No stable PureMac app release was found. Try again later." = "No stable PureMac app release was found. Try again later.";
+"Open release page" = "Open release page";
+"PureMac %@ is available" = "PureMac %@ is available";
"Settings" = "Settings";
+"The release service is unavailable. Please try again later." = "The release service is unavailable. Please try again later.";
+"This build has no readable version. Open the releases page to check manually." = "This build has no readable version. Open the releases page to check manually.";
+"To update with Homebrew, run this command in Terminal. The cask may follow the GitHub release a little later." = "To update with Homebrew, run this command in Terminal. The cask may follow the GitHub release a little later.";
+"Update method" = "Update method";
+
+"View releases" = "View releases";
+"You're using the latest available version of PureMac." = "You're using the latest available version of PureMac.";
diff --git a/PureMacTests/UpdateServiceTests.swift b/PureMacTests/UpdateServiceTests.swift
new file mode 100644
index 0000000..43afad2
--- /dev/null
+++ b/PureMacTests/UpdateServiceTests.swift
@@ -0,0 +1,65 @@
+import XCTest
+@testable import PureMac
+
+final class UpdateServiceTests: XCTestCase {
+ func testVersionComparisonIsNumericAndStableBeatsPrerelease() throws {
+ XCTAssertTrue(try XCTUnwrap(AppReleaseVersion("v3.10.0")) > XCTUnwrap(AppReleaseVersion("3.9.9")))
+ XCTAssertEqual(AppReleaseVersion("3.0"), AppReleaseVersion("3.0.0"))
+ XCTAssertTrue(try XCTUnwrap(AppReleaseVersion("3.0.0")) > XCTUnwrap(AppReleaseVersion("3.0.0-beta.1")))
+ for invalid in ["cli-v9.0.0", "latest", "3..0", "-1.2.3", "3.2x", ""] {
+ XCTAssertNil(AppReleaseVersion(invalid), invalid)
+ }
+ }
+
+ func testSelectsNewestStableAppReleaseAndRejectsCLIAndUntrustedLinks() throws {
+ let data = Data("""
+ [
+ {"tag_name":"cli-v99.0.0","html_url":"https://github.com/momenbasel/PureMac/releases/tag/cli-v99.0.0","draft":false,"prerelease":false,"assets":[{"name":"puremac-cli.zip"}]},
+ {"tag_name":"v4.0.0","html_url":"https://github.com/momenbasel/PureMac/releases/tag/v4.0.0","draft":false,"prerelease":true,"assets":[{"name":"PureMac-4.0.0.zip"}]},
+ {"tag_name":"v3.10.0","html_url":"https://github.com/momenbasel/PureMac/releases/tag/v3.10.0","draft":false,"prerelease":false,"assets":[{"name":"PureMac-3.10.0.zip"}]},
+ {"tag_name":"v3.9.0","html_url":"https://github.com/momenbasel/PureMac/releases/tag/v3.9.0","draft":false,"prerelease":false,"assets":[{"name":"PureMac-3.9.0.dmg"}]},
+ {"tag_name":"v99.0.0","html_url":"https://example.com/malware","draft":false,"prerelease":false,"assets":[{"name":"PureMac-99.0.0.zip"}]}
+ ]
+ """.utf8)
+ XCTAssertEqual(try UpdateService.latestAppRelease(in: data).tagName, "v3.10.0")
+ XCTAssertThrowsError(try UpdateService.latestAppRelease(in: Data("[]".utf8)))
+ XCTAssertThrowsError(try UpdateService.latestAppRelease(in: Data("invalid".utf8)))
+ }
+
+ @MainActor
+ func testNetworkFailureNeverReportsUpToDateAndCanRetry() async {
+ let service = UpdateService(currentVersion: "3.0.0") { _ in
+ throw URLError(.notConnectedToInternet)
+ }
+ await service.check()
+ guard case .failed = service.state else { return XCTFail("Expected failure") }
+ XCTAssertFalse(service.isChecking)
+ await service.check()
+ guard case .failed = service.state else { return XCTFail("Expected retry to finish") }
+ }
+
+ @MainActor
+ func testHTTPErrorAndAvailableAndCurrentVersions() async {
+ for (installed, expectedAvailable) in [("2.9.0", true), ("3.0.0", false), ("3.1.0", false)] {
+ let service = UpdateService(currentVersion: installed) { request in
+ XCTAssertEqual(request.url?.host, "api.github.com")
+ let data = Data("""
+ [{"tag_name":"v3.0.0","html_url":"https://github.com/momenbasel/PureMac/releases/tag/v3.0.0","draft":false,"prerelease":false,"assets":[{"name":"PureMac-3.0.0.zip"}]}]
+ """.utf8)
+ return (data, HTTPURLResponse(url: request.url!, statusCode: 200, httpVersion: nil, headerFields: nil)!)
+ }
+ await service.check()
+ if expectedAvailable {
+ guard case .available = service.state else { return XCTFail("Expected available") }
+ } else {
+ guard case .upToDate = service.state else { return XCTFail("Expected current") }
+ }
+ XCTAssertNotNil(service.lastChecked)
+ }
+ let limited = UpdateService(currentVersion: "3.0.0") { request in
+ (Data(), HTTPURLResponse(url: request.url!, statusCode: 403, httpVersion: nil, headerFields: nil)!)
+ }
+ await limited.check()
+ guard case .failed = limited.state else { return XCTFail("Expected rate limit failure") }
+ }
+}
diff --git a/README.md b/README.md
index e51bea8..4125a73 100644
--- a/README.md
+++ b/README.md
@@ -177,6 +177,8 @@ Optional. Configurable interval (hourly to monthly), with auto-clean threshold s
Open **Settings** using the gear in the sidebar or the standard macOS Settings command. General settings include language, System/Light/Dark appearance, Full Disk Access status and recheck, startup, menu-bar monitoring, sound and safety. Cleaning and scheduled scanning keep their existing preferences.
+The **Updates** tab shows the installed version and build and checks official GitHub app releases on request. CLI releases, drafts and prereleases are excluded. Choose the update method for Homebrew instructions or a DMG/ZIP download link. The check reports availability; it does not install an update or run Homebrew.
+
## Permissions
PureMac needs **Full Disk Access** to read the locations macOS hides from every app by default - Mail downloads, Safari data, the TCC database, protected app containers. Without it, some cleanup categories and app-container scans will be incomplete. The locations available depend on your macOS version and permissions.