Skip to content

Commit

Permalink
add Appirater to ask for reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
cdzombak committed Feb 21, 2012
1 parent 6d01297 commit 05dcda8
Show file tree
Hide file tree
Showing 4 changed files with 587 additions and 0 deletions.
14 changes: 14 additions & 0 deletions CAENLabStatus.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
9347848E14F32624009C5703 /* Icon-Small-50.png in Resources */ = {isa = PBXBuildFile; fileRef = 9347848A14F32624009C5703 /* Icon-Small-50.png */; };
9347848F14F32624009C5703 /* Icon-Small.png in Resources */ = {isa = PBXBuildFile; fileRef = 9347848B14F32624009C5703 /* Icon-Small.png */; };
9347849014F32624009C5703 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 9347848C14F32624009C5703 /* [email protected] */; };
9347849314F32953009C5703 /* Appirater.m in Sources */ = {isa = PBXBuildFile; fileRef = 9347849214F32953009C5703 /* Appirater.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
9347849514F329CF009C5703 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9347849414F329CF009C5703 /* CFNetwork.framework */; };
9347849714F329D9009C5703 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9347849614F329D8009C5703 /* SystemConfiguration.framework */; };
93BBAB6B14E83AC000B19049 /* DZCSubLabsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 93BBAB6A14E83AC000B19049 /* DZCSubLabsViewController.m */; };
93BBAB7114E8493300B19049 /* PullRefreshTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 93BBAB7014E8493300B19049 /* PullRefreshTableViewController.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
93BBAB7314E84A1700B19049 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 93BBAB7214E84A1700B19049 /* QuartzCore.framework */; };
Expand Down Expand Up @@ -55,6 +58,10 @@
9347848A14F32624009C5703 /* Icon-Small-50.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-Small-50.png"; sourceTree = "<group>"; };
9347848B14F32624009C5703 /* Icon-Small.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-Small.png"; sourceTree = "<group>"; };
9347848C14F32624009C5703 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
9347849114F32953009C5703 /* Appirater.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Appirater.h; sourceTree = "<group>"; };
9347849214F32953009C5703 /* Appirater.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Appirater.m; sourceTree = "<group>"; };
9347849414F329CF009C5703 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; };
9347849614F329D8009C5703 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
93BBAB6914E83AC000B19049 /* DZCSubLabsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DZCSubLabsViewController.h; sourceTree = "<group>"; };
93BBAB6A14E83AC000B19049 /* DZCSubLabsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DZCSubLabsViewController.m; sourceTree = "<group>"; };
93BBAB6F14E8493200B19049 /* PullRefreshTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PullRefreshTableViewController.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -123,6 +130,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
9347849714F329D9009C5703 /* SystemConfiguration.framework in Frameworks */,
9347849514F329CF009C5703 /* CFNetwork.framework in Frameworks */,
93BBAB7314E84A1700B19049 /* QuartzCore.framework in Frameworks */,
93D9F66414D3997600AD2152 /* UIKit.framework in Frameworks */,
93D9F66614D3997600AD2152 /* Foundation.framework in Frameworks */,
Expand All @@ -136,6 +145,8 @@
93D9F65414D3997600AD2152 = {
isa = PBXGroup;
children = (
9347849614F329D8009C5703 /* SystemConfiguration.framework */,
9347849414F329CF009C5703 /* CFNetwork.framework */,
9347848914F32624009C5703 /* Icon-72.png */,
9347848A14F32624009C5703 /* Icon-Small-50.png */,
9347848B14F32624009C5703 /* Icon-Small.png */,
Expand Down Expand Up @@ -171,6 +182,8 @@
93D9F66914D3997600AD2152 /* CAENLabStatus */ = {
isa = PBXGroup;
children = (
9347849114F32953009C5703 /* Appirater.h */,
9347849214F32953009C5703 /* Appirater.m */,
93D9F67214D3997600AD2152 /* DZCAppDelegate.h */,
93D9F67314D3997600AD2152 /* DZCAppDelegate.m */,
93D9F66A14D3997600AD2152 /* Supporting Files */,
Expand Down Expand Up @@ -398,6 +411,7 @@
93E80C5C14D797F5008850FE /* DZCAboutViewController.m in Sources */,
93BBAB6B14E83AC000B19049 /* DZCSubLabsViewController.m in Sources */,
93BBAB7114E8493300B19049 /* PullRefreshTableViewController.m in Sources */,
9347849314F32953009C5703 /* Appirater.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
203 changes: 203 additions & 0 deletions CAENLabStatus/Appirater.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
/*
This file is part of Appirater.
Copyright (c) 2012, Arash Payan
All rights reserved.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* Appirater.h
* appirater
*
* Created by Arash Payan on 9/5/09.
* http://arashpayan.com
* Copyright 2012 Arash Payan. All rights reserved.
*/

#import <Foundation/Foundation.h>

extern NSString *const kAppiraterFirstUseDate;
extern NSString *const kAppiraterUseCount;
extern NSString *const kAppiraterSignificantEventCount;
extern NSString *const kAppiraterCurrentVersion;
extern NSString *const kAppiraterRatedCurrentVersion;
extern NSString *const kAppiraterDeclinedToRate;
extern NSString *const kAppiraterReminderRequestDate;

/*
Place your Apple generated software id here.
*/
#define APPIRATER_APP_ID 502402955

/*
Your app's name.
*/
#define APPIRATER_APP_NAME [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleNameKey]

/*
This is the message your users will see once they've passed the day+launches
threshold.
*/
#define APPIRATER_LOCALIZED_MESSAGE NSLocalizedString(@"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!", nil)
#define APPIRATER_MESSAGE [NSString stringWithFormat:APPIRATER_LOCALIZED_MESSAGE, APPIRATER_APP_NAME]

/*
This is the title of the message alert that users will see.
*/
#define APPIRATER_LOCALIZED_MESSAGE_TITLE NSLocalizedString(@"Rate %@", nil)
#define APPIRATER_MESSAGE_TITLE [NSString stringWithFormat:APPIRATER_LOCALIZED_MESSAGE_TITLE, APPIRATER_APP_NAME]

/*
The text of the button that rejects reviewing the app.
*/
#define APPIRATER_CANCEL_BUTTON NSLocalizedString(@"No, Thanks", nil)

/*
Text of button that will send user to app review page.
*/
#define APPIRATER_LOCALIZED_RATE_BUTTON NSLocalizedString(@"Rate %@", nil)
#define APPIRATER_RATE_BUTTON [NSString stringWithFormat:APPIRATER_LOCALIZED_RATE_BUTTON, APPIRATER_APP_NAME]

/*
Text for button to remind the user to review later.
*/
#define APPIRATER_RATE_LATER NSLocalizedString(@"Remind me later", nil)

/*
Users will need to have the same version of your app installed for this many
days before they will be prompted to rate it.
*/
#define APPIRATER_DAYS_UNTIL_PROMPT 10 // double

/*
An example of a 'use' would be if the user launched the app. Bringing the app
into the foreground (on devices that support it) would also be considered
a 'use'. You tell Appirater about these events using the two methods:
[Appirater appLaunched:]
[Appirater appEnteredForeground:]
Users need to 'use' the same version of the app this many times before
before they will be prompted to rate it.
*/
#define APPIRATER_USES_UNTIL_PROMPT 15 // integer

/*
A significant event can be anything you want to be in your app. In a
telephone app, a significant event might be placing or receiving a call.
In a game, it might be beating a level or a boss. This is just another
layer of filtering that can be used to make sure that only the most
loyal of your users are being prompted to rate you on the app store.
If you leave this at a value of -1, then this won't be a criteria
used for rating. To tell Appirater that the user has performed
a significant event, call the method:
[Appirater userDidSignificantEvent:];
*/
#define APPIRATER_SIG_EVENTS_UNTIL_PROMPT -1 // integer

/*
Once the rating alert is presented to the user, they might select
'Remind me later'. This value specifies how long (in days) Appirater
will wait before reminding them.
*/
#define APPIRATER_TIME_BEFORE_REMINDING 1 // double

/*
'YES' will show the Appirater alert everytime. Useful for testing how your message
looks and making sure the link to your app's review page works.
*/
#define APPIRATER_DEBUG NO

@interface Appirater : NSObject <UIAlertViewDelegate> {

UIAlertView *ratingAlert;
}

@property(nonatomic, retain) UIAlertView *ratingAlert;

/*
DEPRECATED: While still functional, it's better to use
appLaunched:(BOOL)canPromptForRating instead.
Calls [Appirater appLaunched:YES]. See appLaunched: for details of functionality.
*/
+ (void)appLaunched;

/*
Tells Appirater that the app has launched, and on devices that do NOT
support multitasking, the 'uses' count will be incremented. You should
call this method at the end of your application delegate's
application:didFinishLaunchingWithOptions: method.
If the app has been used enough to be rated (and enough significant events),
you can suppress the rating alert
by passing NO for canPromptForRating. The rating alert will simply be postponed
until it is called again with YES for canPromptForRating. The rating alert
can also be triggered by appEnteredForeground: and userDidSignificantEvent:
(as long as you pass YES for canPromptForRating in those methods).
*/
+ (void)appLaunched:(BOOL)canPromptForRating;

/*
Tells Appirater that the app was brought to the foreground on multitasking
devices. You should call this method from the application delegate's
applicationWillEnterForeground: method.
If the app has been used enough to be rated (and enough significant events),
you can suppress the rating alert
by passing NO for canPromptForRating. The rating alert will simply be postponed
until it is called again with YES for canPromptForRating. The rating alert
can also be triggered by appLaunched: and userDidSignificantEvent:
(as long as you pass YES for canPromptForRating in those methods).
*/
+ (void)appEnteredForeground:(BOOL)canPromptForRating;

/*
Tells Appirater that the user performed a significant event. A significant
event is whatever you want it to be. If you're app is used to make VoIP
calls, then you might want to call this method whenever the user places
a call. If it's a game, you might want to call this whenever the user
beats a level boss.
If the user has performed enough significant events and used the app enough,
you can suppress the rating alert by passing NO for canPromptForRating. The
rating alert will simply be postponed until it is called again with YES for
canPromptForRating. The rating alert can also be triggered by appLaunched:
and appEnteredForeground: (as long as you pass YES for canPromptForRating
in those methods).
*/
+ (void)userDidSignificantEvent:(BOOL)canPromptForRating;

/*
Tells Appirater to open the App Store page where the user can specify a
rating for the app. Also records the fact that this has happened, so the
user won't be prompted again to rate the app.
The only case where you should call this directly is if your app has an
explicit "Rate this app" command somewhere. In all other cases, don't worry
about calling this -- instead, just call the other functions listed above,
and let Appirater handle the bookkeeping of deciding when to ask the user
whether to rate the app.
*/
+ (void)rateApp;

@end
Loading

0 comments on commit 05dcda8

Please sign in to comment.