mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-28 05:14:34 +00:00
Add delegate as parameter to SUUpdater's initializer
This commit is contained in:
1 parent
efac2acf57
commit
1da4ee961c
3 files changed
+12
-9
No files matched your search
Vendored
+2
-2
@@ -26,11 +26,11 @@
|
||||
*/
|
||||
SU_EXPORT @interface SUUpdater : NSObject
|
||||
|
||||
- (instancetype)initWithHostBundle:(NSBundle *)bundle userDriver:(id <SUUserDriver>)userDriver delegate:(id <SUUpdaterDelegate>)delegate;
|
||||
|
||||
@property (weak) id<SUUpdaterDelegate> delegate;
|
||||
@property (nonatomic, readonly) id<SUUserDriver> userDriver;
|
||||
|
||||
- (instancetype)initWithHostBundle:(NSBundle *)bundle userDriver:(id <SUUserDriver>)userDriver;
|
||||
|
||||
@property (readonly, strong) NSBundle *hostBundle;
|
||||
@property (strong, readonly) NSBundle *sparkleBundle;
|
||||
|
||||
|
||||
Vendored
+3
-1
@@ -53,7 +53,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
@synthesize sparkleBundle;
|
||||
@synthesize decryptionPassword;
|
||||
|
||||
- (instancetype)initWithHostBundle:(NSBundle *)bundle userDriver:(id <SUUserDriver>)userDriver
|
||||
- (instancetype)initWithHostBundle:(NSBundle *)bundle userDriver:(id <SUUserDriver>)userDriver delegate:(id <SUUpdaterDelegate>)theDelegate
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
@@ -68,6 +68,8 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
|
||||
_userDriver = userDriver;
|
||||
|
||||
delegate = theDelegate;
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateDriverDidFinish:) name:SUUpdateDriverFinishedNotification object:nil];
|
||||
|
||||
[self startUpdateCycle];
|
||||
|
||||
Vendored
+7
-6
@@ -33,21 +33,22 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
||||
|
||||
// We don't want the updater to start its updating cycle before the app has finished launching
|
||||
// If this is instantiated in a nib, the runloop may not be ready
|
||||
// Furthermore, this delay allows setting the updater and user driver delegates before the updater initializes
|
||||
[self performSelector:@selector(instantiateUpdater) withObject:nil afterDelay:0];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[self unregisterAsObserver];
|
||||
}
|
||||
|
||||
- (void)instantiateUpdater
|
||||
{
|
||||
NSBundle *hostBundle = [NSBundle mainBundle];
|
||||
id <SUUserDriver> driver = [[SUSparkleUserDriver alloc] initWithHostBundle:hostBundle delegate:nil];
|
||||
self.updater = [[SUUpdater alloc] initWithHostBundle:hostBundle userDriver:driver];
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[self unregisterAsObserver];
|
||||
self.updater = [[SUUpdater alloc] initWithHostBundle:hostBundle userDriver:driver delegate:nil];
|
||||
}
|
||||
|
||||
- (IBAction)checkForUpdates:(id)__unused sender
|
||||
|
||||
Reference in new issue
Block a user