Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of https://github.com/nicklockwood/iRate

Conflicts:
	iRate/iRate.bundle/es.lproj/Localizable.strings
  • Loading branch information...
commit 5eef4e31a39bfc0127be790c50571d8438a3a018 2 parents 9cd66e5 + 3315db7
@nicklockwood authored
View
2  Examples/Mac Demo/iRateMac-Info.plist
@@ -9,7 +9,7 @@
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
- <string>com.yourcompany.${PRODUCT_NAME:rfc1034identifier}</string>
+ <string>com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
View
1  Examples/Mac Demo/iRateMac.xcodeproj/project.pbxproj
@@ -307,6 +307,7 @@
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = iRateMac_Prefix.pch;
+ GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1";
INFOPLIST_FILE = "iRateMac-Info.plist";
INSTALL_PATH = "$(HOME)/Applications";
PRODUCT_NAME = iRateMac;
View
2  Examples/Mac Demo/iRateMacAppDelegate.m
@@ -21,7 +21,7 @@ + (void)initialize
//but we want to test with an app that's actually on the store
[iRate sharedInstance].applicationBundleID = @"com.charcoaldesign.RainbowBlocksLite";
[iRate sharedInstance].onlyPromptIfLatestVersion = NO;
-
+
//enable preview mode
[iRate sharedInstance].previewMode = YES;
}
View
8 README.md
@@ -82,6 +82,10 @@ This is the minimum number of times the user must launch the app before they are
For some apps, launches are not a good metric for usage. For example the app might be a daemon that runs constantly, or a game where the user can't write an informed review until they've reached a particular level. In this case you can manually log significant events and have the prompt appear after a predetermined number of these events. Like the usesUntilPrompt setting, the prompt will appear only after the specified number of days AND events, however once the day threshold is reached, the prompt will appear if EITHER the event threshold OR uses threshold is reached. This defaults to 10 events.
+ @property (nonatomic, assign) float usesPerWeekForPrompt;
+
+If you are less concerned with the total number of times the app is used, but would prefer to use the *frequency* of times the app is used, you can use the `usesPerWeekForPrompt` property to set a minimum threshold for the number of times the user must launch the app per week (on average) for the prompt to be shown. Note that this is the average since the app was installed, so if the user goes for a long period without running the app, it may throw off the average. The default value is zero.
+
@property (nonatomic, assign) float remindPeriod;
How long the app should wait before reminding a user to rate after they select the "remind me later" option (measured in days). A value of zero means the app will remind the user next launch. Note that this value supersedes the other criteria, so the app won't prompt for a rating during the reminder period, even if a new version is released in the meantime. This defaults to 1 day.
@@ -161,6 +165,10 @@ The number of times the current version of the app has been used (launched).
The number of significant application events that have been recorded since the current version was installed. This is incremented by the logEvent method, but can also be manipulated directly. Check out the *Events Demo* to see how this os used.
+ @property (nonatomic, readonly) float usesPerWeek;
+
+The average number of times per week that the current version of the app has been used (launched).
+
@property (nonatomic, assign) BOOL declinedThisVersion;
This flag indicates whether the user has declined to rate the current version (YES) or not (NO).
View
1  RELEASE NOTES.md
@@ -1,6 +1,7 @@
Version 1.5.4
- Added new localisation system (see README for details)
+- Added usesPerWeekForPrompt setting
- Fixed deprecation warning in iOS 6
- Improved Spanish translation
- Improved German translation
View
5 iRate/iRate.h
@@ -88,7 +88,7 @@ extern NSUInteger const iRateAppStoreGameGenreID;
extern NSString *const iRateErrorDomain;
-//localisation string file keys
+//localisation string keys
static NSString *const iRateMessageTitleKey = @"iRateMessageTitle";
static NSString *const iRateAppMessageKey = @"iRateAppMessage";
static NSString *const iRateGameMessageKey = @"iRateGameMessage";
@@ -135,6 +135,7 @@ iRateErrorCode;
NSUInteger _usesUntilPrompt;
NSUInteger _eventsUntilPrompt;
float _daysUntilPrompt;
+ float _usesPerWeekForPrompt;
float _remindPeriod;
NSString *_messageTitle;
NSString *_message;
@@ -173,6 +174,7 @@ iRateErrorCode;
@property (nonatomic, assign) NSUInteger usesUntilPrompt;
@property (nonatomic, assign) NSUInteger eventsUntilPrompt;
@property (nonatomic, assign) float daysUntilPrompt;
+@property (nonatomic, assign) float usesPerWeekForPrompt;
@property (nonatomic, assign) float remindPeriod;
//message text, you may wish to customise these
@@ -197,6 +199,7 @@ iRateErrorCode;
@property (nonatomic, strong) NSDate *lastReminded;
@property (nonatomic, assign) NSUInteger usesCount;
@property (nonatomic, assign) NSUInteger eventCount;
+@property (nonatomic, readonly) float usesPerWeek;
@property (nonatomic, assign) BOOL declinedThisVersion;
@property (nonatomic, readonly) BOOL declinedAnyVersion;
@property (nonatomic, assign) BOOL ratedThisVersion;
View
25 iRate/iRate.m
@@ -53,6 +53,7 @@
#define SECONDS_IN_A_DAY 86400.0
+#define SECONDS_IN_A_WEEK 604800.0
#define MAC_APP_STORE_REFRESH_DELAY 5.0
#define REQUEST_TIMEOUT 60.0
@@ -79,6 +80,7 @@ @implementation iRate
@synthesize applicationVersion = _applicationVersion;
@synthesize applicationBundleID = _applicationBundleID;
@synthesize daysUntilPrompt = _daysUntilPrompt;
+@synthesize usesPerWeekForPrompt = _usesPerWeekForPrompt;
@synthesize usesUntilPrompt = _usesUntilPrompt;
@synthesize eventsUntilPrompt = _eventsUntilPrompt;
@synthesize remindPeriod = _remindPeriod;
@@ -183,6 +185,7 @@ - (iRate *)init
self.usesUntilPrompt = 10;
self.eventsUntilPrompt = 10;
self.daysUntilPrompt = 10.0f;
+ self.usesPerWeekForPrompt = 0.0f;
self.remindPeriod = 1.0f;
self.verboseLogging = NO;
self.previewMode = NO;
@@ -305,6 +308,11 @@ - (void)setEventCount:(NSUInteger)count
[[NSUserDefaults standardUserDefaults] synchronize];
}
+- (float)usesPerWeek
+{
+ return (float)self.usesCount / ([[NSDate date] timeIntervalSinceDate:self.firstUsed] / SECONDS_IN_A_WEEK);
+}
+
- (BOOL)declinedThisVersion
{
return [[[NSUserDefaults standardUserDefaults] objectForKey:iRateDeclinedVersionKey] isEqualToString:self.applicationVersion];
@@ -411,7 +419,7 @@ - (BOOL)shouldPromptForRating
}
//check for first launch
- else if (self.daysUntilPrompt > 0.0f && self.firstUsed == nil)
+ else if ((self.daysUntilPrompt > 0.0f || self.usesPerWeekForPrompt) && self.firstUsed == nil)
{
if (self.verboseLogging)
{
@@ -425,7 +433,7 @@ - (BOOL)shouldPromptForRating
{
if (self.verboseLogging)
{
- NSLog(@"iRate did not prompt for rating because the last prompt was less than %g days ago", self.daysUntilPrompt);
+ NSLog(@"iRate did not prompt for rating because the app was first used less than %g days ago", self.daysUntilPrompt);
}
return NO;
}
@@ -435,12 +443,21 @@ - (BOOL)shouldPromptForRating
{
if (self.verboseLogging)
{
- NSLog(@"iRate did not prompt for rating because the app has only been used %i/%i times and only %i/%i events have been logged",
- (int)self.usesCount, (int)self.usesUntilPrompt, (int)self.eventCount, (int)self.eventsUntilPrompt);
+ NSLog(@"iRate did not prompt for rating because the app has only been used %i times and only %i events have been logged", (int)self.usesCount, (int)self.eventCount);
}
return NO;
}
+ //check if usage frequency is high enough
+ else if (self.usesPerWeek < self.usesPerWeekForPrompt)
+ {
+ if (self.verboseLogging)
+ {
+ NSLog(@"iRate did not prompt for rating because the app has only been used %g times per week on average since it was installed", self.usesPerWeek);
+ }
+ return NO;
+ }
+
//check if within the reminder period
else if (self.lastReminded != nil && [[NSDate date] timeIntervalSinceDate:self.lastReminded] < self.remindPeriod * SECONDS_IN_A_DAY)
{
Please sign in to comment.
Something went wrong with that request. Please try again.