diff --git a/Classes/BITUpdateManager.m b/Classes/BITUpdateManager.m index c64c8f9926..55636bdf1b 100644 --- a/Classes/BITUpdateManager.m +++ b/Classes/BITUpdateManager.m @@ -131,6 +131,17 @@ return nil; } +- (void)didBecomeActiveActions { + if ([self isUpdateManagerDisabled]) return; + + [self checkExpiryDateReached]; + [self startUsage]; + + if (_checkForUpdateOnLaunch) { + [self checkForUpdate]; + } +} + #pragma mark - Expiry - (BOOL)expiryDateReached { @@ -382,8 +393,7 @@ [dnc addObserver:self selector:@selector(startManager) name:BITHockeyNetworkDidBecomeReachableNotification object:nil]; [dnc addObserver:self selector:@selector(stopUsage) name:UIApplicationWillTerminateNotification object:nil]; - [dnc addObserver:self selector:@selector(checkExpiryDateReached) name:UIApplicationDidBecomeActiveNotification object:nil]; - [dnc addObserver:self selector:@selector(startUsage) name:UIApplicationDidBecomeActiveNotification object:nil]; + [dnc addObserver:self selector:@selector(didBecomeActiveActions) name:UIApplicationDidBecomeActiveNotification object:nil]; [dnc addObserver:self selector:@selector(stopUsage) name:UIApplicationWillResignActiveNotification object:nil]; } return self; @@ -1056,18 +1066,6 @@ } } -- (void)setCheckForUpdateOnLaunch:(BOOL)flag { - if (_checkForUpdateOnLaunch != flag) { - _checkForUpdateOnLaunch = flag; - NSNotificationCenter *dnc = [NSNotificationCenter defaultCenter]; - if (flag) { - [dnc addObserver:self selector:@selector(checkForUpdate) name:UIApplicationDidBecomeActiveNotification object:nil]; - } else { - [dnc removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil]; - } - } -} - - (NSString *)currentAppVersion { return _currentAppVersion; }