Remove obsolete SDK checks (#2111)

Sparkle currently requires at least Xcode 12 (or the macOS 11 SDK), therefore fallbacks for older versions are no longer needed.

* Remove +isOperatingSystemAtLeastVersion: method

* Remove +operatingSystemVersion accessor method

* Remove SUTouchBarForwardDeclarations header
This commit is contained in:
Eitot authored and GitHub committed 2022-04-23 23:34:20 -07:00
1 parent c0cf32c2b7
commit b0116ef31b
10 files changed
+6 -194

No files matched your search

-4
View File
@@ -132,7 +132,6 @@
7205C4621E1306A600E370AE /* SUBinaryDeltaCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5711D3D895B00D1BF90 /* SUBinaryDeltaCommon.m */; };
7205C4631E1306B500E370AE /* libxar.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 726E07681CA616A4001A286B /* libxar.tbd */; };
7205C4641E1306BE00E370AE /* libbz2.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 726E076A1CA616B3001A286B /* libbz2.tbd */; };
720767D31E2EE9C200F9A850 /* SUTouchBarForwardDeclarations.h in Headers */ = {isa = PBXBuildFile; fileRef = 720767D21E2EE9C200F9A850 /* SUTouchBarForwardDeclarations.h */; };
720AC2A42618E85700E25A3E /* SPUInstallationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5B51D3D8AEE00D1BF90 /* SPUInstallationInfo.m */; };
720AC2C92618E89500E25A3E /* SUAppcastItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B5FC5409C5182000B25A18 /* SUAppcastItem.m */; };
720AC2DC2618E8A500E25A3E /* SPUSecureCoding.m in Sources */ = {isa = PBXBuildFile; fileRef = 726E075B1CA3A6D6001A286B /* SPUSecureCoding.m */; };
@@ -970,7 +969,6 @@
7205C46E1E13254500E370AE /* ConfigUITestDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigUITestDebug.xcconfig; sourceTree = "<group>"; };
7205C46F1E13255900E370AE /* ConfigUITestRelease.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigUITestRelease.xcconfig; sourceTree = "<group>"; };
720767D11E2EB86200F9A850 /* AppKitPrevention.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppKitPrevention.h; sourceTree = "<group>"; };
720767D21E2EE9C200F9A850 /* SUTouchBarForwardDeclarations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUTouchBarForwardDeclarations.h; sourceTree = "<group>"; };
720B16421C66433D006985FB /* UITests-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "UITests-Info.plist"; path = "UITests/UITests-Info.plist"; sourceTree = SOURCE_ROOT; };
720B16431C66433D006985FB /* SUTestApplicationTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SUTestApplicationTest.swift; path = UITests/SUTestApplicationTest.swift; sourceTree = SOURCE_ROOT; };
720B4C2325EBFAFD005A0592 /* link-tools.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "link-tools.sh"; sourceTree = "<group>"; };
@@ -1912,7 +1910,6 @@
723AC036259DBF1B00BDB4FA /* Web View */,
612DCBAD0D488BC60015DBEA /* SUUpdatePermissionPrompt.h */,
612DCBAE0D488BC60015DBEA /* SUUpdatePermissionPrompt.m */,
720767D21E2EE9C200F9A850 /* SUTouchBarForwardDeclarations.h */,
723C8A521E2D60DB00C14942 /* SUTouchBarButtonGroup.h */,
723C8A531E2D60DB00C14942 /* SUTouchBarButtonGroup.m */,
3772FEA813DE0B6B00F79537 /* SUVersionDisplayProtocol.h */,
@@ -2462,7 +2459,6 @@
61B5FC7009C51F4A00B25A18 /* SUAppcastItem.h in Headers */,
725602D51C83551C00DAA70E /* SUApplicationInfo.h in Headers */,
7214B8811D456A8500CB5CED /* SUBundleIcon.h in Headers */,
720767D31E2EE9C200F9A850 /* SUTouchBarForwardDeclarations.h in Headers */,
55E6F33319EC9F6C00005E76 /* SUErrors.h in Headers */,
14652F8419A978C200959E44 /* SUExport.h in Headers */,
7267E5E51D3D90AA00D1BF90 /* SUFileManager.h in Headers */,
+5 -15
View File
@@ -10,18 +10,7 @@
#include <asl.h>
#include <Availability.h>
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101200
#include <os/log.h>
#else
typedef struct os_log_s *os_log_t;
#define os_log_create(subsystem, category) nil
#define os_log(log, format, ...)
#define os_log_error(log, format, ...)
#endif
#include "AppKitPrevention.h"
#import "SUOperatingSystem.h"
@@ -45,10 +34,11 @@ void SULog(SULogLevel level, NSString *format, ...)
dispatch_once(&onceToken, ^{
NSBundle *mainBundle = [NSBundle mainBundle];
hasOSLogging = [SUOperatingSystem isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){10, 12, 0}];
#if __MAC_OS_X_VERSION_MAX_ALLOWED < 101200
hasOSLogging = NO;
#endif
if (@available(macOS 10.12, *)) {
hasOSLogging = YES;
} else {
hasOSLogging = NO;
}
if (hasOSLogging) {
const char *subsystem = SPARKLE_BUNDLE_IDENTIFIER;
-10
View File
@@ -7,18 +7,8 @@
#import <Foundation/Foundation.h>
#if __MAC_OS_X_VERSION_MAX_ALLOWED < 101000
typedef struct {
NSInteger majorVersion;
NSInteger minorVersion;
NSInteger patchVersion;
} NSOperatingSystemVersion;
#endif
@interface SUOperatingSystem : NSObject
+ (NSOperatingSystemVersion)operatingSystemVersion;
+ (BOOL)isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion)version;
+ (NSString *)systemVersionString;
@end
+1 -47
View File
@@ -10,57 +10,11 @@
#include "AppKitPrevention.h"
#if __MAC_OS_X_VERSION_MAX_ALLOWED < 101000
@interface NSProcessInfo ()
- (NSOperatingSystemVersion)operatingSystemVersion;
@end
#endif
@implementation SUOperatingSystem
+ (NSOperatingSystemVersion)operatingSystemVersion
{
#if __MAC_OS_X_VERSION_MIN_REQUIRED < 101000
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wselector"
// Xcode 5.1.1: operatingSystemVersion is clearly declared, must warn due to a compiler bug?
if (![NSProcessInfo instancesRespondToSelector:@selector(operatingSystemVersion)])
#pragma clang diagnostic pop
{
NSOperatingSystemVersion version = { 0, 0, 0 };
NSURL *coreServices = [[NSFileManager defaultManager] URLForDirectory:NSCoreServiceDirectory inDomain:NSSystemDomainMask appropriateForURL:nil create:NO error:nil];
NSURL *url = [coreServices URLByAppendingPathComponent:@"SystemVersion.plist"];
assert(url != nil);
NSDictionary *dictionary = [NSDictionary dictionaryWithContentsOfURL:url];
NSArray<NSString *> *components = [ (NSString *)[dictionary objectForKey: @"ProductVersion"] componentsSeparatedByString:@"."];
version.majorVersion = components.count > 0 ? [ [components objectAtIndex:0] integerValue] : 0;
version.minorVersion = components.count > 1 ? [ [components objectAtIndex:1] integerValue] : 0;
version.patchVersion = components.count > 2 ? [ [components objectAtIndex:2] integerValue] : 0;
return version;
}
#endif
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpartial-availability"
return [[NSProcessInfo processInfo] operatingSystemVersion];
#pragma clang diagnostic pop
}
+ (BOOL)isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion)version
{
const NSOperatingSystemVersion systemVersion = self.operatingSystemVersion;
if (systemVersion.majorVersion == version.majorVersion) {
if (systemVersion.minorVersion == version.minorVersion) {
return systemVersion.patchVersion >= version.patchVersion;
}
return systemVersion.minorVersion >= version.minorVersion;
}
return systemVersion.majorVersion >= version.majorVersion;
}
+ (NSString *)systemVersionString
{
NSOperatingSystemVersion version = self.operatingSystemVersion;
NSOperatingSystemVersion version = [[NSProcessInfo processInfo] operatingSystemVersion];
return [NSString stringWithFormat:@"%ld.%ld.%ld", (long)version.majorVersion, (long)version.minorVersion, (long)version.patchVersion];
}
-6
View File
@@ -8,12 +8,6 @@
#import <Foundation/Foundation.h>
#if __MAC_OS_X_VERSION_MAX_ALLOWED < 1090
@interface NSData (SUSignatureVerifier)
- (id)initWithBase64Encoding:(NSString *)base64String;
@end
#endif
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(uint8_t, SUSigningInputStatus) {
-1
View File
@@ -13,7 +13,6 @@
#import "SUApplicationInfo.h"
#import "SULocalizations.h"
#import "SUOperatingSystem.h"
#import "SUTouchBarForwardDeclarations.h"
#import "SUTouchBarButtonGroup.h"
static NSString *const SUStatusControllerTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDENTIFIER ".SUStatusController";
-6
View File
@@ -10,12 +10,6 @@
#import "SUTouchBarButtonGroup.h"
#if __MAC_OS_X_VERSION_MAX_ALLOWED < 101200
@interface NSButton (SierraSDK)
+ (instancetype)buttonWithTitle:(NSString*)title target:(id)target action:(SEL)action;
@end
#endif
@implementation SUTouchBarButtonGroup
@synthesize buttons = _buttons;
-95
View File
@@ -1,95 +0,0 @@
//
// SUTouchBarForwardDeclarations.h
// Sparkle
//
// Created by Yuxin Wang on 18/01/2017.
// Copyright © 2017 Sparkle Project. All rights reserved.
//
#if SPARKLE_BUILD_UI_BITS
// Once Sparkle no longer supports OSX 10.12.0, this file can be deleted.
#import <Foundation/Foundation.h>
#if __MAC_OS_X_VERSION_MAX_ALLOWED < 101201
NS_ASSUME_NONNULL_BEGIN
@class NSTouchBar;
@class NSTouchBarItem;
@class NSCustomTouchBarItem;
typedef NSString * NSTouchBarItemIdentifier;
typedef NSString * NSTouchBarCustomizationIdentifier;
@protocol NSTouchBarDelegate;
NS_CLASS_AVAILABLE_MAC(10_12_2)
@interface NSTouchBar : NSObject <NSCoding>
- (instancetype)init NS_DESIGNATED_INITIALIZER;
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER;
@property (copy, nullable) NSTouchBarCustomizationIdentifier customizationIdentifier;
@property (copy) NSArray<NSTouchBarItemIdentifier> *customizationAllowedItemIdentifiers;
@property (copy) NSArray<NSTouchBarItemIdentifier> *customizationRequiredItemIdentifiers;
@property (copy) NSArray<NSTouchBarItemIdentifier> *defaultItemIdentifiers;
@property (copy, readonly) NSArray<NSTouchBarItemIdentifier> *itemIdentifiers;
@property (copy, nullable) NSTouchBarItemIdentifier principalItemIdentifier;
@property (copy, nullable) NSTouchBarItemIdentifier escapeKeyReplacementItemIdentifier;
@property (copy) NSSet<NSTouchBarItem *> *templateItems;
@property (nullable, weak) id <NSTouchBarDelegate> delegate;
- (nullable __kindof NSTouchBarItem *)itemForIdentifier:(NSTouchBarItemIdentifier)identifier;
@property (readonly, getter=isVisible) BOOL visible;
@end
@protocol NSTouchBarDelegate<NSObject>
@optional
- (nullable NSTouchBarItem*)touchBar:(NSTouchBar*)touchBar
makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier;
@end
typedef float NSTouchBarItemPriority;
NS_CLASS_AVAILABLE_MAC(10_12_2)
@interface NSTouchBarItem : NSObject <NSCoding>
- (instancetype)initWithIdentifier:(NSTouchBarItemIdentifier)identifier NS_DESIGNATED_INITIALIZER;
- (nullable instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER;
- (instancetype)init NS_UNAVAILABLE;
@property (readonly, copy) NSTouchBarItemIdentifier identifier;
@property NSTouchBarItemPriority visibilityPriority;
@property (readonly, nullable) NSView *view;
@property (readonly, nullable) NSViewController *viewController;
@property (readonly, copy) NSString *customizationLabel;
@property (readonly, getter=isVisible) BOOL visible;
@end
NS_CLASS_AVAILABLE_MAC(10_12_2)
@interface NSCustomTouchBarItem : NSTouchBarItem
@property (readwrite, strong) __kindof NSView *view;
@property (readwrite, strong, nullable) __kindof NSViewController *viewController;
@property (readwrite, copy, null_resettable) NSString *customizationLabel;
@end
NS_ASSUME_NONNULL_END
#else
// When compiling against the 10.12.1 SDK or later, just provide forward
// declarations to suppress the partial availability warnings.
@class NSTouchBar;
@protocol NSTouchBarDelegate;
@class NSTouchBarItem;
@class NSCustomTouchBarItem;
#endif
#endif
-9
View File
@@ -26,7 +26,6 @@
#import "SPUDownloadData.h"
#import "SUApplicationInfo.h"
#import "SPUUpdaterSettings.h"
#import "SUTouchBarForwardDeclarations.h"
#import "SUTouchBarButtonGroup.h"
#import "SPUXPCServiceInfo.h"
#import "SPUUserUpdateState.h"
@@ -153,14 +152,12 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE
{
[self adaptReleaseNotesAppearance];
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
if (@available(macOS 10.14, *)) {
if (!self.observingAppearance) {
[self.webView.view addObserver:self forKeyPath:@"effectiveAppearance" options:0 context:nil];
self.observingAppearance = YES;
}
}
#endif
// Stick a nice big spinner in the middle of the web view until the page is loaded.
NSRect frame = [[self.webView.view superview] frame];
@@ -187,29 +184,24 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE
}
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(__attribute__((unused)) NSDictionary<NSKeyValueChangeKey,id> *)change context:(__attribute__((unused)) void *)context {
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
if (@available(macOS 10.14, *)) {
if (object == self.webView.view && [keyPath isEqualToString:@"effectiveAppearance"]) {
[self adaptReleaseNotesAppearance];
}
}
#endif
}
- (void)dealloc {
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
if (@available(macOS 10.14, *)) {
if (self.observingAppearance) {
[self.webView.view removeObserver:self forKeyPath:@"effectiveAppearance"];
self.observingAppearance = NO;
}
}
#endif
}
- (void)adaptReleaseNotesAppearance
{
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
if (@available(macOS 10.14, *))
{
NSAppearanceName bestAppearance = [self.webView.view.effectiveAppearance bestMatchFromAppearancesWithNames:@[NSAppearanceNameAqua, NSAppearanceNameDarkAqua]];
@@ -241,7 +233,6 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE
[self.webView setDrawsBackground:YES];
}
}
#endif
}
- (void)showUpdateReleaseNotesWithDownloadData:(SPUDownloadData *)downloadData
-1
View File
@@ -16,7 +16,6 @@
#import "SUHost.h"
#import "SUConstants.h"
#import "SUApplicationInfo.h"
#import "SUTouchBarForwardDeclarations.h"
#import "SUTouchBarButtonGroup.h"
static NSString *const SUUpdatePermissionPromptTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDENTIFIER ".SUUpdatePermissionPrompt";