diff --git a/README.md b/README.md index 6176723a..2861a19a 100644 --- a/README.md +++ b/README.md @@ -180,6 +180,10 @@ The number of significant application events that have been recorded since the c The average number of times per week that the current version of the app has been used (launched). + @property (nonatomic, readonly) NSUInteger userRatingCountForCurrentVersion; + +The number of user ratings for the current version, in the country specified by the `appStoreCountry` property. + @property (nonatomic, assign) BOOL declinedThisVersion; This flag indicates whether the user has declined to rate the current version (YES) or not (NO). This is not currently used by the iRate prompting logic, but may be useful for implementing your own logic. diff --git a/iRate/iRate.h b/iRate/iRate.h index b2927697..b32dc917 100644 --- a/iRate/iRate.h +++ b/iRate/iRate.h @@ -154,6 +154,10 @@ typedef NS_ENUM(NSUInteger, iRateErrorCode) @property (nonatomic, assign) NSUInteger usesCount; @property (nonatomic, assign) NSUInteger eventCount; @property (nonatomic, readonly) float usesPerWeek; +@property (nonatomic, readonly) float averageUserRating; +@property (nonatomic, readonly) NSUInteger userRatingCount; +@property (nonatomic, readonly) float averageUserRatingForCurrentVersion; +@property (nonatomic, readonly) NSUInteger userRatingCountForCurrentVersion; @property (nonatomic, assign) BOOL declinedThisVersion; @property (nonatomic, readonly) BOOL declinedAnyVersion; @property (nonatomic, assign) BOOL ratedThisVersion; diff --git a/iRate/iRate.m b/iRate/iRate.m index 4aefae58..49c9ee8e 100644 --- a/iRate/iRate.m +++ b/iRate/iRate.m @@ -209,7 +209,7 @@ - (iRate *)init self.promptForNewVersionIfUserRated = NO; self.onlyPromptIfLatestVersion = YES; self.onlyPromptIfMainWindowIsAvailable = YES; - self.promptAtLaunch = YES; + self.promptAtLaunch = NO; self.usesUntilPrompt = 10; self.eventsUntilPrompt = 10; self.daysUntilPrompt = 10.0; @@ -766,6 +766,26 @@ - (void)checkForConnectivity error = [NSError errorWithDomain:iRateErrorDomain code:iRateErrorApplicationIsNotLatestVersion userInfo:@{NSLocalizedDescriptionKey: @"Installed app is not the latest version available"}]; } } + + if (self.userRatingCount == 0) + { + _userRatingCount = [[self valueForKey:@"userRatingCount" inJSON:json] integerValue]; + } + + if (self.averageUserRating == 0.0) + { + _averageUserRating = [[self valueForKey:@"averageUserRating" inJSON:json] floatValue]; + } + + if (self.userRatingCountForCurrentVersion == 0) + { + _userRatingCountForCurrentVersion = [[self valueForKey:@"userRatingCountForCurrentVersion" inJSON:json] integerValue]; + } + + if (self.averageUserRatingForCurrentVersion == 0.0) + { + _averageUserRatingForCurrentVersion = [[self valueForKey:@"averageUserRatingForCurrentVersion" inJSON:json] floatValue]; + } } else { @@ -850,6 +870,7 @@ - (BOOL)showCancelButton - (void)promptForRating { +#if FALSE if (!self.visibleAlert) { NSString *message = self.ratedAnyVersion? self.updateMessage: self.message; @@ -972,6 +993,7 @@ - (void)promptForRating [[NSNotificationCenter defaultCenter] postNotificationName:iRateDidPromptForRating object:nil]; } +#endif } - (void)applicationLaunched