mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-28 05:14:34 +00:00
commit
87064c9304
16 files changed
+169
-125
No files matched your search
@@ -66,7 +66,6 @@
|
||||
55C14F22136EF86000649790 /* SUStandardVersionComparator.m in Sources */ = {isa = PBXBuildFile; fileRef = 61A225A30D1C4AC000430CCD /* SUStandardVersionComparator.m */; };
|
||||
55C14F23136EF86700649790 /* SUSystemProfiler.m in Sources */ = {isa = PBXBuildFile; fileRef = 61A2279B0D1CEE7600430CCD /* SUSystemProfiler.m */; };
|
||||
55C14F24136EF86F00649790 /* SUPackageInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 618FA5210DAE8E8A0026945C /* SUPackageInstaller.m */; };
|
||||
55C14F2A136EF9A900649790 /* SUWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 61180BC90D64138900B4E0D1 /* SUWindowController.m */; };
|
||||
55C14F32136EFC2400649790 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 55C14F31136EFC2400649790 /* SystemConfiguration.framework */; };
|
||||
55C14F9A136F045400649790 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61B5F8F609C4CEB300B25A18 /* Security.framework */; };
|
||||
55C14FC7136F05E100649790 /* Sparkle.strings in Resources */ = {isa = PBXBuildFile; fileRef = 61AAE8220A321A7F00D8810D /* Sparkle.strings */; };
|
||||
@@ -106,8 +105,6 @@
|
||||
6102FE4B0E07803800F85D09 /* SUDiskImageUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 6102FE490E07803800F85D09 /* SUDiskImageUnarchiver.m */; };
|
||||
611142E910FB1BE5009810AA /* bspatch.h in Headers */ = {isa = PBXBuildFile; fileRef = 611142E810FB1BE5009810AA /* bspatch.h */; };
|
||||
61177A1F0D1112E900749C97 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6117796E0D1112E000749C97 /* IOKit.framework */; };
|
||||
61180BCA0D64138900B4E0D1 /* SUWindowController.h in Headers */ = {isa = PBXBuildFile; fileRef = 61180BC80D64138900B4E0D1 /* SUWindowController.h */; settings = {ATTRIBUTES = (); }; };
|
||||
61180BCB0D64138900B4E0D1 /* SUWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 61180BC90D64138900B4E0D1 /* SUWindowController.m */; };
|
||||
6120721209CC5C4B007FE0F6 /* SUAutomaticUpdateAlert.h in Headers */ = {isa = PBXBuildFile; fileRef = 6120721009CC5C4B007FE0F6 /* SUAutomaticUpdateAlert.h */; settings = {ATTRIBUTES = (); }; };
|
||||
6120721309CC5C4B007FE0F6 /* SUAutomaticUpdateAlert.m in Sources */ = {isa = PBXBuildFile; fileRef = 6120721109CC5C4B007FE0F6 /* SUAutomaticUpdateAlert.m */; };
|
||||
61299A2F09CA2DAB00B7442F /* SUDSAVerifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 61299A2D09CA2DAB00B7442F /* SUDSAVerifier.h */; settings = {ATTRIBUTES = (); }; };
|
||||
@@ -165,6 +162,8 @@
|
||||
61F83F720DBFE140006FDD30 /* SUBasicUpdateDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 61F83F700DBFE137006FDD30 /* SUBasicUpdateDriver.m */; };
|
||||
61F83F740DBFE141006FDD30 /* SUBasicUpdateDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 61F83F6F0DBFE137006FDD30 /* SUBasicUpdateDriver.h */; settings = {ATTRIBUTES = (); }; };
|
||||
61FA52880E2D9EA400EF58AD /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* Sparkle.framework */; settings = {ATTRIBUTES = (Required, ); }; };
|
||||
7205C4311E1215AD00E370AE /* SUUpdatePermissionResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 7205C42F1E1215AD00E370AE /* SUUpdatePermissionResponse.h */; };
|
||||
7205C4321E1215AD00E370AE /* SUUpdatePermissionResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 7205C4301E1215AD00E370AE /* SUUpdatePermissionResponse.m */; };
|
||||
720B16451C66433D006985FB /* SUTestApplicationTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 720B16431C66433D006985FB /* SUTestApplicationTest.swift */; };
|
||||
7210C7681B9A9A1500EB90AC /* SUUnarchiverTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7210C7671B9A9A1500EB90AC /* SUUnarchiverTest.swift */; };
|
||||
721BC2111D1DFF05002BC71E /* SUFileOperationConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 722954C31D04E66F00ECF9CA /* SUFileOperationConstants.m */; };
|
||||
@@ -585,8 +584,6 @@
|
||||
61131A090F846D0A00E97AF6 /* zh_CN */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = zh_CN; path = zh_CN.lproj/Sparkle.strings; sourceTree = "<group>"; };
|
||||
61131A0A0F846D1100E97AF6 /* zh_TW */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = zh_TW; path = zh_TW.lproj/Sparkle.strings; sourceTree = "<group>"; };
|
||||
6117796E0D1112E000749C97 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; };
|
||||
61180BC80D64138900B4E0D1 /* SUWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUWindowController.h; sourceTree = "<group>"; };
|
||||
61180BC90D64138900B4E0D1 /* SUWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUWindowController.m; sourceTree = "<group>"; };
|
||||
611A904210240DD300CC659E /* pl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/Sparkle.strings; sourceTree = "<group>"; };
|
||||
611A904610240DF700CC659E /* ja */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Sparkle.strings; sourceTree = "<group>"; };
|
||||
6120721009CC5C4B007FE0F6 /* SUAutomaticUpdateAlert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUAutomaticUpdateAlert.h; sourceTree = "<group>"; };
|
||||
@@ -680,6 +677,8 @@
|
||||
61F83F6F0DBFE137006FDD30 /* SUBasicUpdateDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUBasicUpdateDriver.h; sourceTree = "<group>"; };
|
||||
61F83F700DBFE137006FDD30 /* SUBasicUpdateDriver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUBasicUpdateDriver.m; sourceTree = "<group>"; };
|
||||
7205C42E1E11A6DA00E370AE /* SUInstallerProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUInstallerProtocol.h; sourceTree = "<group>"; };
|
||||
7205C42F1E1215AD00E370AE /* SUUpdatePermissionResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUUpdatePermissionResponse.h; sourceTree = "<group>"; };
|
||||
7205C4301E1215AD00E370AE /* SUUpdatePermissionResponse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUUpdatePermissionResponse.m; 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; };
|
||||
7210C7671B9A9A1500EB90AC /* SUUnarchiverTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SUUnarchiverTest.swift; sourceTree = "<group>"; };
|
||||
@@ -1093,8 +1092,8 @@
|
||||
61B5FCA109C5228F00B25A18 /* SUUpdateAlert.m */,
|
||||
612DCBAD0D488BC60015DBEA /* SUUpdatePermissionPrompt.h */,
|
||||
612DCBAE0D488BC60015DBEA /* SUUpdatePermissionPrompt.m */,
|
||||
61180BC80D64138900B4E0D1 /* SUWindowController.h */,
|
||||
61180BC90D64138900B4E0D1 /* SUWindowController.m */,
|
||||
7205C42F1E1215AD00E370AE /* SUUpdatePermissionResponse.h */,
|
||||
7205C4301E1215AD00E370AE /* SUUpdatePermissionResponse.m */,
|
||||
);
|
||||
name = "User Interface";
|
||||
sourceTree = "<group>";
|
||||
@@ -1326,8 +1325,8 @@
|
||||
61A354550DF113C70076ECB1 /* SUUserInitiatedUpdateDriver.h in Headers */,
|
||||
61A2259E0D1C495D00430CCD /* SUVersionComparisonProtocol.h in Headers */,
|
||||
3772FEA913DE0B6B00F79537 /* SUVersionDisplayProtocol.h in Headers */,
|
||||
7205C4311E1215AD00E370AE /* SUUpdatePermissionResponse.h in Headers */,
|
||||
722954C41D04E66F00ECF9CA /* SUFileOperationConstants.h in Headers */,
|
||||
61180BCA0D64138900B4E0D1 /* SUWindowController.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -1756,7 +1755,6 @@
|
||||
55C14F22136EF86000649790 /* SUStandardVersionComparator.m in Sources */,
|
||||
55C14F20136EF84300649790 /* SUStatusController.m in Sources */,
|
||||
55C14F23136EF86700649790 /* SUSystemProfiler.m in Sources */,
|
||||
55C14F2A136EF9A900649790 /* SUWindowController.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -1880,9 +1878,9 @@
|
||||
610134740DD250470049ACDF /* SUUpdateDriver.m in Sources */,
|
||||
612DCBB00D488BC60015DBEA /* SUUpdatePermissionPrompt.m in Sources */,
|
||||
72316BE41E0E1C7F0039EFD9 /* SUSystemUpdateInfo.m in Sources */,
|
||||
7205C4321E1215AD00E370AE /* SUUpdatePermissionResponse.m in Sources */,
|
||||
61B5F8EE09C4CE3C00B25A18 /* SUUpdater.m in Sources */,
|
||||
61A354560DF113C70076ECB1 /* SUUserInitiatedUpdateDriver.m in Sources */,
|
||||
61180BCB0D64138900B4E0D1 /* SUWindowController.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
||||
Vendored
+2
-2
@@ -9,7 +9,7 @@
|
||||
#ifndef SUAUTOMATICUPDATEALERT_H
|
||||
#define SUAUTOMATICUPDATEALERT_H
|
||||
|
||||
#import "SUWindowController.h"
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
typedef NS_ENUM(NSInteger, SUAutomaticInstallationChoice) {
|
||||
SUInstallNowChoice,
|
||||
@@ -18,7 +18,7 @@ typedef NS_ENUM(NSInteger, SUAutomaticInstallationChoice) {
|
||||
};
|
||||
|
||||
@class SUAppcastItem, SUHost;
|
||||
@interface SUAutomaticUpdateAlert : SUWindowController
|
||||
@interface SUAutomaticUpdateAlert : NSWindowController
|
||||
|
||||
- (instancetype)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)hostBundle completionBlock:(void (^)(SUAutomaticInstallationChoice))c;
|
||||
- (IBAction)installNow:sender;
|
||||
|
||||
Vendored
+5
-3
@@ -86,7 +86,7 @@
|
||||
|
||||
// If we don't get a comparator from the delegate, use the default comparator
|
||||
if (!comparator) {
|
||||
comparator = [SUStandardVersionComparator defaultComparator];
|
||||
comparator = [[SUStandardVersionComparator alloc] init];
|
||||
}
|
||||
|
||||
return comparator;
|
||||
@@ -120,13 +120,15 @@
|
||||
|
||||
BOOL minimumVersionOK = TRUE;
|
||||
BOOL maximumVersionOK = TRUE;
|
||||
|
||||
id<SUVersionComparison> versionComparator = [[SUStandardVersionComparator alloc] init];
|
||||
|
||||
// Check minimum and maximum System Version
|
||||
if ([ui minimumSystemVersion] != nil && ![[ui minimumSystemVersion] isEqualToString:@""]) {
|
||||
minimumVersionOK = [[SUStandardVersionComparator defaultComparator] compareVersion:[ui minimumSystemVersion] toVersion:[SUOperatingSystem systemVersionString]] != NSOrderedDescending;
|
||||
minimumVersionOK = [versionComparator compareVersion:[ui minimumSystemVersion] toVersion:[SUOperatingSystem systemVersionString]] != NSOrderedDescending;
|
||||
}
|
||||
if ([ui maximumSystemVersion] != nil && ![[ui maximumSystemVersion] isEqualToString:@""]) {
|
||||
maximumVersionOK = [[SUStandardVersionComparator defaultComparator] compareVersion:[ui maximumSystemVersion] toVersion:[SUOperatingSystem systemVersionString]] != NSOrderedAscending;
|
||||
maximumVersionOK = [versionComparator compareVersion:[ui maximumSystemVersion] toVersion:[SUOperatingSystem systemVersionString]] != NSOrderedAscending;
|
||||
}
|
||||
|
||||
return minimumVersionOK && maximumVersionOK;
|
||||
|
||||
Vendored
+1
-1
@@ -194,7 +194,7 @@
|
||||
NSString *hostVersion = [self.host version];
|
||||
NSBundle *bundle = [NSBundle bundleWithPath:self.bundlePath];
|
||||
NSString *updateVersion = [bundle objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey];
|
||||
id<SUVersionComparison> comparator = [SUStandardVersionComparator defaultComparator];
|
||||
id<SUVersionComparison> comparator = [[SUStandardVersionComparator alloc] init];
|
||||
if (!updateVersion || [comparator compareVersion:hostVersion toVersion:updateVersion] == NSOrderedDescending) {
|
||||
if (error != NULL) {
|
||||
NSString *errorMessage = [NSString stringWithFormat:@"For security reasons, updates that downgrade version of the application are not allowed. Refusing to downgrade app from version %@ to %@. Aborting update.", hostVersion, [bundle objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey]];
|
||||
|
||||
+7
@@ -28,8 +28,15 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
*/
|
||||
SU_EXPORT @interface SUStandardVersionComparator : NSObject <SUVersionComparison>
|
||||
|
||||
/*!
|
||||
Initializes a new instance of the standard version comparator.
|
||||
*/
|
||||
- (instancetype)init;
|
||||
|
||||
/*!
|
||||
Returns a singleton instance of the comparator.
|
||||
|
||||
It is usually preferred to alloc/init new a comparator instead.
|
||||
*/
|
||||
+ (SUStandardVersionComparator *)defaultComparator;
|
||||
|
||||
|
||||
+8
-2
@@ -11,12 +11,18 @@
|
||||
|
||||
@implementation SUStandardVersionComparator
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
return [super init];
|
||||
}
|
||||
|
||||
+ (SUStandardVersionComparator *)defaultComparator
|
||||
{
|
||||
static SUStandardVersionComparator *defaultComparator = nil;
|
||||
if (defaultComparator == nil) {
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
defaultComparator = [[SUStandardVersionComparator alloc] init];
|
||||
}
|
||||
});
|
||||
return defaultComparator;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -9,10 +9,10 @@
|
||||
#ifndef SUSTATUSCONTROLLER_H
|
||||
#define SUSTATUSCONTROLLER_H
|
||||
|
||||
#import "SUWindowController.h"
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@class SUHost;
|
||||
@interface SUStatusController : SUWindowController
|
||||
@interface SUStatusController : NSWindowController
|
||||
@property (weak) IBOutlet NSButton *actionButton;
|
||||
@property (weak) IBOutlet NSProgressIndicator *progressBar;
|
||||
@property (weak) IBOutlet NSTextField *statusTextField;
|
||||
|
||||
Vendored
+2
-2
@@ -9,7 +9,7 @@
|
||||
#ifndef SUUPDATEALERT_H
|
||||
#define SUUPDATEALERT_H
|
||||
|
||||
#import "SUWindowController.h"
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "SUVersionDisplayProtocol.h"
|
||||
|
||||
@protocol SUUpdateAlertDelegate;
|
||||
@@ -22,7 +22,7 @@ typedef NS_ENUM(NSInteger, SUUpdateAlertChoice) {
|
||||
};
|
||||
|
||||
@class SUAppcastItem, SUHost;
|
||||
@interface SUUpdateAlert : SUWindowController
|
||||
@interface SUUpdateAlert : NSWindowController
|
||||
|
||||
@property (weak) id<SUVersionDisplay> versionDisplayer;
|
||||
|
||||
|
||||
Vendored
+5
-8
@@ -9,7 +9,7 @@
|
||||
#ifndef SUUPDATEPERMISSIONPROMPT_H
|
||||
#define SUUPDATEPERMISSIONPROMPT_H
|
||||
|
||||
#import "SUWindowController.h"
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
typedef NS_ENUM(NSInteger, SUPermissionPromptResult) {
|
||||
SUAutomaticallyCheck,
|
||||
@@ -18,16 +18,13 @@ typedef NS_ENUM(NSInteger, SUPermissionPromptResult) {
|
||||
|
||||
@protocol SUUpdatePermissionPromptDelegate;
|
||||
|
||||
@class SUHost;
|
||||
@interface SUUpdatePermissionPrompt : SUWindowController
|
||||
@class SUHost, SUUpdatePermissionResponse;
|
||||
@interface SUUpdatePermissionPrompt : NSWindowController
|
||||
|
||||
+ (void)promptWithHost:(SUHost *)host systemProfile:(NSArray *)profile reply:(void (^)(SUUpdatePermissionResponse *))reply;
|
||||
|
||||
+ (void)promptWithHost:(SUHost *)aHost systemProfile:(NSArray *)profile delegate:(id<SUUpdatePermissionPromptDelegate>)d;
|
||||
- (IBAction)toggleMoreInfo:(id)sender;
|
||||
- (IBAction)finishPrompt:(id)sender;
|
||||
@end
|
||||
|
||||
@protocol SUUpdatePermissionPromptDelegate <NSObject>
|
||||
- (void)updatePermissionPromptFinishedWithResult:(SUPermissionPromptResult)result;
|
||||
@end
|
||||
|
||||
#endif
|
||||
Vendored
+11
-11
@@ -7,6 +7,7 @@
|
||||
//
|
||||
|
||||
#import "SUUpdatePermissionPrompt.h"
|
||||
#import "SUUpdatePermissionResponse.h"
|
||||
|
||||
#import "SUHost.h"
|
||||
#import "SUConstants.h"
|
||||
@@ -20,21 +21,22 @@
|
||||
|
||||
@property (strong) SUHost *host;
|
||||
@property (strong) NSArray *systemProfileInformationArray;
|
||||
@property (weak) id<SUUpdatePermissionPromptDelegate> delegate;
|
||||
@property (weak) IBOutlet NSTextField *descriptionTextField;
|
||||
@property (weak) IBOutlet NSView *moreInfoView;
|
||||
@property (weak) IBOutlet NSButton *moreInfoButton;
|
||||
@property (weak) IBOutlet NSTableView *profileTableView;
|
||||
|
||||
@property (nonatomic, readonly) void (^reply)(SUUpdatePermissionResponse *);
|
||||
|
||||
@end
|
||||
|
||||
@implementation SUUpdatePermissionPrompt
|
||||
|
||||
@synthesize reply = _reply;
|
||||
@synthesize isShowingMoreInfo = _isShowingMoreInfo;
|
||||
@synthesize shouldSendProfile = _shouldSendProfile;
|
||||
@synthesize host;
|
||||
@synthesize systemProfileInformationArray;
|
||||
@synthesize delegate;
|
||||
@synthesize descriptionTextField;
|
||||
@synthesize moreInfoView;
|
||||
@synthesize moreInfoButton;
|
||||
@@ -45,13 +47,13 @@
|
||||
return [[self.host objectForInfoDictionaryKey:SUEnableSystemProfilingKey] boolValue];
|
||||
}
|
||||
|
||||
- (instancetype)initWithHost:(SUHost *)aHost systemProfile:(NSArray *)profile delegate:(id<SUUpdatePermissionPromptDelegate>)d
|
||||
- (instancetype)initWithHost:(SUHost *)aHost systemProfile:(NSArray *)profile reply:(void (^)(SUUpdatePermissionResponse *))reply
|
||||
{
|
||||
self = [super initWithWindowNibName:@"SUUpdatePermissionPrompt"];
|
||||
if (self)
|
||||
{
|
||||
_reply = reply;
|
||||
host = aHost;
|
||||
delegate = d;
|
||||
self.isShowingMoreInfo = NO;
|
||||
self.shouldSendProfile = [self shouldAskAboutProfile];
|
||||
systemProfileInformationArray = profile;
|
||||
@@ -60,7 +62,7 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (void)promptWithHost:(SUHost *)aHost systemProfile:(NSArray *)profile delegate:(id<SUUpdatePermissionPromptDelegate>)d
|
||||
+ (void)promptWithHost:(SUHost *)host systemProfile:(NSArray *)profile reply:(void (^)(SUUpdatePermissionResponse *))reply
|
||||
{
|
||||
// If this is a background application we need to focus it in order to bring the prompt
|
||||
// to the user's attention. Otherwise the prompt would be hidden behind other applications and
|
||||
@@ -70,7 +72,7 @@
|
||||
}
|
||||
|
||||
if (![NSApp modalWindow]) { // do not prompt if there is is another modal window on screen
|
||||
SUUpdatePermissionPrompt *prompt = [[[self class] alloc] initWithHost:aHost systemProfile:profile delegate:d];
|
||||
SUUpdatePermissionPrompt *prompt = [[[self class] alloc] initWithHost:host systemProfile:profile reply:reply];
|
||||
NSWindow *window = [prompt window];
|
||||
if (window) {
|
||||
[NSApp runModalForWindow:window];
|
||||
@@ -151,11 +153,9 @@
|
||||
|
||||
- (IBAction)finishPrompt:(id)sender
|
||||
{
|
||||
if (![self.delegate respondsToSelector:@selector(updatePermissionPromptFinishedWithResult:)]) {
|
||||
[NSException raise:@"SUInvalidDelegate" format:@"SUUpdatePermissionPrompt's delegate (%@) doesn't respond to updatePermissionPromptFinishedWithResult:!", self.delegate];
|
||||
}
|
||||
[self.host setBool:self.shouldSendProfile forUserDefaultsKey:SUSendProfileInfoKey];
|
||||
[self.delegate updatePermissionPromptFinishedWithResult:([sender tag] == 1 ? SUAutomaticallyCheck : SUDoNotAutomaticallyCheck)];
|
||||
SUUpdatePermissionResponse *response = [[SUUpdatePermissionResponse alloc] initWithAutomaticUpdateChecks:([sender tag] == 1) sendSystemProfile:self.shouldSendProfile];
|
||||
self.reply(response);
|
||||
|
||||
[[self window] close];
|
||||
[NSApp stopModal];
|
||||
}
|
||||
|
||||
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// SUUpdatePermissionResponse.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Mayur Pawashe on 12/26/16.
|
||||
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
/*!
|
||||
This class represents a response for permission to check updates.
|
||||
*/
|
||||
@interface SUUpdatePermissionResponse : NSObject
|
||||
|
||||
/*!
|
||||
Initializes a new update permission response instance.
|
||||
|
||||
@param automaticUpdateChecks Flag for whether to allow automatic update checks.
|
||||
@param sendSystemProfile Flag for if system profile information should be sent to the server hosting the appcast.
|
||||
*/
|
||||
- (instancetype)initWithAutomaticUpdateChecks:(BOOL)automaticUpdateChecks sendSystemProfile:(BOOL)sendSystemProfile;
|
||||
|
||||
/*!
|
||||
A read-only property indicating whether automatic update checks are allowed or not.
|
||||
*/
|
||||
@property (nonatomic, readonly) BOOL automaticUpdateChecks;
|
||||
|
||||
/*!
|
||||
A read-only property indicating if system profile should be sent or not.
|
||||
*/
|
||||
@property (nonatomic, readonly) BOOL sendSystemProfile;
|
||||
|
||||
@end
|
||||
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// SUUpdatePermissionResponse.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Mayur Pawashe on 12/26/16.
|
||||
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SUUpdatePermissionResponse.h"
|
||||
|
||||
@implementation SUUpdatePermissionResponse
|
||||
|
||||
@synthesize automaticUpdateChecks = _automaticUpdateChecks;
|
||||
@synthesize sendSystemProfile = _sendSystemProfile;
|
||||
|
||||
- (instancetype)initWithAutomaticUpdateChecks:(BOOL)automaticUpdateChecks sendSystemProfile:(BOOL)sendSystemProfile
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
_automaticUpdateChecks = automaticUpdateChecks;
|
||||
_sendSystemProfile = sendSystemProfile;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
Vendored
+10
-6
@@ -11,6 +11,7 @@
|
||||
#import "SUUpdaterPrivate.h"
|
||||
|
||||
#import "SUHost.h"
|
||||
#import "SUUpdatePermissionResponse.h"
|
||||
#import "SUUpdatePermissionPrompt.h"
|
||||
|
||||
#import "SUAutomaticUpdateDriver.h"
|
||||
@@ -32,7 +33,7 @@ NSString *const SUUpdaterWillRestartNotification = @"SUUpdaterWillRestartNotific
|
||||
NSString *const SUUpdaterAppcastItemNotificationKey = @"SUUpdaterAppcastItemNotificationKey";
|
||||
NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotificationKey";
|
||||
|
||||
@interface SUUpdater () <SUUpdaterPrivate, SUUpdatePermissionPromptDelegate>
|
||||
@interface SUUpdater () <SUUpdaterPrivate>
|
||||
@property (strong) NSTimer *checkTimer;
|
||||
@property (strong) NSBundle *sparkleBundle;
|
||||
|
||||
@@ -214,7 +215,11 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
||||
if ([self.delegate respondsToSelector:@selector(feedParametersForUpdater:sendingSystemProfile:)]) {
|
||||
profileInfo = [profileInfo arrayByAddingObjectsFromArray:[self.delegate feedParametersForUpdater:self sendingSystemProfile:YES]];
|
||||
}
|
||||
[SUUpdatePermissionPrompt promptWithHost:self.host systemProfile:profileInfo delegate:self];
|
||||
[SUUpdatePermissionPrompt promptWithHost:self.host systemProfile:profileInfo reply:^(SUUpdatePermissionResponse *response) {
|
||||
[self updatePermissionRequestFinishedWithResponse:response];
|
||||
// Schedule checks, but make sure we ignore the delayed call from KVO
|
||||
[self resetUpdateCycle];
|
||||
}];
|
||||
// We start the update checks and register as observer for changes after the prompt finishes
|
||||
} else {
|
||||
// We check if the user's said they want updates, or they haven't said anything, and the default is set to checking.
|
||||
@@ -222,11 +227,10 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
||||
}
|
||||
}
|
||||
|
||||
- (void)updatePermissionPromptFinishedWithResult:(SUPermissionPromptResult)result
|
||||
- (void)updatePermissionRequestFinishedWithResponse:(SUUpdatePermissionResponse *)response
|
||||
{
|
||||
[self setAutomaticallyChecksForUpdates:(result == SUAutomaticallyCheck)];
|
||||
// Schedule checks, but make sure we ignore the delayed call from KVO
|
||||
[self resetUpdateCycle];
|
||||
[self setAutomaticallyChecksForUpdates:response.automaticUpdateChecks];
|
||||
[self setSendsSystemProfile:response.sendSystemProfile];
|
||||
}
|
||||
|
||||
- (void)updateDriverDidFinish:(NSNotification *)note
|
||||
|
||||
Vendored
-20
@@ -1,20 +0,0 @@
|
||||
//
|
||||
// SUWindowController.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 2/13/08.
|
||||
// Copyright 2008 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef SUWINDOWCONTROLLER_H
|
||||
#define SUWINDOWCONTROLLER_H
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@class SUHost;
|
||||
@interface SUWindowController : NSWindowController
|
||||
// We use this instead of plain old NSWindowController initWithWindowNibName so that we'll be able to find the right path when running in a bundle loaded from another app.
|
||||
- (instancetype)initWithWindowNibName:(NSString *)nibName;
|
||||
@end
|
||||
|
||||
#endif
|
||||
Vendored
-20
@@ -1,20 +0,0 @@
|
||||
//
|
||||
// SUWindowController.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 2/13/08.
|
||||
// Copyright 2008 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SUWindowController.h"
|
||||
#import "SUHost.h"
|
||||
|
||||
@implementation SUWindowController
|
||||
|
||||
- (instancetype)initWithWindowNibName:(NSString *)nibName
|
||||
{
|
||||
self = [super initWithWindowNibName:nibName owner:self];
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -16,63 +16,73 @@
|
||||
|
||||
@implementation SUVersionComparisonTestCase
|
||||
|
||||
#define SUAssertOrder(a, b, c) XCTAssertTrue([[SUStandardVersionComparator defaultComparator] compareVersion:a toVersion:b] == c, @"b should be newer than a!")
|
||||
#define SUAssertAscending(a, b) SUAssertOrder(a, b, NSOrderedAscending)
|
||||
#define SUAssertDescending(a, b) SUAssertOrder(a, b, NSOrderedDescending)
|
||||
#define SUAssertEqual(a, b) SUAssertOrder(a, b, NSOrderedSame)
|
||||
#define SUAssertOrder(comparator, a, b, c) XCTAssertTrue([comparator compareVersion:a toVersion:b] == c, @"b should be newer than a!")
|
||||
#define SUAssertAscending(comparator, a, b) SUAssertOrder(comparator, a, b, NSOrderedAscending)
|
||||
#define SUAssertDescending(comparator, a, b) SUAssertOrder(comparator, a, b, NSOrderedDescending)
|
||||
#define SUAssertEqual(comparator, a, b) SUAssertOrder(comparator, a, b, NSOrderedSame)
|
||||
|
||||
- (void)testNumbers
|
||||
{
|
||||
SUAssertAscending(@"1.0", @"1.1");
|
||||
SUAssertEqual(@"1.0", @"1.0");
|
||||
SUAssertDescending(@"2.0", @"1.1");
|
||||
SUAssertDescending(@"0.1", @"0.0.1");
|
||||
//SUAssertDescending(@".1", @"0.0.1"); Known bug, but I'm not sure I care.
|
||||
SUAssertAscending(@"0.1", @"0.1.2");
|
||||
SUStandardVersionComparator *comparator = [[SUStandardVersionComparator alloc] init];
|
||||
|
||||
SUAssertAscending(comparator, @"1.0", @"1.1");
|
||||
SUAssertEqual(comparator, @"1.0", @"1.0");
|
||||
SUAssertDescending(comparator, @"2.0", @"1.1");
|
||||
SUAssertDescending(comparator, @"0.1", @"0.0.1");
|
||||
//SUAssertDescending(comparator, @".1", @"0.0.1"); Known bug, but I'm not sure I care.
|
||||
SUAssertAscending(comparator, @"0.1", @"0.1.2");
|
||||
}
|
||||
|
||||
- (void)testPrereleases
|
||||
{
|
||||
SUAssertAscending(@"1.5.5", @"1.5.6a1");
|
||||
SUAssertAscending(@"1.1.0b1", @"1.1.0b2");
|
||||
SUAssertAscending(@"1.1.1b2", @"1.1.2b1");
|
||||
SUAssertAscending(@"1.1.1b2", @"1.1.2a1");
|
||||
SUAssertAscending(@"1.0a1", @"1.0b1");
|
||||
SUAssertAscending(@"1.0b1", @"1.0");
|
||||
SUAssertAscending(@"0.9", @"1.0a1");
|
||||
SUAssertAscending(@"1.0b", @"1.0b2");
|
||||
SUAssertAscending(@"1.0b10", @"1.0b11");
|
||||
SUAssertAscending(@"1.0b9", @"1.0b10");
|
||||
SUAssertAscending(@"1.0rc", @"1.0");
|
||||
SUAssertAscending(@"1.0b", @"1.0");
|
||||
SUAssertAscending(@"1.0pre1", @"1.0");
|
||||
SUStandardVersionComparator *comparator = [[SUStandardVersionComparator alloc] init];
|
||||
|
||||
SUAssertAscending(comparator, @"1.5.5", @"1.5.6a1");
|
||||
SUAssertAscending(comparator, @"1.1.0b1", @"1.1.0b2");
|
||||
SUAssertAscending(comparator, @"1.1.1b2", @"1.1.2b1");
|
||||
SUAssertAscending(comparator, @"1.1.1b2", @"1.1.2a1");
|
||||
SUAssertAscending(comparator, @"1.0a1", @"1.0b1");
|
||||
SUAssertAscending(comparator, @"1.0b1", @"1.0");
|
||||
SUAssertAscending(comparator, @"0.9", @"1.0a1");
|
||||
SUAssertAscending(comparator, @"1.0b", @"1.0b2");
|
||||
SUAssertAscending(comparator, @"1.0b10", @"1.0b11");
|
||||
SUAssertAscending(comparator, @"1.0b9", @"1.0b10");
|
||||
SUAssertAscending(comparator, @"1.0rc", @"1.0");
|
||||
SUAssertAscending(comparator, @"1.0b", @"1.0");
|
||||
SUAssertAscending(comparator, @"1.0pre1", @"1.0");
|
||||
}
|
||||
|
||||
- (void)testVersionsWithBuildNumbers
|
||||
{
|
||||
SUAssertAscending(@"1.0 (1234)", @"1.0 (1235)");
|
||||
SUAssertAscending(@"1.0b1 (1234)", @"1.0 (1234)");
|
||||
SUAssertAscending(@"1.0b5 (1234)", @"1.0b5 (1235)");
|
||||
SUAssertAscending(@"1.0b5 (1234)", @"1.0.1b5 (1234)");
|
||||
SUAssertAscending(@"1.0.1b5 (1234)", @"1.0.1b6 (1234)");
|
||||
SUAssertAscending(@"2.0.0.2429", @"2.0.0.2430");
|
||||
SUAssertAscending(@"1.1.1.1818", @"2.0.0.2430");
|
||||
|
||||
SUAssertAscending(@"3.3 (5847)", @"3.3.1b1 (5902)");
|
||||
SUStandardVersionComparator *comparator = [[SUStandardVersionComparator alloc] init];
|
||||
|
||||
SUAssertAscending(comparator, @"1.0 (1234)", @"1.0 (1235)");
|
||||
SUAssertAscending(comparator, @"1.0b1 (1234)", @"1.0 (1234)");
|
||||
SUAssertAscending(comparator, @"1.0b5 (1234)", @"1.0b5 (1235)");
|
||||
SUAssertAscending(comparator, @"1.0b5 (1234)", @"1.0.1b5 (1234)");
|
||||
SUAssertAscending(comparator, @"1.0.1b5 (1234)", @"1.0.1b6 (1234)");
|
||||
SUAssertAscending(comparator, @"2.0.0.2429", @"2.0.0.2430");
|
||||
SUAssertAscending(comparator, @"1.1.1.1818", @"2.0.0.2430");
|
||||
|
||||
SUAssertAscending(comparator, @"3.3 (5847)", @"3.3.1b1 (5902)");
|
||||
}
|
||||
|
||||
- (void)testWordsWithSpaceInFront
|
||||
{
|
||||
// SUAssertAscending(@"1.0 beta", @"1.0");
|
||||
// SUAssertAscending(@"1.0 - beta", @"1.0");
|
||||
// SUAssertAscending(@"1.0 alpha", @"1.0 beta");
|
||||
// SUAssertEqual(@"1.0 - beta", @"1.0beta");
|
||||
// SUAssertEqual(@"1.0 - beta", @"1.0 beta");
|
||||
// SUStandardVersionComparator *comparator = [[SUStandardVersionComparator alloc] init];
|
||||
|
||||
// SUAssertAscending(comparator, @"1.0 beta", @"1.0");
|
||||
// SUAssertAscending(comparator, @"1.0 - beta", @"1.0");
|
||||
// SUAssertAscending(comparator, @"1.0 alpha", @"1.0 beta");
|
||||
// SUAssertEqual(comparator, @"1.0 - beta", @"1.0beta");
|
||||
// SUAssertEqual(comparator, @"1.0 - beta", @"1.0 beta");
|
||||
}
|
||||
|
||||
- (void)testVersionsWithReverseDateBasedNumbers
|
||||
{
|
||||
SUAssertAscending(@"201210251627", @"201211051041");
|
||||
SUStandardVersionComparator *comparator = [[SUStandardVersionComparator alloc] init];
|
||||
|
||||
SUAssertAscending(comparator, @"201210251627", @"201211051041");
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in new issue
Block a user