Implementing formal protocols for most Sparkle delegates.

This commit is contained in:
C.W. Betts committed 2014-02-02 14:15:28 -07:00
1 parent d34d2853f6
commit d7dbbe4bb9
18 files changed
+37 -56

No files matched your search

+5 -3
View File
@@ -11,6 +11,8 @@
#import "SUWindowController.h"
@protocol SUAutomaticUpdateAlertDelegateProtocol;
typedef enum
{
SUInstallNowChoice,
@@ -21,18 +23,18 @@ typedef enum
@class SUAppcastItem, SUHost;
@interface SUAutomaticUpdateAlert : SUWindowController {
SUAppcastItem *updateItem;
id delegate;
id<SUAutomaticUpdateAlertDelegateProtocol> delegate;
SUHost *host;
}
- (id)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)hostBundle delegate:delegate;
- (id)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)hostBundle delegate:(id<SUAutomaticUpdateAlertDelegateProtocol>)delegate;
- (IBAction)installNow:sender;
- (IBAction)installLater:sender;
- (IBAction)doNotInstall:sender;
@end
@interface NSObject (SUAutomaticUpdateAlertDelegateProtocol)
@protocol SUAutomaticUpdateAlertDelegateProtocol <NSObject>
- (void)automaticUpdateAlert:(SUAutomaticUpdateAlert *)aua finishedWithChoice:(SUAutomaticInstallationChoice)choice;
@end
+1 -1
View File
@@ -12,7 +12,7 @@
@implementation SUAutomaticUpdateAlert
- (id)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)aHost delegate:del;
- (id)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)aHost delegate:(id<SUAutomaticUpdateAlertDelegateProtocol>)del
{
self = [super initWithHost:aHost windowNibName:@"SUAutomaticUpdateAlert"];
if (self)
+1 -2
View File
@@ -12,8 +12,7 @@
#import <Cocoa/Cocoa.h>
#import "SUUnarchiver.h"
@interface SUBinaryDeltaUnarchiver : SUUnarchiver {
}
@interface SUBinaryDeltaUnarchiver : SUUnarchiver
@end
+1 -1
View File
@@ -11,7 +11,7 @@
#import <Cocoa/Cocoa.h>
@interface SUDSAVerifier : NSObject {}
@interface SUDSAVerifier : NSObject
+ (BOOL)validatePath:(NSString *)path withEncodedDSASignature:(NSString *)encodedSignature withPublicDSAKey:(NSString *)pkeyString;
@end
+1 -2
View File
@@ -12,8 +12,7 @@
#import <Cocoa/Cocoa.h>
#import "SUUnarchiver.h"
@interface SUDiskImageUnarchiver : SUUnarchiver {
}
@interface SUDiskImageUnarchiver : SUUnarchiver
@end
+1 -1
View File
@@ -17,11 +17,11 @@
NSString *defaultsDomain;
BOOL usesStandardUserDefaults;
}
@property (retain, readonly) NSBundle *bundle;
+ (NSString *)systemVersionString;
- (id)initWithBundle:(NSBundle *)aBundle;
- (NSBundle *)bundle;
- (NSString *)bundlePath;
- (NSString *)appSupportPath;
- (NSString *)installationPath;
+6 -7
View File
@@ -12,15 +12,19 @@
#import <sys/mount.h> // For statfs for isRunningOnReadOnlyVolume
#import "SULog.h"
@interface SUHost ()
@property (retain, readwrite) NSBundle *bundle;
@end
@implementation SUHost
@synthesize bundle;
- (id)initWithBundle:(NSBundle *)aBundle
{
if ((self = [super init]))
{
if (aBundle == nil) aBundle = [NSBundle mainBundle];
bundle = [aBundle retain];
self.bundle = aBundle;
if (![bundle bundleIdentifier])
SULog(@"Sparkle Error: the bundle being updated at %@ has no CFBundleIdentifier! This will cause preference read/write to not work properly.", bundle);
@@ -37,17 +41,12 @@
- (void)dealloc
{
[defaultsDomain release];
[bundle release];
self.bundle = nil;
[super dealloc];
}
- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@, %@>", [self class], [self bundlePath], [self installationPath]]; }
- (NSBundle *)bundle
{
return bundle;
}
- (NSString *)bundlePath
{
return [bundle bundlePath];
+1 -1
View File
@@ -13,7 +13,7 @@
#import "SUVersionComparisonProtocol.h"
@class SUHost;
@interface SUInstaller : NSObject { }
@interface SUInstaller : NSObject
+ (NSString *) appPathInUpdateFolder:(NSString *)updateFolder forHost:(SUHost *)host;
+ (void) installFromUpdateFolder:(NSString *)updateFolder overHost:(SUHost *)host installationPath:(NSString *)installationPath delegate:delegate synchronously:(BOOL)synchronously versionComparator:(id <SUVersionComparison>)comparator;
+ (void) finishInstallationToPath:(NSString *)installationPath withResult:(BOOL)result host:(SUHost *)host error:(NSError *)error delegate:delegate;
+1 -1
View File
@@ -16,7 +16,7 @@
#import "SUVersionComparisonProtocol.h"
#import "SUPlainInstaller.h"
@interface SUPackageInstaller : SUPlainInstaller { }
@interface SUPackageInstaller : SUPlainInstaller
@end
#endif
+1 -3
View File
@@ -12,9 +12,7 @@
#import <Cocoa/Cocoa.h>
#import "SUUnarchiver.h"
@interface SUPipedUnarchiver : SUUnarchiver {
}
@interface SUPipedUnarchiver : SUUnarchiver
@end
+1 -1
View File
@@ -19,7 +19,7 @@
@class SUHost;
@interface SUPlainInstaller : SUInstaller { }
@interface SUPlainInstaller : SUInstaller
+ (void)performInstallationToPath:(NSString *)installationPath fromPath:(NSString *)path host:(SUHost *)host delegate:delegate synchronously:(BOOL)synchronously versionComparator:(id <SUVersionComparison>)comparator;
@end
+4 -4
View File
@@ -10,21 +10,21 @@
#define SUUNARCHIVER_H
@class SUHost;
@protocol SUUnarchiverDelegate;
@interface SUUnarchiver : NSObject {
id delegate;
id<SUUnarchiverDelegate> delegate;
NSString *archivePath;
SUHost *updateHost;
}
@property (assign)id<SUUnarchiverDelegate> delegate;
+ (SUUnarchiver *)unarchiverForPath:(NSString *)path updatingHost:(SUHost *)host;
- (void)setDelegate:delegate;
- (void)start;
@end
@interface NSObject (SUUnarchiverDelegate)
@protocol SUUnarchiverDelegate <NSObject>
- (void)unarchiver:(SUUnarchiver *)unarchiver extractedLength:(unsigned long)length;
- (void)unarchiverDidFinish:(SUUnarchiver *)unarchiver;
- (void)unarchiverDidFail:(SUUnarchiver *)unarchiver;
+1 -5
View File
@@ -16,6 +16,7 @@
#import "SUUnarchiver_Private.h"
@implementation SUUnarchiver
@synthesize delegate;
+ (SUUnarchiver *)unarchiverForPath:(NSString *)path updatingHost:(SUHost *)host
{
@@ -31,11 +32,6 @@
- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], archivePath]; }
- (void)setDelegate:del
{
delegate = del;
}
- (void)start
{
// No-op
+4 -3
View File
@@ -12,6 +12,7 @@
#import "SUWindowController.h"
#import "SUVersionDisplayProtocol.h"
@protocol SUUpdateAlertDelegate;
typedef enum
{
@@ -25,7 +26,7 @@ typedef enum
@interface SUUpdateAlert : SUWindowController {
SUAppcastItem *updateItem;
SUHost *host;
id delegate;
id<SUUpdateAlertDelegate> delegate;
id<SUVersionDisplay> versionDisplayer;
IBOutlet WebView *releaseNotesView;
@@ -36,9 +37,9 @@ typedef enum
NSProgressIndicator *releaseNotesSpinner;
BOOL webViewFinishedLoading;
}
@property (assign) id<SUUpdateAlertDelegate> delegate;
- (id)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)host;
- (void)setDelegate:delegate;
- (IBAction)installUpdate:sender;
- (IBAction)skipThisVersion:sender;
@@ -48,7 +49,7 @@ typedef enum
@end
@interface NSObject (SUUpdateAlertDelegate)
@protocol SUUpdateAlertDelegate <NSObject>
- (void)updateAlert:(SUUpdateAlert *)updateAlert finishedWithChoice:(SUUpdateAlertChoice)updateChoice;
- (void)updateAlert:(SUUpdateAlert *)updateAlert shouldAllowAutoUpdate: (BOOL*)shouldAllowAutoUpdate;
@end
+2 -6
View File
@@ -18,7 +18,7 @@
#import "SUConstants.h"
@interface WebView (SUTenFiveProperty)
@interface WebView ()
-(void) setDrawsBackground: (BOOL)state;
@@ -26,6 +26,7 @@
@implementation SUUpdateAlert
@synthesize delegate;
- (id)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)aHost
{
@@ -348,9 +349,4 @@
return webViewMenuItems;
}
- (void)setDelegate:del
{
delegate = del;
}
@end
+1 -2
View File
@@ -23,14 +23,13 @@ extern NSString * const SUUpdateDriverFinishedNotification;
BOOL finished;
BOOL isInterruptible;
}
@property (retain) SUHost *host;
- initWithUpdater:(SUUpdater *)updater;
- (void)checkForUpdatesAtURL:(NSURL *)URL host:(SUHost *)host;
- (void)abortUpdate;
- (BOOL)isInterruptible;
- (BOOL)finished;
- (SUHost*)host;
- (void)setHost:(SUHost*)newHost;
@end
+4 -12
View File
@@ -12,6 +12,9 @@
NSString * const SUUpdateDriverFinishedNotification = @"SUUpdateDriverFinished";
@implementation SUUpdateDriver
@synthesize host;
- initWithUpdater:(SUUpdater *)anUpdater
{
if ((self = [super init]))
@@ -39,20 +42,9 @@ NSString * const SUUpdateDriverFinishedNotification = @"SUUpdateDriverFinished";
- (void)dealloc
{
[host release];
self.host = nil;
[appcastURL release];
[super dealloc];
}
- (SUHost*)host
{
return host;
}
- (void)setHost:(SUHost*)newHost
{
[host release];
host = [newHost retain];
}
@end
+1 -1
View File
@@ -28,7 +28,7 @@ NSString *const SUUpdaterWillRelaunchApplicationNotification = @"SUUpdaterWillRe
NSString *const SUUpdaterAppcastItemNotificationKey = @"SUUpdaterAppcastItemNotificationKey";
NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotificationKey";
@interface SUUpdater (Private)
@interface SUUpdater ()
- (id)initForBundle:(NSBundle *)bundle;
- (void)startUpdateCycle;
- (void)checkForUpdatesWithDriver:(SUUpdateDriver *)updateDriver;