From c8432c5acb32be4e71c3deb8ea8db7aafae6ac79 Mon Sep 17 00:00:00 2001 From: Luke Roberts Date: Mon, 20 Nov 2023 21:17:39 +0000 Subject: [PATCH] Adds prerelease functionality --- Shared/Constants.h | 1 + TCCKronos/AppDelegate.m | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Shared/Constants.h b/Shared/Constants.h index dc44c43..592b7e6 100644 --- a/Shared/Constants.h +++ b/Shared/Constants.h @@ -25,5 +25,6 @@ #define SETTING_ESF @"KronosESFTamperingDetectionEnabled" #define SETTING_SENTRY @"KronosSentryTelemetryEnabled" +#define SETTING_PRERELEASE_UPDATES @"KronosSparklePreReleaseUpdates" #endif /* Constants_h */ diff --git a/TCCKronos/AppDelegate.m b/TCCKronos/AppDelegate.m index 9ad8ebf..15cfceb 100644 --- a/TCCKronos/AppDelegate.m +++ b/TCCKronos/AppDelegate.m @@ -32,7 +32,8 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { // Register a default set of values for UserDefaults NSDictionary *appDefaults = @{ SETTING_ESF: @YES, - SETTING_SENTRY: @YES + SETTING_SENTRY: @YES, + SETTING_PRERELEASE_UPDATES: @NO }; [[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults]; @@ -132,7 +133,7 @@ - (void)checkLaunchdPlist { return; } - NSLog(@"Found existing plist at %@", targetPath); + NSLog(@"Found existing plist at %@ for a different version, replacing", targetPath); [[NSFileManager defaultManager] removeItemAtPath:targetPath error:&error]; @@ -278,6 +279,14 @@ -(void)setActivationPolicy return; } +- (NSSet *)allowedChannelsForUpdater:(SPUUpdater *)updater { + if ([[NSUserDefaults standardUserDefaults] boolForKey:SETTING_PRERELEASE_UPDATES]) { + return [NSSet setWithObject:@"prerelease"]; + } else { + return [NSSet set]; + } +} + - (BOOL)supportsGentleScheduledUpdateReminders { return YES; }