diff --git a/Libraries/iRate/iRate.h b/Libraries/iRate/iRate.h index eeae1724d..46ac19158 100755 --- a/Libraries/iRate/iRate.h +++ b/Libraries/iRate/iRate.h @@ -162,7 +162,7 @@ typedef NS_ENUM(NSUInteger, iRateErrorCode) { - (BOOL)shouldPromptForRating; - (void)promptForRating; - (void)promptIfNetworkAvailable; -- (void)promptIfAllCriteriaMet; +- (BOOL)promptIfAllCriteriaMet; - (void)openRatingsPageInAppStore; - (void)logEvent:(BOOL)deferPrompt; - (void)preventPromptAtNextTest; diff --git a/Libraries/iRate/iRate.m b/Libraries/iRate/iRate.m index 398fa2c50..47732e37c 100755 --- a/Libraries/iRate/iRate.m +++ b/Libraries/iRate/iRate.m @@ -129,7 +129,7 @@ static NSString *const iRateMacAppStoreURLFormat = @"macappstore://itunes.apple @property (nonatomic, assign) BOOL checkingForPrompt; @property (nonatomic, assign) BOOL checkingForAppStoreID; @property (nonatomic, assign) BOOL shouldPreventPromptAtNextTest; - +@property (nonatomic) BOOL hasPromptedAtLaunch; @property (nonatomic) BOOL hasQueuedSynchronize; @end @@ -792,10 +792,15 @@ static NSString *const iRateMacAppStoreURLFormat = @"macappstore://itunes.apple } } -- (void)promptIfAllCriteriaMet { +- (BOOL)promptIfAllCriteriaMet { + if ([UIApplication sharedApplication].applicationState != UIApplicationStateActive) { + return NO; + } if ([self shouldPromptForRating]) { [self promptIfNetworkAvailable]; + return YES; } + return NO; } - (BOOL)showRemindButton { @@ -972,9 +977,6 @@ static NSString *const iRateMacAppStoreURLFormat = @"macappstore://itunes.apple - (void)applicationWillEnterForeground { if ([UIApplication sharedApplication].applicationState == UIApplicationStateBackground) { [self incrementUseCount]; - if (self.promptAtLaunch) { - [self promptIfAllCriteriaMet]; - } } } @@ -996,6 +998,11 @@ static NSString *const iRateMacAppStoreURLFormat = @"macappstore://itunes.apple [[NSUserDefaults standardUserDefaults] synchronize]; self.hasQueuedSynchronize = NO; } + if (self.promptAtLaunch && !self.hasPromptedAtLaunch) { + if ([self promptIfAllCriteriaMet]) { + self.hasPromptedAtLaunch = YES; + } + } } - (void)openRatingsPageInAppStore {