Skip to content

Commit 490808d

Browse files
Prot10claude
andcommitted
release: v0.1.5
Fixed automatic update check on app launch Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 6ef935f commit 490808d

File tree

4 files changed

+78
-23
lines changed

4 files changed

+78
-23
lines changed

MyMacCleaner.xcodeproj/project.pbxproj

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@
419419
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
420420
CODE_SIGN_STYLE = Manual;
421421
COMBINE_HIDPI_IMAGES = YES;
422-
CURRENT_PROJECT_VERSION = 5;
422+
CURRENT_PROJECT_VERSION = 6;
423423
DEVELOPMENT_TEAM = "";
424424
"DEVELOPMENT_TEAM[sdk=macosx*]" = 7K4SKUHU47;
425425
ENABLE_HARDENED_RUNTIME = YES;
@@ -439,7 +439,7 @@
439439
"$(inherited)",
440440
"@executable_path/../Frameworks",
441441
);
442-
MARKETING_VERSION = 0.1.4;
442+
MARKETING_VERSION = 0.1.5;
443443
PRODUCT_BUNDLE_IDENTIFIER = com.mymaccleaner.MyMacCleaner;
444444
PRODUCT_NAME = "$(TARGET_NAME)";
445445
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -465,7 +465,7 @@
465465
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Developer ID Application";
466466
CODE_SIGN_STYLE = Manual;
467467
COMBINE_HIDPI_IMAGES = YES;
468-
CURRENT_PROJECT_VERSION = 5;
468+
CURRENT_PROJECT_VERSION = 6;
469469
DEVELOPMENT_TEAM = "";
470470
"DEVELOPMENT_TEAM[sdk=macosx*]" = 7K4SKUHU47;
471471
ENABLE_HARDENED_RUNTIME = YES;
@@ -485,7 +485,7 @@
485485
"$(inherited)",
486486
"@executable_path/../Frameworks",
487487
);
488-
MARKETING_VERSION = 0.1.4;
488+
MARKETING_VERSION = 0.1.5;
489489
PRODUCT_BUNDLE_IDENTIFIER = com.mymaccleaner.MyMacCleaner;
490490
PRODUCT_NAME = "$(TARGET_NAME)";
491491
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -506,10 +506,10 @@
506506
buildSettings = {
507507
BUNDLE_LOADER = "$(TEST_HOST)";
508508
CODE_SIGN_STYLE = Automatic;
509-
CURRENT_PROJECT_VERSION = 5;
509+
CURRENT_PROJECT_VERSION = 6;
510510
GENERATE_INFOPLIST_FILE = YES;
511511
MACOSX_DEPLOYMENT_TARGET = 14.0;
512-
MARKETING_VERSION = 0.1.4;
512+
MARKETING_VERSION = 0.1.5;
513513
PRODUCT_BUNDLE_IDENTIFIER = com.mymaccleaner.MyMacCleanerTests;
514514
PRODUCT_NAME = "$(TARGET_NAME)";
515515
SWIFT_EMIT_LOC_STRINGS = NO;
@@ -523,10 +523,10 @@
523523
buildSettings = {
524524
BUNDLE_LOADER = "$(TEST_HOST)";
525525
CODE_SIGN_STYLE = Automatic;
526-
CURRENT_PROJECT_VERSION = 5;
526+
CURRENT_PROJECT_VERSION = 6;
527527
GENERATE_INFOPLIST_FILE = YES;
528528
MACOSX_DEPLOYMENT_TARGET = 14.0;
529-
MARKETING_VERSION = 0.1.4;
529+
MARKETING_VERSION = 0.1.5;
530530
PRODUCT_BUNDLE_IDENTIFIER = com.mymaccleaner.MyMacCleanerTests;
531531
PRODUCT_NAME = "$(TARGET_NAME)";
532532
SWIFT_EMIT_LOC_STRINGS = NO;
@@ -539,9 +539,9 @@
539539
isa = XCBuildConfiguration;
540540
buildSettings = {
541541
CODE_SIGN_STYLE = Automatic;
542-
CURRENT_PROJECT_VERSION = 5;
542+
CURRENT_PROJECT_VERSION = 6;
543543
GENERATE_INFOPLIST_FILE = YES;
544-
MARKETING_VERSION = 0.1.4;
544+
MARKETING_VERSION = 0.1.5;
545545
PRODUCT_BUNDLE_IDENTIFIER = com.mymaccleaner.MyMacCleanerUITests;
546546
PRODUCT_NAME = "$(TARGET_NAME)";
547547
SWIFT_EMIT_LOC_STRINGS = NO;
@@ -554,9 +554,9 @@
554554
isa = XCBuildConfiguration;
555555
buildSettings = {
556556
CODE_SIGN_STYLE = Automatic;
557-
CURRENT_PROJECT_VERSION = 5;
557+
CURRENT_PROJECT_VERSION = 6;
558558
GENERATE_INFOPLIST_FILE = YES;
559-
MARKETING_VERSION = 0.1.4;
559+
MARKETING_VERSION = 0.1.5;
560560
PRODUCT_BUNDLE_IDENTIFIER = com.mymaccleaner.MyMacCleanerUITests;
561561
PRODUCT_NAME = "$(TARGET_NAME)";
562562
SWIFT_EMIT_LOC_STRINGS = NO;

MyMacCleaner/Core/Services/UpdateManager.swift

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,18 @@ final class UpdateManager: NSObject, SPUUpdaterDelegate {
6262
// Start the updater
6363
updaterController.startUpdater()
6464

65-
// Check for updates in background after a short delay
66-
DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) { [weak self] in
67-
self?.checkForUpdatesQuietly()
68-
}
65+
// Check for updates once canCheckForUpdates becomes true
66+
updaterController.updater.publisher(for: \.canCheckForUpdates)
67+
.receive(on: DispatchQueue.main)
68+
.filter { $0 == true }
69+
.first()
70+
.sink { [weak self] _ in
71+
// Small delay to ensure everything is ready
72+
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
73+
self?.checkForUpdatesQuietly()
74+
}
75+
}
76+
.store(in: &cancellables)
6977
}
7078

7179
/// Check for updates interactively (shows UI)
@@ -80,9 +88,9 @@ final class UpdateManager: NSObject, SPUUpdaterDelegate {
8088

8189
/// Check for updates quietly (just to detect if update is available)
8290
func checkForUpdatesQuietly() {
83-
guard canCheckForUpdates else { return }
91+
print("[UpdateManager] checkForUpdatesQuietly called, canCheckForUpdates: \(canCheckForUpdates)")
8492

85-
// Use background check - Sparkle will call our delegate method if update found
93+
// Check appcast directly - don't wait for canCheckForUpdates
8694
Task {
8795
await checkAppcastForUpdates()
8896
}
@@ -102,28 +110,40 @@ final class UpdateManager: NSObject, SPUUpdaterDelegate {
102110

103111
/// Manually fetch and parse the appcast to check for updates
104112
private func checkAppcastForUpdates() async {
105-
guard let feedURL = updaterController.updater.feedURL else { return }
113+
guard let feedURL = updaterController.updater.feedURL else {
114+
print("[UpdateManager] No feed URL configured")
115+
return
116+
}
117+
118+
print("[UpdateManager] Fetching appcast from: \(feedURL)")
106119

107120
do {
108121
let (data, _) = try await URLSession.shared.data(from: feedURL)
109122
let parser = AppcastParser()
110123
if let latestVersion = parser.parseLatestVersion(from: data) {
111-
let currentVersion = Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as? String ?? "0"
124+
let currentBuildStr = Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as? String ?? "0"
112125
let currentShortVersion = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "0"
113126

127+
print("[UpdateManager] Current: \(currentShortVersion) (build \(currentBuildStr)), Latest: \(latestVersion.displayVersion) (build \(latestVersion.buildNumber))")
128+
114129
// Compare build numbers
115130
if let latestBuild = Int(latestVersion.buildNumber),
116-
let currentBuild = Int(currentVersion),
131+
let currentBuild = Int(currentBuildStr),
117132
latestBuild > currentBuild {
133+
print("[UpdateManager] Update available! Setting updateAvailable = true")
118134
await MainActor.run {
119135
self.availableVersion = latestVersion.displayVersion
120136
self.updateAvailable = true
121137
self.updateDismissed = false
122138
}
139+
} else {
140+
print("[UpdateManager] No update available (current build \(currentBuildStr) >= latest build \(latestVersion.buildNumber))")
123141
}
142+
} else {
143+
print("[UpdateManager] Failed to parse appcast")
124144
}
125145
} catch {
126-
print("Failed to check for updates: \(error)")
146+
print("[UpdateManager] Failed to check for updates: \(error)")
127147
}
128148
}
129149
}

appcast.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,22 @@
66
<description>Most recent changes with links to updates.</description>
77
<language>en</language>
88

9+
<item>
10+
<title>Version 0.1.5</title>
11+
<pubDate>Fri, 23 Jan 2026 12:19:17 +0100</pubDate>
12+
<sparkle:version>6</sparkle:version>
13+
<sparkle:shortVersionString>0.1.5</sparkle:shortVersionString>
14+
<sparkle:minimumSystemVersion>14.0</sparkle:minimumSystemVersion>
15+
<description><![CDATA[
16+
<h2>What's New in Version 0.1.5</h2>
17+
<ul>
18+
<li>Fixed automatic update check on app launch</li>
19+
</ul>
20+
]]></description>
21+
<enclosure url="https://github.com/Prot10/MyMacCleaner/releases/download/v0.1.5/MyMacCleaner-v0.1.5.zip" sparkle:edSignature="7CxJJbYi/vHVsAEWfRb6djwsLcYhbfqWlSck+U7ewDYRzs23iHBpuIcpPlBArg/O4GJcxcS9QZacmGUVpk5DAQ==" length="4444539" type="application/octet-stream"/>
22+
</item>
23+
24+
925
<item>
1026
<title>Version 0.1.4</title>
1127
<pubDate>Fri, 23 Jan 2026 12:05:29 +0100</pubDate>

website/public/data/releases.json

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,30 @@
11
{
22
"releases": [
33
{
4-
"version": "0.1.4",
4+
"version": "0.1.5",
55
"date": "2026-01-23",
66
"latest": true,
77
"minOS": "macOS 14.0+",
88
"architecture": "Universal (Apple Silicon + Intel)",
9+
"downloads": {
10+
"dmg": {
11+
"url": "https://github.com/Prot10/MyMacCleaner/releases/download/v0.1.5/MyMacCleaner-v0.1.5.dmg",
12+
"size": "4.6 MB"
13+
}
14+
},
15+
"changelog": [
16+
{
17+
"type": "fixed",
18+
"description": "Fixed automatic update check on app launch"
19+
}
20+
]
21+
},
22+
{
23+
"version": "0.1.4",
24+
"date": "2026-01-23",
25+
"latest": false,
26+
"minOS": "macOS 14.0+",
27+
"architecture": "Universal (Apple Silicon + Intel)",
928
"downloads": {
1029
"dmg": {
1130
"url": "https://github.com/Prot10/MyMacCleaner/releases/download/v0.1.4/MyMacCleaner-v0.1.4.dmg",

0 commit comments

Comments
 (0)