User updater driver is now aware about updates being in progress or not

This commit is contained in:
Zorg committed 2016-02-28 22:10:58 -05:00
1 parent 8c769ca9cd
commit 45e6951552
4 files changed
+21

No files matched your search

+2
View File
@@ -15,6 +15,8 @@
- (instancetype)initWithHost:(SUHost *)host handlesTermination:(BOOL)handlesTermination delegate:(id <SUUserUpdaterDriverDelegate>)delegate;
@property (nonatomic, readonly, getter=isUpdateInProgress) BOOL updateInProgress;
- (NSApplicationTerminateReply)sendApplicationTerminationSignal;
@end
+14
View File
@@ -38,6 +38,8 @@
@property (nonatomic, readonly) SUHost *host;
@property (nonatomic, readonly) BOOL handlesTermination;
@property (nonatomic) BOOL updaterInProgress;
@property (nonatomic) NSTimer *checkUpdateTimer;
@property (nonatomic, copy) void (^checkForUpdatesReply)(SUUpdateCheckTimerStatus);
@@ -61,6 +63,7 @@
@synthesize host = _host;
@synthesize handlesTermination = _handlesTermination;
@synthesize delegate = _delegate;
@synthesize updaterInProgress = _updaterInProgress;
@synthesize checkUpdateTimer = _checkUpdateTimer;
@synthesize checkForUpdatesReply = _checkForUpdatesReply;
@synthesize checkingController = _checkingController;
@@ -85,6 +88,15 @@
return self;
}
#pragma mark Is Update Busy?
- (void)showUpdateInProgress:(BOOL)isUpdateInProgress
{
dispatch_async(dispatch_get_main_queue(), ^{
self.updaterInProgress = isUpdateInProgress;
});
}
#pragma mark Check Updates Timer
- (BOOL)isDelegateResponsibleForUpdateChecking
@@ -533,6 +545,8 @@
// Make sure everything we call here does not dispatch async to main queue
// because we are already on the main queue (and I've been bitten in the past by this before)
self.updaterInProgress = NO;
[self _invalidateUpdateCheckTimer];
[self cancelCheckForUpdates];
+3
View File
@@ -165,6 +165,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
if ([note object] == self.driver && [self.driver finished])
{
self.driver = nil;
[self.userUpdaterDriver showUpdateInProgress:NO];
[self updateLastUpdateCheckDate];
[self scheduleNextUpdateCheck];
}
@@ -342,6 +343,8 @@ static void SUCheckForUpdatesInBgReachabilityCheck(__weak SUUpdater *updater, SU
[self scheduleNextUpdateCheck];
return;
}
[self.userUpdaterDriver showUpdateInProgress:YES];
[self checkIfConfiguredProperly];
+2
View File
@@ -56,6 +56,8 @@ typedef NS_ENUM(NSUInteger, SUInstallUpdateStatus) {
@property (nonatomic, readonly, weak) id <SUUserUpdaterDriverDelegate> delegate;
- (void)showUpdateInProgress:(BOOL)isUpdateInProgress;
- (void)startUpdateCheckTimerWithNextTimeInterval:(NSTimeInterval)timeInterval reply:(void (^)(SUUpdateCheckTimerStatus))reply;
- (void)invalidateUpdateCheckTimer;