From a227ff9f7a38412f262dcd4b530baae021d38fa0 Mon Sep 17 00:00:00 2001 From: Andreas Linde Date: Tue, 21 Aug 2012 23:54:13 +0200 Subject: [PATCH] Fix disableUpdateManager not working as advertised This bug did not affect the automatic disabling of the module when run from the App Store! That one was and is working as advertised. --- Classes/BITHockeyManager.m | 8 ++++++++ Classes/BITUpdateManager.m | 5 +++++ Classes/BITUpdateManagerPrivate.h | 2 ++ 3 files changed, 15 insertions(+) diff --git a/Classes/BITHockeyManager.m b/Classes/BITHockeyManager.m index a48543f6be..5291041ab6 100644 --- a/Classes/BITHockeyManager.m +++ b/Classes/BITHockeyManager.m @@ -163,6 +163,14 @@ } +- (void)setDisableUpdateManager:(BOOL)disableUpdateManager { + if (_updateManager) { + [_updateManager setDisableUpdateManager:disableUpdateManager]; + } + _disableUpdateManager = disableUpdateManager; +} + + - (void)setUpdateURL:(NSString *)anUpdateURL { // ensure url ends with a trailing slash if (![anUpdateURL hasSuffix:@"/"]) { diff --git a/Classes/BITUpdateManager.m b/Classes/BITUpdateManager.m index d30d3ec12f..c64c8f9926 100644 --- a/Classes/BITUpdateManager.m +++ b/Classes/BITUpdateManager.m @@ -342,6 +342,7 @@ _lastCheck = nil; _uuid = [[self executableUUID] retain]; _sendUsageData = YES; + _disableUpdateManager = NO; // set defaults self.showDirectInstallOption = NO; @@ -494,6 +495,7 @@ - (void)showCheckForUpdateAlert { if (_isAppStoreEnvironment) return; + if ([self isUpdateManagerDisabled]) return; if (!_updateAlertShowing) { if ([self hasNewerMandatoryVersion]) { @@ -762,6 +764,7 @@ - (void)checkForUpdate { if (_isAppStoreEnvironment && !_checkForTracker) return; + if ([self isUpdateManagerDisabled]) return; if ([self expiryDateReached]) return; @@ -884,6 +887,8 @@ // begin the startup process - (void)startManager { + if ([self isUpdateManagerDisabled]) return; + BITHockeyLog(@"INFO: Start UpdateManager"); if ([self expiryDateReached]) return; diff --git a/Classes/BITUpdateManagerPrivate.h b/Classes/BITUpdateManagerPrivate.h index c84b56142d..51726531db 100644 --- a/Classes/BITUpdateManagerPrivate.h +++ b/Classes/BITUpdateManagerPrivate.h @@ -64,6 +64,8 @@ // Contains the tracker config if received from server @property (nonatomic, retain) NSDictionary *trackerConfig; +// used by BITHockeyManager if disable status is changed +@property (nonatomic, getter = isUpdateManagerDisabled) BOOL disableUpdateManager; - (id)initWithAppIdentifier:(NSString *)appIdentifier isAppStoreEnvironemt:(BOOL)isAppStoreEnvironment;