mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-25 04:47:55 +00:00
Merge branch '2.x' into selective-critical
This commit is contained in:
commit
7efa996ba9
16 files changed
+41
-27
No files matched your search
@@ -12,3 +12,6 @@ ALWAYS_SEARCH_USER_PATHS = NO
|
||||
|
||||
// Disable Warnings - this is a third-party project, and we'll trust that the maintainers know what they're doing.
|
||||
WARNING_CFLAGS = $(inherited) -Wno-cast-qual -Wno-conversion -Wno-sign-conversion
|
||||
|
||||
// Disable dead stores analyzer warning
|
||||
CLANG_ANALYZER_DEADCODE_DEADSTORES = NO
|
||||
Vendored
+4
@@ -66,6 +66,10 @@
|
||||
|
||||
"An important update to %@ is ready to install" = "An important update to %@ is ready to install";
|
||||
|
||||
"Unable to Check For Updates" = "Unable to Check For Updates";
|
||||
|
||||
"The update checker failed to start correctly. You should contact the app developer to report this issue and verify that you have the latest version" = "The update checker failed to start correctly. You should contact the app developer to report this issue and verify that you have the latest version";
|
||||
|
||||
/* the unit for bytes */
|
||||
"B" = "B";
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -83,7 +83,7 @@
|
||||
SULog(SULogLevelError, @"Error: resumeDownloadedUpdate:completion: called on SPUAutomaticUpdateDriver");
|
||||
}
|
||||
|
||||
- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem *)secondaryUpdateItem
|
||||
- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem
|
||||
{
|
||||
self.updateItem = updateItem;
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol SPUBasicUpdateDriverDelegate <NSObject>
|
||||
|
||||
- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)appcastItem secondaryAppcastItem:(SUAppcastItem *)secondaryAppcastItem systemDomain:(NSNumber * _Nullable)systemDomain;
|
||||
- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)appcastItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryAppcastItem systemDomain:(NSNumber * _Nullable)systemDomain;
|
||||
|
||||
- (void)basicDriverIsRequestingAbortUpdateWithError:(nullable NSError *)error;
|
||||
|
||||
|
||||
Vendored
+3
-3
@@ -81,7 +81,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)notifyResumableUpdateItem:(SUAppcastItem *)updateItem secondaryUpdateItem:(SUAppcastItem *)secondaryUpdateItem systemDomain:(NSNumber * _Nullable)systemDomain
|
||||
- (void)notifyResumableUpdateItem:(SUAppcastItem *)updateItem secondaryUpdateItem:(SUAppcastItem * _Nullable)secondaryUpdateItem systemDomain:(NSNumber * _Nullable)systemDomain
|
||||
{
|
||||
if (updateItem == nil) {
|
||||
[self.delegate basicDriverIsRequestingAbortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUResumeAppcastError userInfo:@{ NSLocalizedDescriptionKey: SULocalizedString(@"Failed to resume installing update.", nil) }]];
|
||||
@@ -139,7 +139,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)notifyFoundValidUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem *)secondaryUpdateItem systemDomain:(NSNumber * _Nullable)systemDomain
|
||||
- (void)notifyFoundValidUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem systemDomain:(NSNumber * _Nullable)systemDomain
|
||||
{
|
||||
if (!self.aborted) {
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterDidFindValidUpdateNotification
|
||||
@@ -154,7 +154,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)didFindValidUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem *)secondaryAppcastItem
|
||||
- (void)didFindValidUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryAppcastItem
|
||||
{
|
||||
[self notifyFoundValidUpdateWithAppcastItem:updateItem secondaryAppcastItem:secondaryAppcastItem systemDomain:nil];
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol SPUCoreBasedUpdateDriverDelegate <NSObject>
|
||||
|
||||
- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem *)secondaryAppcastItem;
|
||||
- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryAppcastItem;
|
||||
|
||||
- (void)installerDidFinishPreparationAndWillInstallImmediately:(BOOL)willInstallImmediately silently:(BOOL)willInstallSilently;
|
||||
|
||||
@@ -63,7 +63,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (void)downloadUpdateFromAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem inBackground:(BOOL)background;
|
||||
|
||||
- (void)deferInformationalUpdate:(SUAppcastItem *)updateItem secondaryUpdate:(SUAppcastItem *)secondaryUpdateItem;
|
||||
- (void)deferInformationalUpdate:(SUAppcastItem *)updateItem secondaryUpdate:(SUAppcastItem * _Nullable)secondaryUpdateItem;
|
||||
|
||||
- (void)extractDownloadedUpdate;
|
||||
|
||||
|
||||
Vendored
+3
-3
@@ -32,7 +32,7 @@
|
||||
@property (nonatomic, readonly) SPUInstallerDriver *installerDriver;
|
||||
@property (nonatomic, weak, readonly) id<SPUCoreBasedUpdateDriverDelegate> delegate;
|
||||
@property (nonatomic) SUAppcastItem *updateItem;
|
||||
@property (nonatomic) SUAppcastItem *secondaryUpdateItem;
|
||||
@property (nonatomic, nullable) SUAppcastItem *secondaryUpdateItem;
|
||||
@property (nonatomic) id<SPUResumableUpdate> resumableUpdate;
|
||||
@property (nonatomic) SPUDownloadedUpdate *downloadedUpdateForRemoval;
|
||||
|
||||
@@ -149,7 +149,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem *)secondaryUpdateItem systemDomain:(NSNumber * _Nullable)systemDomain
|
||||
- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem systemDomain:(NSNumber * _Nullable)systemDomain
|
||||
{
|
||||
self.updateItem = updateItem;
|
||||
self.secondaryUpdateItem = secondaryUpdateItem;
|
||||
@@ -225,7 +225,7 @@
|
||||
[self extractUpdate:downloadedUpdate];
|
||||
}
|
||||
|
||||
- (void)deferInformationalUpdate:(SUAppcastItem *)updateItem secondaryUpdate:(SUAppcastItem *)secondaryUpdateItem
|
||||
- (void)deferInformationalUpdate:(SUAppcastItem *)updateItem secondaryUpdate:(SUAppcastItem * _Nullable)secondaryUpdateItem
|
||||
{
|
||||
self.resumableUpdate = [[SPUInformationalUpdate alloc] initWithAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem];
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -28,7 +28,7 @@
|
||||
@property (nonatomic) id<SPUDownloaderProtocol> downloader;
|
||||
@property (nonatomic) NSXPCConnection *connection;
|
||||
@property (nonatomic, readonly) SUAppcastItem *updateItem;
|
||||
@property (nonatomic, readonly) SUAppcastItem *secondaryUpdateItem;
|
||||
@property (nonatomic, readonly, nullable) SUAppcastItem *secondaryUpdateItem;
|
||||
@property (nonatomic, readonly) SUHost *host;
|
||||
@property (nonatomic, copy) NSString *temporaryDirectory;
|
||||
@property (nonatomic, copy) NSString *downloadName;
|
||||
|
||||
Vendored
+1
-1
@@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface SPUInformationalUpdate : NSObject <SPUResumableUpdate>
|
||||
|
||||
- (instancetype)initWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem *)secondaryUpdateItem;
|
||||
- (instancetype)initWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -18,7 +18,7 @@
|
||||
@synthesize updateItem = _updateItem;
|
||||
@synthesize secondaryUpdateItem = _secondaryUpdateItem;
|
||||
|
||||
- (instancetype)initWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem *)secondaryUpdateItem
|
||||
- (instancetype)initWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
|
||||
Vendored
+1
-1
@@ -54,7 +54,7 @@
|
||||
[self.basicDriver resumeUpdate:resumableUpdate completion:completionBlock];
|
||||
}
|
||||
|
||||
- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)__unused appcastItem secondaryAppcastItem:(SUAppcastItem *)__unused secondaryAppcastItem systemDomain:(NSNumber * _Nullable)__unused systemDomain
|
||||
- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)__unused appcastItem secondaryAppcastItem:(SUAppcastItem * _Nullable)__unused secondaryAppcastItem systemDomain:(NSNumber * _Nullable)__unused systemDomain
|
||||
{
|
||||
// Stop as soon as we have an answer
|
||||
[self abortUpdate];
|
||||
|
||||
+3
-3
@@ -14,6 +14,7 @@
|
||||
#import "SPUStandardUserDriver.h"
|
||||
#import "SUConstants.h"
|
||||
#import "SULog.h"
|
||||
#import "SULocalizations.h"
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObservationContext";
|
||||
@@ -76,9 +77,8 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
||||
// Delay the alert four seconds so it doesn't show RIGHT as the app launches, but also doesn't interrupt the user once they really get to work.
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(4 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
NSAlert *alert = [[NSAlert alloc] init];
|
||||
alert.messageText = @"Unable to Check For Updates";
|
||||
alert.informativeText = @"The update checker failed to start correctly. You should contact the app developer to report this issue and verify that you have the latest version.";
|
||||
[alert addButtonWithTitle:@"OK"];
|
||||
alert.messageText = SULocalizedString(@"Unable to Check For Updates", nil);
|
||||
alert.informativeText = SULocalizedString(@"The update checker failed to start correctly. You should contact the app developer to report this issue and verify that you have the latest version.", nil);
|
||||
[alert runModal];
|
||||
});
|
||||
}
|
||||
|
||||
Vendored
+11
-4
@@ -36,11 +36,11 @@
|
||||
@synthesize downloadDriver = _downloadDriver;
|
||||
@synthesize completionHandler = _completionHandler;
|
||||
|
||||
- (instancetype)initWithReleaseNotesURL:(NSURL *)releaseNotesURL host:(SUHost *)host completionHandler:(void (^)(SPUDownloadData * _Nullable, NSError * _Nullable))completionHandler
|
||||
- (instancetype)initWithReleaseNotesURL:(NSURL *)releaseNotesURL httpHeaders:(NSDictionary * _Nullable)httpHeaders userAgent:(NSString * _Nullable)userAgent host:(SUHost *)host completionHandler:(void (^)(SPUDownloadData * _Nullable, NSError * _Nullable))completionHandler
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
_downloadDriver = [[SPUDownloadDriver alloc] initWithRequestURL:releaseNotesURL host:host userAgent:nil httpHeaders:nil inBackground:NO delegate:self];
|
||||
_downloadDriver = [[SPUDownloadDriver alloc] initWithRequestURL:releaseNotesURL host:host userAgent:userAgent httpHeaders:httpHeaders inBackground:NO delegate:self];
|
||||
_completionHandler = [completionHandler copy];
|
||||
} else {
|
||||
assert(false);
|
||||
@@ -90,6 +90,8 @@
|
||||
@property (nonatomic) BOOL resumingInstallingUpdate;
|
||||
@property (nonatomic) BOOL resumingDownloadedUpdate;
|
||||
@property (nonatomic) BOOL preventsInstallerInteraction;
|
||||
@property (nonatomic, nullable) NSDictionary *httpHeaders;
|
||||
@property (nonatomic, nullable) NSString *userAgent;
|
||||
|
||||
@end
|
||||
|
||||
@@ -106,6 +108,8 @@
|
||||
@synthesize resumingInstallingUpdate = _resumingInstallingUpdate;
|
||||
@synthesize resumingDownloadedUpdate = _resumingDownloadedUpdate;
|
||||
@synthesize preventsInstallerInteraction = _preventsInstallerInteraction;
|
||||
@synthesize httpHeaders = _httpHeaders;
|
||||
@synthesize userAgent = _userAgent;
|
||||
|
||||
- (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater userDriver:(id <SPUUserDriver>)userDriver userInitiated:(BOOL)userInitiated updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate delegate:(id<SPUUIBasedUpdateDriverDelegate>)delegate
|
||||
{
|
||||
@@ -137,6 +141,9 @@
|
||||
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background
|
||||
{
|
||||
self.httpHeaders = httpHeaders;
|
||||
self.userAgent = userAgent;
|
||||
|
||||
[self.coreDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:background requiresSilentInstall:NO];
|
||||
}
|
||||
|
||||
@@ -163,7 +170,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem *)secondaryUpdateItem
|
||||
- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem
|
||||
{
|
||||
if (self.userInitiated) {
|
||||
[SPUSkippedUpdate clearSkippedUpdateForHost:self.host];
|
||||
@@ -260,7 +267,7 @@
|
||||
if (updateItem.releaseNotesURL != nil && (![updaterDelegate respondsToSelector:@selector(updaterShouldDownloadReleaseNotes:)] || [updaterDelegate updaterShouldDownloadReleaseNotes:self.updater])) {
|
||||
|
||||
__weak __typeof__(self) weakSelf = self;
|
||||
self.releaseNotesDriver = [[SPUReleaseNotesDriver alloc] initWithReleaseNotesURL:updateItem.releaseNotesURL host:self.host completionHandler:^(SPUDownloadData * _Nullable downloadData, NSError * _Nullable error) {
|
||||
self.releaseNotesDriver = [[SPUReleaseNotesDriver alloc] initWithReleaseNotesURL:updateItem.releaseNotesURL httpHeaders:self.httpHeaders userAgent:self.userAgent host:self.host completionHandler:^(SPUDownloadData * _Nullable downloadData, NSError * _Nullable error) {
|
||||
__typeof__(self) strongSelf = weakSelf;
|
||||
id <SPUUserDriver> userDriver = strongSelf.userDriver;
|
||||
if (downloadData != nil) {
|
||||
|
||||
Vendored
+1
-1
@@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (void)didFailToFetchAppcastWithError:(NSError *)error;
|
||||
- (void)didFinishLoadingAppcast:(SUAppcast *)appcast;
|
||||
- (void)didFindValidUpdateWithAppcastItem:(SUAppcastItem *)appcastItem secondaryAppcastItem:(SUAppcastItem *)secondaryAppcastItem;
|
||||
- (void)didFindValidUpdateWithAppcastItem:(SUAppcastItem *)appcastItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryAppcastItem;
|
||||
- (void)didNotFindUpdateWithLatestAppcastItem:(nullable SUAppcastItem *)latestAppcastItem hostToLatestAppcastItemComparisonResult:(NSComparisonResult)hostToLatestAppcastItemComparisonResult;
|
||||
|
||||
@end
|
||||
|
||||
Vendored
+3
-3
@@ -278,13 +278,13 @@ static NSString *SUAppcastItemStateKey = @"SUAppcastItemState";
|
||||
}
|
||||
}
|
||||
|
||||
// Used for making delta items
|
||||
// Initializer used for making delta items
|
||||
- (nullable instancetype)initWithDictionary:(NSDictionary *)dict relativeToURL:(NSURL * _Nullable)appcastURL state:(SPUAppcastItemState * _Nullable)state
|
||||
{
|
||||
return [self initWithDictionary:dict relativeToURL:nil stateResolver:nil resolvedState:state failureReason:nil];
|
||||
}
|
||||
|
||||
// Deprecated
|
||||
// Exported public initializer
|
||||
- (nullable instancetype)initWithDictionary:(NSDictionary *)dict relativeToURL:(NSURL * _Nullable)appcastURL stateResolver:(SPUAppcastItemStateResolver *)stateResolver failureReason:(NSString *__autoreleasing *)error
|
||||
{
|
||||
return [self initWithDictionary:dict relativeToURL:appcastURL stateResolver:stateResolver resolvedState:nil failureReason:error];
|
||||
@@ -297,7 +297,7 @@ static NSString *SUAppcastItemStateKey = @"SUAppcastItemState";
|
||||
}
|
||||
|
||||
// Deprecated
|
||||
- (instancetype)initWithDictionary:(NSDictionary *)dict failureReason:(NSString *__autoreleasing *)error
|
||||
- (nullable instancetype)initWithDictionary:(NSDictionary *)dict failureReason:(NSString *__autoreleasing *)error
|
||||
{
|
||||
return [self initWithDictionary:dict relativeToURL:nil stateResolver:nil resolvedState:nil failureReason:error];
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -93,12 +93,12 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
return [self isValidVersion:[self _version]];
|
||||
}
|
||||
|
||||
- (BOOL)isValidVersion:(NSString *)version
|
||||
- (BOOL)isValidVersion:(NSString * _Nullable)version
|
||||
{
|
||||
return (version != nil && version.length != 0);
|
||||
}
|
||||
|
||||
- (NSString *)_version
|
||||
- (NSString * _Nullable)_version
|
||||
{
|
||||
NSString *version = [self objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey];
|
||||
return ([self isValidVersion:version] ? version : nil);
|
||||
|
||||
Reference in new issue
Block a user