Merge branch 'charlesmchen/iRateVsDead10cc2'

pull/1/head
Matthew Chen 7 years ago
commit 1de5a7b55e

@ -162,7 +162,7 @@ typedef NS_ENUM(NSUInteger, iRateErrorCode) {
- (BOOL)shouldPromptForRating; - (BOOL)shouldPromptForRating;
- (void)promptForRating; - (void)promptForRating;
- (void)promptIfNetworkAvailable; - (void)promptIfNetworkAvailable;
- (void)promptIfAllCriteriaMet; - (BOOL)promptIfAllCriteriaMet;
- (void)openRatingsPageInAppStore; - (void)openRatingsPageInAppStore;
- (void)logEvent:(BOOL)deferPrompt; - (void)logEvent:(BOOL)deferPrompt;
- (void)preventPromptAtNextTest; - (void)preventPromptAtNextTest;

@ -129,7 +129,7 @@ static NSString *const iRateMacAppStoreURLFormat = @"macappstore://itunes.apple
@property (nonatomic, assign) BOOL checkingForPrompt; @property (nonatomic, assign) BOOL checkingForPrompt;
@property (nonatomic, assign) BOOL checkingForAppStoreID; @property (nonatomic, assign) BOOL checkingForAppStoreID;
@property (nonatomic, assign) BOOL shouldPreventPromptAtNextTest; @property (nonatomic, assign) BOOL shouldPreventPromptAtNextTest;
@property (nonatomic) BOOL hasPromptedAtLaunch;
@property (nonatomic) BOOL hasQueuedSynchronize; @property (nonatomic) BOOL hasQueuedSynchronize;
@end @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]) { if ([self shouldPromptForRating]) {
[self promptIfNetworkAvailable]; [self promptIfNetworkAvailable];
return YES;
} }
return NO;
} }
- (BOOL)showRemindButton { - (BOOL)showRemindButton {
@ -972,9 +977,6 @@ static NSString *const iRateMacAppStoreURLFormat = @"macappstore://itunes.apple
- (void)applicationWillEnterForeground { - (void)applicationWillEnterForeground {
if ([UIApplication sharedApplication].applicationState == UIApplicationStateBackground) { if ([UIApplication sharedApplication].applicationState == UIApplicationStateBackground) {
[self incrementUseCount]; [self incrementUseCount];
if (self.promptAtLaunch) {
[self promptIfAllCriteriaMet];
}
} }
} }
@ -996,6 +998,11 @@ static NSString *const iRateMacAppStoreURLFormat = @"macappstore://itunes.apple
[[NSUserDefaults standardUserDefaults] synchronize]; [[NSUserDefaults standardUserDefaults] synchronize];
self.hasQueuedSynchronize = NO; self.hasQueuedSynchronize = NO;
} }
if (self.promptAtLaunch && !self.hasPromptedAtLaunch) {
if ([self promptIfAllCriteriaMet]) {
self.hasPromptedAtLaunch = YES;
}
}
} }
- (void)openRatingsPageInAppStore { - (void)openRatingsPageInAppStore {

Loading…
Cancel
Save