Skip to content

Commit 1d4120b

Browse files
committed
fix(updates): Wire up development channel filtering in Sparkle
**Problem:** - Users with development updates enabled could see dev releases in the appcast - BUT Sparkle was filtering them out because allowed channels weren't configured - The 'Receive development updates' switch changed the feed URL but didn't tell Sparkle to accept development channel items **Root Cause:** Missing implementation of Sparkle's `allowedChannels(for:)` delegate method. Without this, Sparkle filters out any items tagged with `<sparkle:channel>development</sparkle:channel>`, even if they're in the feed. **Solution:** 1. Added `cachedAllowedChannels` property to AppDelegate 2. Implemented `allowedChannels(for:)` SPUUpdaterDelegate method 3. Update `cachedAllowedChannels` when feed URL changes: - Development enabled: Set to ["development"] - Development disabled: Set to [] (stable only) **Testing:** ✅ Build: PASS (no errors, warnings only) ✅ Manual: Toggling development updates now correctly shows/hides dev releases ✅ User confirmed: Can switch back and forth, sees d✅ User co26✅ User confirmed: Can switch back and forth, sees d✅ User co26✅ User coers can opt into pre-release testing.
1 parent 723058f commit 1d4120b

2 files changed

Lines changed: 22 additions & 3 deletions

File tree

Resources/whats-new.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"releases": [
33
{
4-
"version": "20260114.1",
5-
"release_date": "January 14, 2026",
4+
"version": "20260113.1",
5+
"release_date": "January 13, 2026",
66
"introduction": "This release introduces LoRA fine-tuning capabilities, allowing you to train custom adapters that specialize local models on your own knowledge domains without modifying the base model weights.",
77
"highlights": [
88
{

Sources/SAM/AppDelegate.swift

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ class AppDelegate: NSObject, NSApplicationDelegate, SPUUpdaterDelegate {
1414
private var windowFrameObserver: NSObjectProtocol?
1515
private var configuredWindows: Set<ObjectIdentifier> = []
1616
private let logger = Logger(label: "com.sam.appdelegate")
17+
18+
/// Cached allowed channels for Sparkle updates
19+
private var cachedAllowedChannels: Set<String> = []
1720

1821
/// Shared instance for accessing updater from Commands.
1922
nonisolated(unsafe) static weak var shared: AppDelegate?
@@ -90,6 +93,11 @@ class AppDelegate: NSObject, NSApplicationDelegate, SPUUpdaterDelegate {
9093
func updater(_ updater: SPUUpdater, didFinishLoading appcast: SUAppcast) {
9194
NSLog("SPARKLE: Finished loading appcast with \(appcast.items.count) items")
9295
}
96+
97+
/// Sparkle delegate method to specify allowed channels
98+
func allowedChannels(for updater: SPUUpdater) -> Set<String> {
99+
return cachedAllowedChannels
100+
}
93101

94102
func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
95103
/// Keep app running when last window is closed (standard macOS behavior).
@@ -234,7 +242,18 @@ class AppDelegate: NSObject, NSApplicationDelegate, SPUUpdaterDelegate {
234242

235243
updaterController.updater.setFeedURL(feedURL)
236244

237-
logger.info("Sparkle feed URL updated to: \(developmentEnabled ? "development" : "stable") (\(feedURL.absoluteString))")
245+
// Configure allowed channels based on development preference
246+
if developmentEnabled {
247+
// Allow development channel items (tagged with <sparkle:channel>development</sparkle:channel>)
248+
cachedAllowedChannels = ["development"]
249+
logger.info("Sparkle feed URL updated to: development (\(feedURL.absoluteString))")
250+
logger.info("Allowed channels: [development]")
251+
} else {
252+
// Only show stable releases (items without channel tag)
253+
cachedAllowedChannels = []
254+
logger.info("Sparkle feed URL updated to: stable (\(feedURL.absoluteString))")
255+
logger.info("Allowed channels: [] (stable only)")
256+
}
238257

239258
// Check for updates immediately after switching feeds
240259
if developmentEnabled {

0 commit comments

Comments
 (0)