From fac6826c39624fd805b492649dcc3291f735b0e9 Mon Sep 17 00:00:00 2001 From: Christoph Zelazowski Date: Wed, 4 May 2016 21:43:06 -0500 Subject: [PATCH 1/4] Add userRatingCountForCurrentVersion property --- README.md | 4 ++++ iRate/iRate.h | 1 + iRate/iRate.m | 5 +++++ 3 files changed, 10 insertions(+) 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..8e3ae4b7 100644 --- a/iRate/iRate.h +++ b/iRate/iRate.h @@ -154,6 +154,7 @@ typedef NS_ENUM(NSUInteger, iRateErrorCode) @property (nonatomic, assign) NSUInteger usesCount; @property (nonatomic, assign) NSUInteger eventCount; @property (nonatomic, readonly) float usesPerWeek; +@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..d6b4f81f 100644 --- a/iRate/iRate.m +++ b/iRate/iRate.m @@ -766,6 +766,11 @@ - (void)checkForConnectivity error = [NSError errorWithDomain:iRateErrorDomain code:iRateErrorApplicationIsNotLatestVersion userInfo:@{NSLocalizedDescriptionKey: @"Installed app is not the latest version available"}]; } } + + if (self.userRatingCountForCurrentVersion == 0) + { + _userRatingCountForCurrentVersion = [[self valueForKey:@"userRatingCountForCurrentVersion" inJSON:json] integerValue]; + } } else { From 9d15d93152d60fbef4ed350090bbea4669db496b Mon Sep 17 00:00:00 2001 From: Christoph Zelazowski Date: Sat, 13 Aug 2016 22:35:30 -0500 Subject: [PATCH 2/4] Add averageUserRatingForCurrentVersion property --- iRate/iRate.h | 1 + iRate/iRate.m | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/iRate/iRate.h b/iRate/iRate.h index 8e3ae4b7..efa81c2d 100644 --- a/iRate/iRate.h +++ b/iRate/iRate.h @@ -154,6 +154,7 @@ typedef NS_ENUM(NSUInteger, iRateErrorCode) @property (nonatomic, assign) NSUInteger usesCount; @property (nonatomic, assign) NSUInteger eventCount; @property (nonatomic, readonly) float usesPerWeek; +@property (nonatomic, readonly) float averageUserRatingForCurrentVersion; @property (nonatomic, readonly) NSUInteger userRatingCountForCurrentVersion; @property (nonatomic, assign) BOOL declinedThisVersion; @property (nonatomic, readonly) BOOL declinedAnyVersion; diff --git a/iRate/iRate.m b/iRate/iRate.m index d6b4f81f..ef817c99 100644 --- a/iRate/iRate.m +++ b/iRate/iRate.m @@ -771,6 +771,11 @@ - (void)checkForConnectivity { _userRatingCountForCurrentVersion = [[self valueForKey:@"userRatingCountForCurrentVersion" inJSON:json] integerValue]; } + + if (self.averageUserRatingForCurrentVersion == 0.0) + { + _averageUserRatingForCurrentVersion = [[self valueForKey:@"averageUserRatingForCurrentVersion" inJSON:json] floatValue]; + } } else { From 8db6fc90a250726c640ab5ca601b02d1951eb8eb Mon Sep 17 00:00:00 2001 From: Christoph Zelazowski Date: Mon, 10 Apr 2017 22:21:05 -0700 Subject: [PATCH 3/4] Add user rating and count for all versions --- iRate/iRate.h | 2 ++ iRate/iRate.m | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/iRate/iRate.h b/iRate/iRate.h index efa81c2d..b32dc917 100644 --- a/iRate/iRate.h +++ b/iRate/iRate.h @@ -154,6 +154,8 @@ 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; diff --git a/iRate/iRate.m b/iRate/iRate.m index ef817c99..f5451f4e 100644 --- a/iRate/iRate.m +++ b/iRate/iRate.m @@ -767,6 +767,16 @@ - (void)checkForConnectivity } } + 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]; From 7f31379c684832557f9859ca3d97c7ba35ab813d Mon Sep 17 00:00:00 2001 From: Christoph Zelazowski Date: Wed, 6 Sep 2017 21:18:43 -0700 Subject: [PATCH 4/4] Disable iRate launch alert --- iRate/iRate.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/iRate/iRate.m b/iRate/iRate.m index f5451f4e..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; @@ -870,6 +870,7 @@ - (BOOL)showCancelButton - (void)promptForRating { +#if FALSE if (!self.visibleAlert) { NSString *message = self.ratedAnyVersion? self.updateMessage: self.message; @@ -992,6 +993,7 @@ - (void)promptForRating [[NSNotificationCenter defaultCenter] postNotificationName:iRateDidPromptForRating object:nil]; } +#endif } - (void)applicationLaunched