Revision: 28426 http://sourceforge.net/p/bibdesk/svn/28426 Author: hofman Date: 2023-11-07 10:16:13 +0000 (Tue, 07 Nov 2023) Log Message: ----------- use @available in Sparkle
Modified Paths: -------------- trunk/bibdesk_vendorsrc/andymatuschak/Sparkle/Sparkle/SPUDownloadData.m trunk/bibdesk_vendorsrc/andymatuschak/Sparkle/Sparkle/SPUURLRequest.m trunk/bibdesk_vendorsrc/andymatuschak/Sparkle/Sparkle/SUAppcast.m trunk/bibdesk_vendorsrc/andymatuschak/Sparkle/Sparkle/SUBasicUpdateDriver.m trunk/bibdesk_vendorsrc/andymatuschak/Sparkle/Sparkle/SUOperatingSystem.h trunk/bibdesk_vendorsrc/andymatuschak/Sparkle/Sparkle/SUStatusController.m trunk/bibdesk_vendorsrc/andymatuschak/Sparkle/Sparkle/SUUpdateAlert.m trunk/bibdesk_vendorsrc/andymatuschak/Sparkle/Sparkle/SUUpdater.m Modified: trunk/bibdesk_vendorsrc/andymatuschak/Sparkle/Sparkle/SPUDownloadData.m =================================================================== --- trunk/bibdesk_vendorsrc/andymatuschak/Sparkle/Sparkle/SPUDownloadData.m 2023-11-05 23:33:15 UTC (rev 28425) +++ trunk/bibdesk_vendorsrc/andymatuschak/Sparkle/Sparkle/SPUDownloadData.m 2023-11-07 10:16:13 UTC (rev 28426) @@ -8,8 +8,6 @@ #import "SPUDownloadData.h" -#import "SUOperatingSystem.h" - #include "AppKitPrevention.h" static NSString *SPUDownloadDataKey = @"SPUDownloadData"; @@ -53,9 +51,7 @@ - (nullable instancetype)initWithCoder:(NSCoder *)decoder { - if (SUAVAILABLE(10, 8)) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunguarded-availability" + if (@available(macOS 10.8, *)) { NSData *data = [decoder decodeObjectOfClass:[NSData class] forKey:SPUDownloadDataKey]; if (data == nil) { return nil; @@ -64,7 +60,6 @@ NSString *textEncodingName = [decoder decodeObjectOfClass:[NSString class] forKey:SPUDownloadTextEncodingKey]; NSString *MIMEType = [decoder decodeObjectOfClass:[NSString class] forKey:SPUDownloadMIMETypeKey]; -#pragma clang diagnostic pop return [self initWithData:data textEncodingName:textEncodingName MIMEType:MIMEType]; } else { Modified: trunk/bibdesk_vendorsrc/andymatuschak/Sparkle/Sparkle/SPUURLRequest.m =================================================================== --- trunk/bibdesk_vendorsrc/andymatuschak/Sparkle/Sparkle/SPUURLRequest.m 2023-11-05 23:33:15 UTC (rev 28425) +++ trunk/bibdesk_vendorsrc/andymatuschak/Sparkle/Sparkle/SPUURLRequest.m 2023-11-07 10:16:13 UTC (rev 28426) @@ -8,8 +8,6 @@ #import "SPUURLRequest.h" -#import "SUOperatingSystem.h" - #include "AppKitPrevention.h" static NSString *SPUURLRequestURLKey = @"SPUURLRequestURL"; @@ -73,14 +71,11 @@ - (instancetype)initWithCoder:(NSCoder *)decoder { - if (SUAVAILABLE(10, 8)) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunguarded-availability" + if (@available(macOS 10.8, *)) { NSURL *url = [decoder decodeObjectOfClass:[NSURL class] forKey:SPUURLRequestURLKey]; NSURLRequestCachePolicy cachePolicy = (NSURLRequestCachePolicy)[decoder decodeIntegerForKey:SPUURLRequestCachePolicyKey]; NSTimeInterval timeoutInterval = [decoder decodeDoubleForKey:SPUURLRequestTimeoutIntervalKey]; NSDictionary<NSString *, NSString *> *httpHeaderFields = [decoder decodeObjectOfClasses:[NSSet setWithArray:@[[NSDictionary class], [NSString class]]] forKey:SPUURLRequestHttpHeaderFieldsKey]; -#pragma clang diagnostic pop NSURLRequestNetworkServiceType networkServiceType = (NSURLRequestNetworkServiceType)[decoder decodeIntegerForKey:SPUURLRequestNetworkServiceTypeKey]; return [self initWithURL:url cachePolicy:cachePolicy timeoutInterval:timeoutInterval httpHeaderFields:httpHeaderFields networkServiceType:networkServiceType]; Modified: trunk/bibdesk_vendorsrc/andymatuschak/Sparkle/Sparkle/SUAppcast.m =================================================================== --- trunk/bibdesk_vendorsrc/andymatuschak/Sparkle/Sparkle/SUAppcast.m 2023-11-05 23:33:15 UTC (rev 28425) +++ trunk/bibdesk_vendorsrc/andymatuschak/Sparkle/Sparkle/SUAppcast.m 2023-11-07 10:16:13 UTC (rev 28426) @@ -13,7 +13,6 @@ #import "SUErrors.h" #import "SPUURLRequest.h" -#import "SUOperatingSystem.h" #import "SPUDownloadData.h" #import "SPUDownloaderDelegate.h" #import "SPUDownloaderDeprecated.h" @@ -86,11 +85,8 @@ [request setValue:@"application/rss+xml,*/*;q=0.1" forHTTPHeaderField:@"Accept"]; - if (SUAVAILABLE(10, 9)) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunguarded-availability" + if (@available(macOS 10.9, *)) { self.download = [[SPUDownloaderSession alloc] initWithDelegate:self]; -#pragma clang diagnostic pop } else { self.download = [[SPUDownloaderDeprecated alloc] initWithDelegate:self]; Modified: trunk/bibdesk_vendorsrc/andymatuschak/Sparkle/Sparkle/SUBasicUpdateDriver.m =================================================================== --- trunk/bibdesk_vendorsrc/andymatuschak/Sparkle/Sparkle/SUBasicUpdateDriver.m 2023-11-05 23:33:15 UTC (rev 28425) +++ trunk/bibdesk_vendorsrc/andymatuschak/Sparkle/Sparkle/SUBasicUpdateDriver.m 2023-11-07 10:16:13 UTC (rev 28426) @@ -283,11 +283,8 @@ withRequest:request]; } - if (SUAVAILABLE(10, 9)) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunguarded-availability" + if (@available(macOS 10.9, *)) { self.download = [[SPUDownloaderSession alloc] initWithDelegate:self]; -#pragma clang diagnostic pop } else { self.download = [[SPUDownloaderDeprecated alloc] initWithDelegate:self]; Modified: trunk/bibdesk_vendorsrc/andymatuschak/Sparkle/Sparkle/SUOperatingSystem.h =================================================================== --- trunk/bibdesk_vendorsrc/andymatuschak/Sparkle/Sparkle/SUOperatingSystem.h 2023-11-05 23:33:15 UTC (rev 28425) +++ trunk/bibdesk_vendorsrc/andymatuschak/Sparkle/Sparkle/SUOperatingSystem.h 2023-11-07 10:16:13 UTC (rev 28426) @@ -22,9 +22,3 @@ + (NSString *)systemVersionString; @end - -#if defined(__clang_major__) && __clang_major__ >= 9 -#define SUAVAILABLE(major, minor) @available(macOS major##.##minor, *) -#else -#define SUAVAILABLE(major, minor) [SUOperatingSystem isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){major, minor, 0}] -#endif Modified: trunk/bibdesk_vendorsrc/andymatuschak/Sparkle/Sparkle/SUStatusController.m =================================================================== --- trunk/bibdesk_vendorsrc/andymatuschak/Sparkle/Sparkle/SUStatusController.m 2023-11-05 23:33:15 UTC (rev 28425) +++ trunk/bibdesk_vendorsrc/andymatuschak/Sparkle/Sparkle/SUStatusController.m 2023-11-07 10:16:13 UTC (rev 28426) @@ -6,7 +6,6 @@ // Copyright 2006 Andy Matuschak. All rights reserved. // -#import "SUOperatingSystem.h" #import "SUStatusController.h" #import "SUHost.h" #import "SULocalizations.h" @@ -57,11 +56,8 @@ [[self window] setFrameAutosaveName:@"SUStatusFrame"]; [self.progressBar setUsesThreadedAnimation:YES]; - if (SUAVAILABLE(10, 11)) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wpartial-availability" + if (@available(macOS 10.11, *)) { [self.statusTextField setFont:[NSFont monospacedDigitSystemFontOfSize:0 weight:NSFontWeightRegular]]; -#pragma clang diagnostic pop } } Modified: trunk/bibdesk_vendorsrc/andymatuschak/Sparkle/Sparkle/SUUpdateAlert.m =================================================================== --- trunk/bibdesk_vendorsrc/andymatuschak/Sparkle/Sparkle/SUUpdateAlert.m 2023-11-05 23:33:15 UTC (rev 28425) +++ trunk/bibdesk_vendorsrc/andymatuschak/Sparkle/Sparkle/SUUpdateAlert.m 2023-11-07 10:16:13 UTC (rev 28426) @@ -21,7 +21,6 @@ #import "SUAppcastItem.h" #import "SUApplicationInfo.h" #import "SUSystemUpdateInfo.h" -#import "SUOperatingSystem.h" #import "SUTouchBarForwardDeclarations.h" #import "SUTouchBarButtonGroup.h" @@ -98,7 +97,7 @@ - (void)dealloc { #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 - if (SUAVAILABLE(10, 14)) { + if (@available(macOS 10.14, *)) { if (self.observingAppearance) { [self.window removeObserver:self forKeyPath:@"effectiveAppearance"]; self.observingAppearance = NO; @@ -168,7 +167,7 @@ prefs.defaultFontSize = (int)[NSFont systemFontSize]; #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 - if (SUAVAILABLE(10, 14)) + if (@available(macOS 10.14, *)) { NSBox *darkBackgroundView = [[NSBox alloc] initWithFrame:self.releaseNotesView.frame]; darkBackgroundView.boxType = NSBoxCustom; @@ -309,14 +308,11 @@ - (void)adaptReleaseNotesAppearance { #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 - if (SUAVAILABLE(10, 14)) + if (@available(macOS 10.14, *)) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunguarded-availability" NSAppearanceName bestAppearance = [self.window.effectiveAppearance bestMatchFromAppearancesWithNames:@[NSAppearanceNameAqua, NSAppearanceNameDarkAqua]]; BOOL isDarkAqua = ([bestAppearance isEqualToString:NSAppearanceNameDarkAqua]); self.releaseNotesView.preferences.userStyleSheetEnabled = isDarkAqua; -#pragma clang diagnostic pop } #endif } Modified: trunk/bibdesk_vendorsrc/andymatuschak/Sparkle/Sparkle/SUUpdater.m =================================================================== --- trunk/bibdesk_vendorsrc/andymatuschak/Sparkle/Sparkle/SUUpdater.m 2023-11-05 23:33:15 UTC (rev 28425) +++ trunk/bibdesk_vendorsrc/andymatuschak/Sparkle/Sparkle/SUUpdater.m 2023-11-07 10:16:13 UTC (rev 28426) @@ -26,7 +26,6 @@ #import "SUSystemProfiler.h" #import "SUSystemUpdateInfo.h" #import "SUSignatures.h" -#import "SUOperatingSystem.h" NSString *const SUUpdaterDidFinishLoadingAppCastNotification = @"SUUpdaterDidFinishLoadingAppCastNotification"; NSString *const SUUpdaterDidFindValidUpdateNotification = @"SUUpdaterDidFindValidUpdateNotification"; @@ -298,11 +297,8 @@ BOOL automatic = [self automaticallyDownloadsUpdates]; if (!automatic) { - if (SUAVAILABLE(10, 9)) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunguarded-availability" + if (@available(macOS 10.9, *)) { NSUserDefaults *defaults = [[NSUserDefaults alloc] initWithSuiteName:@"com.apple.notificationcenterui"]; -#pragma clang diagnostic pop BOOL dnd = [defaults boolForKey:@"doNotDisturb"]; if (dnd) { SULog(SULogLevelDefault, @"Delayed update, because Do Not Disturb is on"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ Bibdesk-commit mailing list Bibdesk-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-commit