Prevent iRate mechanism when handling local notifications
This commit is contained in:
parent
490795ea3d
commit
97500d55ec
|
@ -165,6 +165,7 @@ typedef NS_ENUM(NSUInteger, iRateErrorCode) {
|
|||
- (void)promptIfAllCriteriaMet;
|
||||
- (void)openRatingsPageInAppStore;
|
||||
- (void)logEvent:(BOOL)deferPrompt;
|
||||
- (void)preventPromptAtNextTest;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -128,6 +128,7 @@ static NSString *const iRateMacAppStoreURLFormat = @"macappstore://itunes.apple
|
|||
@property (nonatomic, strong) id visibleAlert;
|
||||
@property (nonatomic, assign) BOOL checkingForPrompt;
|
||||
@property (nonatomic, assign) BOOL checkingForAppStoreID;
|
||||
@property (nonatomic, assign) BOOL shouldPreventPromptAtNextTest;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -224,6 +225,7 @@ static NSString *const iRateMacAppStoreURLFormat = @"macappstore://itunes.apple
|
|||
self.remindPeriod = 1.0f;
|
||||
self.verboseLogging = NO;
|
||||
self.previewMode = NO;
|
||||
self.shouldPreventPromptAtNextTest = NO;
|
||||
|
||||
#if DEBUG
|
||||
|
||||
|
@ -404,6 +406,10 @@ static NSString *const iRateMacAppStoreURLFormat = @"macappstore://itunes.apple
|
|||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
}
|
||||
|
||||
- (void)preventPromptAtNextTest {
|
||||
self.shouldPreventPromptAtNextTest = YES;
|
||||
}
|
||||
|
||||
- (void)incrementUseCount {
|
||||
self.usesCount++;
|
||||
}
|
||||
|
@ -413,6 +419,14 @@ static NSString *const iRateMacAppStoreURLFormat = @"macappstore://itunes.apple
|
|||
}
|
||||
|
||||
- (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?
|
||||
if (self.previewMode) {
|
||||
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 {
|
||||
[AppStoreRating preventPromptAtNextTest];
|
||||
[[PushManager sharedManager] application:application didReceiveLocalNotification:notification];
|
||||
}
|
||||
|
||||
|
|
|
@ -11,5 +11,6 @@
|
|||
@interface AppStoreRating : NSObject
|
||||
|
||||
+ (void)setupRatingLibrary;
|
||||
+ (void)preventPromptAtNextTest;
|
||||
|
||||
@end
|
||||
|
|
|
@ -25,4 +25,8 @@
|
|||
rate.rateButtonLabel = NSLocalizedString(@"RATING_RATE", nil);
|
||||
}
|
||||
|
||||
+ (void)preventPromptAtNextTest {
|
||||
iRate *rate = [iRate sharedInstance];
|
||||
[rate preventPromptAtNextTest];
|
||||
}
|
||||
@end
|
||||
|
|
Loading…
Reference in New Issue