Prevent iRate mechanism when handling local notifications

pull/1/head
Thomas Guillet 9 years ago committed by Michael Kirk
parent 490795ea3d
commit 97500d55ec

@ -165,6 +165,7 @@ typedef NS_ENUM(NSUInteger, iRateErrorCode) {
- (void)promptIfAllCriteriaMet; - (void)promptIfAllCriteriaMet;
- (void)openRatingsPageInAppStore; - (void)openRatingsPageInAppStore;
- (void)logEvent:(BOOL)deferPrompt; - (void)logEvent:(BOOL)deferPrompt;
- (void)preventPromptAtNextTest;
@end @end

@ -128,6 +128,7 @@ static NSString *const iRateMacAppStoreURLFormat = @"macappstore://itunes.apple
@property (nonatomic, strong) id visibleAlert; @property (nonatomic, strong) id visibleAlert;
@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;
@end @end
@ -224,6 +225,7 @@ static NSString *const iRateMacAppStoreURLFormat = @"macappstore://itunes.apple
self.remindPeriod = 1.0f; self.remindPeriod = 1.0f;
self.verboseLogging = NO; self.verboseLogging = NO;
self.previewMode = NO; self.previewMode = NO;
self.shouldPreventPromptAtNextTest = NO;
#if DEBUG #if DEBUG
@ -404,6 +406,10 @@ static NSString *const iRateMacAppStoreURLFormat = @"macappstore://itunes.apple
[[NSNotificationCenter defaultCenter] removeObserver:self]; [[NSNotificationCenter defaultCenter] removeObserver:self];
} }
- (void)preventPromptAtNextTest {
self.shouldPreventPromptAtNextTest = YES;
}
- (void)incrementUseCount { - (void)incrementUseCount {
self.usesCount++; self.usesCount++;
} }
@ -413,6 +419,14 @@ static NSString *const iRateMacAppStoreURLFormat = @"macappstore://itunes.apple
} }
- (BOOL)shouldPromptForRating { - (BOOL)shouldPromptForRating {
// Avoid potentially inconvenient prompt
if (self.shouldPreventPromptAtNextTest)
{
NSLog(@"iRate did not prompt for rating because it is potentially inconvenient");
self.shouldPreventPromptAtNextTest = NO;
return NO;
}
// preview mode? // preview mode?
if (self.previewMode) { if (self.previewMode) {
NSLog(@"iRate preview mode is enabled - make sure you disable this for release"); NSLog(@"iRate preview mode is enabled - make sure you disable this for release");

@ -332,6 +332,7 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
} }
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification { - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
[AppStoreRating preventPromptAtNextTest];
[[PushManager sharedManager] application:application didReceiveLocalNotification:notification]; [[PushManager sharedManager] application:application didReceiveLocalNotification:notification];
} }

@ -11,5 +11,6 @@
@interface AppStoreRating : NSObject @interface AppStoreRating : NSObject
+ (void)setupRatingLibrary; + (void)setupRatingLibrary;
+ (void)preventPromptAtNextTest;
@end @end

@ -25,4 +25,8 @@
rate.rateButtonLabel = NSLocalizedString(@"RATING_RATE", nil); rate.rateButtonLabel = NSLocalizedString(@"RATING_RATE", nil);
} }
+ (void)preventPromptAtNextTest {
iRate *rate = [iRate sharedInstance];
[rate preventPromptAtNextTest];
}
@end @end

Loading…
Cancel
Save