Free, open-source macOS cleaner. CleanMyMac alternative with zero telemetry. Native SwiftUI, scheduled auto-cleaning, Xcode/Homebrew/system cache cleanup. MIT licensed.
Swift cache-cleanercleanmymaccleanupdisk-cleanerdisk-spacehomebrewmac-utilitymacosmacos-appmacos-cleanermacosxnativeossosxprivacyswiftswiftuisystem-cleanerxcode-cleaner
feat(updater): add Sparkle Stage 1 - opt-in UpdateService and menu (#99)
Emmanuel Gialitakisb2714a9545ef
diff --git a/PureMac.xcodeproj/project.pbxproj b/PureMac.xcodeproj/project.pbxprojindex 782303b..56b0449 100644--- a/PureMac.xcodeproj/project.pbxproj+++ b/PureMac.xcodeproj/project.pbxproj@@ -12,9 +12,11 @@2253F11BDF561B617439C96B /* FullDiskAccessManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = E866A1541D289C69144A5E62 /* FullDiskAccessManager.swift */; };27F449EDD1B082FE11FEC9DF /* SchedulerService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28181F034530331A550C6A3D /* SchedulerService.swift */; };340E424F759ACCDE7372F99F /* Theme.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5ADDC35F31E40780FB5D017 /* Theme.swift */; };+ 41B27CACD7C6C7471EFD03F9 /* UpdateService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 022D0EAEE2B6E54069FC2CBE /* UpdateService.swift */; };47C5ECD49C4DD75F271DB6CE /* StringNormalization.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D3AC5F17D7CA94FAB1E8D7A /* StringNormalization.swift */; };48D1431A7C99C19EEBDB056B /* CleaningEngine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A8DE5D45BA19E2670B57DC5 /* CleaningEngine.swift */; };4F754D89F4CE5142BE384062 /* AppConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = F31F91226CDCFBB8E303B7DA /* AppConstants.swift */; };+ 50304378D99F2E9E48B642AF /* Sparkle in Frameworks */ = {isa = PBXBuildFile; productRef = 9CC8F66E27BE52A6639E904B /* Sparkle */; };535B23C0108C06475215B8E8 /* AppTheme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AB003A7751F05727DBFD1A5 /* AppTheme.swift */; };59B3096E2AE8ED0397B16798 /* AppLanguagePreferencesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 491771F923C93FD61A263893 /* AppLanguagePreferencesTests.swift */; };75B5F0401D37F2872B1AD85A /* AppListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60E6BC61614B27C065BB18C9 /* AppListView.swift */; };@@ -56,6 +58,7 @@/* Begin PBXFileReference section */01B2C5F66B6D812572BD4F05 /* CLI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CLI.swift; sourceTree = "<group>"; };+ 022D0EAEE2B6E54069FC2CBE /* UpdateService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdateService.swift; sourceTree = "<group>"; };02E502E2B5C6AECC76E5CFEF /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Localizable.strings"; sourceTree = "<group>"; };10B0AF194677EAC1D5568785 /* CategoryDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CategoryDetailView.swift; sourceTree = "<group>"; };155CE1B8CDCCCA6F9FD028C1 /* LocalizationFilesTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalizationFilesTests.swift; sourceTree = "<group>"; };@@ -102,6 +105,17 @@F661A0F64CF93E482CB1728F /* DashboardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DashboardView.swift; sourceTree = "<group>"; };/* End PBXFileReference section */+/* Begin PBXFrameworksBuildPhase section */+ F8C2F3E176B50B537CC3381D /* Frameworks */ = {+ isa = PBXFrameworksBuildPhase;+ buildActionMask = 2147483647;+ files = (+ 50304378D99F2E9E48B642AF /* Sparkle in Frameworks */,+ );+ runOnlyForDeploymentPostprocessing = 0;+ };+/* End PBXFrameworksBuildPhase section */+/* Begin PBXGroup section */13CF0676D0E93925F46C13AA = {isa = PBXGroup;@@ -163,6 +177,7 @@E866A1541D289C69144A5E62 /* FullDiskAccessManager.swift */,A711CDF5285F68775D9B5513 /* ScanEngine.swift */,28181F034530331A550C6A3D /* SchedulerService.swift */,+ 022D0EAEE2B6E54069FC2CBE /* UpdateService.swift */,);path = Services;sourceTree = "<group>";@@ -285,6 +300,7 @@buildPhases = (63C589367B714FC06B0519E5 /* Sources */,3975A867E04014FA565E9F46 /* Resources */,+ F8C2F3E176B50B537CC3381D /* Frameworks */,);buildRules = ();@@ -292,6 +308,7 @@);name = PureMac;packageProductDependencies = (+ 9CC8F66E27BE52A6639E904B /* Sparkle */,);productName = PureMac;productReference = 311078221878708524283765 /* PureMac.app */;@@ -349,6 +366,9 @@);mainGroup = 13CF0676D0E93925F46C13AA;minimizedProjectReferenceProxies = 1;+ packageReferences = (+ 0AEFFB8005A58EEF008401F1 /* XCRemoteSwiftPackageReference "Sparkle" */,+ );preferredProjectObjectVersion = 77;productRefGroup = 4562CA9E5625FA4EEEFECB6D /* Products */;projectDirPath = "";@@ -407,6 +427,7 @@93743B036059418560D876E6 /* SettingsView.swift in Sources */,47C5ECD49C4DD75F271DB6CE /* StringNormalization.swift in Sources */,340E424F759ACCDE7372F99F /* Theme.swift in Sources */,+ 41B27CACD7C6C7471EFD03F9 /* UpdateService.swift in Sources */,);runOnlyForDeploymentPostprocessing = 0;};@@ -685,6 +706,25 @@defaultConfigurationName = Release;};/* End XCConfigurationList section */++/* Begin XCRemoteSwiftPackageReference section */+ 0AEFFB8005A58EEF008401F1 /* XCRemoteSwiftPackageReference "Sparkle" */ = {+ isa = XCRemoteSwiftPackageReference;+ repositoryURL = "https://github.com/sparkle-project/Sparkle";+ requirement = {+ kind = upToNextMajorVersion;+ minimumVersion = 2.0.0;+ };+ };+/* End XCRemoteSwiftPackageReference section */++/* Begin XCSwiftPackageProductDependency section */+ 9CC8F66E27BE52A6639E904B /* Sparkle */ = {+ isa = XCSwiftPackageProductDependency;+ package = 0AEFFB8005A58EEF008401F1 /* XCRemoteSwiftPackageReference "Sparkle" */;+ productName = Sparkle;+ };+/* End XCSwiftPackageProductDependency section */};rootObject = 37BE87544E2EC9F6FF1CD280 /* Project object */;}diff --git a/PureMac/PureMacApp.swift b/PureMac/PureMacApp.swiftindex a175ed8..7faa6a1 100644--- a/PureMac/PureMacApp.swift+++ b/PureMac/PureMacApp.swift@@ -49,6 +49,12 @@ struct PureMacApp: App {.defaultSize(width: 1000, height: 680).commands {CommandGroup(replacing: .newItem) {}+ CommandMenu("Updates") {+ Button("Check for Updates") {+ UpdateService.shared.checkForUpdates()+ }+ .keyboardShortcut("u", modifiers: [.command, .shift])+ }}Settings {diff --git a/PureMac/Services/UpdateService.swift b/PureMac/Services/UpdateService.swiftnew file mode 100644index 0000000..a46db1a--- /dev/null+++ b/PureMac/Services/UpdateService.swift@@ -0,0 +1,43 @@+import Foundation+import AppKit++#if canImport(Sparkle)+import Sparkle+#endif++final class UpdateService: ObservableObject {+ static let shared = UpdateService()++ #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+ }++ 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)+ }+ }+ }+ #else+ // Fallback: open Releases page+ if let url = URL(string: "https://github.com/momenbasel/PureMac/releases/latest") {+ NSWorkspace.shared.open(url)+ }+ #endif+ }+}diff --git a/project.yml b/project.ymlindex 44520b3..6fb2fed 100644--- a/project.yml+++ b/project.yml@@ -1,4 +1,8 @@name: PureMac+packages:+ Sparkle:+ url: https://github.com/sparkle-project/Sparkle+ from: 2.0.0options:bundleIdPrefix: com.puremacdeploymentTarget:@@ -31,6 +35,9 @@ targets:platform: macOSsources:- PureMac+ dependencies:+ - package: Sparkle+ product: Sparklesettings:base:PRODUCT_NAME: PureMac