Skip to content
Newer
Older
100644 220 lines (178 sloc) 8.01 KB
4cbab7e Changed license to X11
arashpayan authored Sep 10, 2009
1 /*
2 This file is part of Appirater.
3
9305827 Appirater now requires iOS 4
Arash Payan authored Feb 19, 2012
4 Copyright (c) 2012, Arash Payan
4cbab7e Changed license to X11
arashpayan authored Sep 10, 2009
5 All rights reserved.
6
7 Permission is hereby granted, free of charge, to any person
8 obtaining a copy of this software and associated documentation
9 files (the "Software"), to deal in the Software without
10 restriction, including without limitation the rights to use,
11 copy, modify, merge, publish, distribute, sublicense, and/or sell
12 copies of the Software, and to permit persons to whom the
13 Software is furnished to do so, subject to the following
14 conditions:
e119a75 First commit
arashpayan authored Sep 7, 2009
15
4cbab7e Changed license to X11
arashpayan authored Sep 10, 2009
16 The above copyright notice and this permission notice shall be
17 included in all copies or substantial portions of the Software.
e119a75 First commit
arashpayan authored Sep 7, 2009
18
4cbab7e Changed license to X11
arashpayan authored Sep 10, 2009
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
21 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
23 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
24 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 OTHER DEALINGS IN THE SOFTWARE.
e119a75 First commit
arashpayan authored Sep 7, 2009
27 */
28 /*
29 * Appirater.h
30 * appirater
31 *
32 * Created by Arash Payan on 9/5/09.
33 * http://arashpayan.com
9305827 Appirater now requires iOS 4
Arash Payan authored Feb 20, 2012
34 * Copyright 2012 Arash Payan. All rights reserved.
e119a75 First commit
arashpayan authored Sep 7, 2009
35 */
36
37 #import <Foundation/Foundation.h>
38
3d1fc36 *Multitasking aware and can track when the app is brought into the fo…
Arash Payan authored Oct 12, 2010
39 extern NSString *const kAppiraterFirstUseDate;
40 extern NSString *const kAppiraterUseCount;
41 extern NSString *const kAppiraterSignificantEventCount;
e119a75 First commit
arashpayan authored Sep 7, 2009
42 extern NSString *const kAppiraterCurrentVersion;
43 extern NSString *const kAppiraterRatedCurrentVersion;
44 extern NSString *const kAppiraterDeclinedToRate;
9305827 Appirater now requires iOS 4
Arash Payan authored Feb 20, 2012
45 extern NSString *const kAppiraterReminderRequestDate;
e119a75 First commit
arashpayan authored Sep 7, 2009
46
47 /*
644e655 *Improved Russian translation
Arash Payan authored Jul 2, 2012
48 Your localized app's name.
49 */
50 #define APPIRATER_LOCALIZED_APP_NAME [[[NSBundle mainBundle] localizedInfoDictionary] objectForKey:(NSString *)kCFBundleNameKey]
51
e119a75 First commit
arashpayan authored Sep 7, 2009
52 /*
53 Your app's name.
54 */
644e655 *Improved Russian translation
Arash Payan authored Jul 2, 2012
55 #define APPIRATER_APP_NAME APPIRATER_LOCALIZED_APP_NAME ? APPIRATER_LOCALIZED_APP_NAME : [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleNameKey]
e119a75 First commit
arashpayan authored Sep 7, 2009
56
57 /*
58 This is the message your users will see once they've passed the day+launches
59 threshold.
60 */
9305827 Appirater now requires iOS 4
Arash Payan authored Feb 20, 2012
61 #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)
62 #define APPIRATER_MESSAGE [NSString stringWithFormat:APPIRATER_LOCALIZED_MESSAGE, APPIRATER_APP_NAME]
e119a75 First commit
arashpayan authored Sep 7, 2009
63
64 /*
65 This is the title of the message alert that users will see.
66 */
9305827 Appirater now requires iOS 4
Arash Payan authored Feb 20, 2012
67 #define APPIRATER_LOCALIZED_MESSAGE_TITLE NSLocalizedString(@"Rate %@", nil)
68 #define APPIRATER_MESSAGE_TITLE [NSString stringWithFormat:APPIRATER_LOCALIZED_MESSAGE_TITLE, APPIRATER_APP_NAME]
e119a75 First commit
arashpayan authored Sep 7, 2009
69
70 /*
71 The text of the button that rejects reviewing the app.
72 */
9305827 Appirater now requires iOS 4
Arash Payan authored Feb 20, 2012
73 #define APPIRATER_CANCEL_BUTTON NSLocalizedString(@"No, Thanks", nil)
e119a75 First commit
arashpayan authored Sep 7, 2009
74
75 /*
76 Text of button that will send user to app review page.
77 */
9305827 Appirater now requires iOS 4
Arash Payan authored Feb 20, 2012
78 #define APPIRATER_LOCALIZED_RATE_BUTTON NSLocalizedString(@"Rate %@", nil)
79 #define APPIRATER_RATE_BUTTON [NSString stringWithFormat:APPIRATER_LOCALIZED_RATE_BUTTON, APPIRATER_APP_NAME]
e119a75 First commit
arashpayan authored Sep 7, 2009
80
81 /*
82 Text for button to remind the user to review later.
83 */
9305827 Appirater now requires iOS 4
Arash Payan authored Feb 20, 2012
84 #define APPIRATER_RATE_LATER NSLocalizedString(@"Remind me later", nil)
e119a75 First commit
arashpayan authored Sep 7, 2009
85
86
87 @interface Appirater : NSObject <UIAlertViewDelegate> {
88
cc35e15 @meachware Revised to auto dismiss review alert upon will resign active notifica…
meachware authored Mar 11, 2011
89 UIAlertView *ratingAlert;
e119a75 First commit
arashpayan authored Sep 7, 2009
90 }
91
6fa0954 @hpique Convert to ARC
hpique authored Aug 31, 2012
92 @property(nonatomic, strong) UIAlertView *ratingAlert;
cc35e15 @meachware Revised to auto dismiss review alert upon will resign active notifica…
meachware authored Mar 11, 2011
93
3d1fc36 *Multitasking aware and can track when the app is brought into the fo…
Arash Payan authored Oct 12, 2010
94 /*
95 Tells Appirater that the app has launched, and on devices that do NOT
96 support multitasking, the 'uses' count will be incremented. You should
97 call this method at the end of your application delegate's
98 application:didFinishLaunchingWithOptions: method.
99
100 If the app has been used enough to be rated (and enough significant events),
101 you can suppress the rating alert
102 by passing NO for canPromptForRating. The rating alert will simply be postponed
103 until it is called again with YES for canPromptForRating. The rating alert
104 can also be triggered by appEnteredForeground: and userDidSignificantEvent:
105 (as long as you pass YES for canPromptForRating in those methods).
106 */
107 + (void)appLaunched:(BOOL)canPromptForRating;
108
109 /*
110 Tells Appirater that the app was brought to the foreground on multitasking
111 devices. You should call this method from the application delegate's
112 applicationWillEnterForeground: method.
113
114 If the app has been used enough to be rated (and enough significant events),
115 you can suppress the rating alert
116 by passing NO for canPromptForRating. The rating alert will simply be postponed
117 until it is called again with YES for canPromptForRating. The rating alert
118 can also be triggered by appLaunched: and userDidSignificantEvent:
119 (as long as you pass YES for canPromptForRating in those methods).
120 */
121 + (void)appEnteredForeground:(BOOL)canPromptForRating;
122
123 /*
124 Tells Appirater that the user performed a significant event. A significant
125 event is whatever you want it to be. If you're app is used to make VoIP
126 calls, then you might want to call this method whenever the user places
127 a call. If it's a game, you might want to call this whenever the user
128 beats a level boss.
129
130 If the user has performed enough significant events and used the app enough,
131 you can suppress the rating alert by passing NO for canPromptForRating. The
132 rating alert will simply be postponed until it is called again with YES for
133 canPromptForRating. The rating alert can also be triggered by appLaunched:
134 and appEnteredForeground: (as long as you pass YES for canPromptForRating
135 in those methods).
136 */
137 + (void)userDidSignificantEvent:(BOOL)canPromptForRating;
138
c640665 @mmorearty Refactor so there is a new rateApp method to explicitly rate the app.
mmorearty authored Apr 20, 2011
139 /*
140 Tells Appirater to open the App Store page where the user can specify a
141 rating for the app. Also records the fact that this has happened, so the
142 user won't be prompted again to rate the app.
143
144 The only case where you should call this directly is if your app has an
145 explicit "Rate this app" command somewhere. In all other cases, don't worry
146 about calling this -- instead, just call the other functions listed above,
147 and let Appirater handle the bookkeeping of deciding when to ask the user
148 whether to rate the app.
149 */
150 + (void)rateApp;
151
e119a75 First commit
arashpayan authored Sep 7, 2009
152 @end
f452be6 @hpique Mark appLaunched as deprecated
hpique authored Aug 31, 2012
153
96dbd13 @hpique Dynamic configuration
hpique authored Aug 31, 2012
154 @interface Appirater(Configuration)
155
156 /*
157 Set your Apple generated software id here.
158 */
159 + (void) setAppId:(NSString*)appId;
160
161 /*
162 Users will need to have the same version of your app installed for this many
163 days before they will be prompted to rate it.
164 */
165 + (void) setDaysUntilPrompt:(double)value;
166
167 /*
168 An example of a 'use' would be if the user launched the app. Bringing the app
169 into the foreground (on devices that support it) would also be considered
170 a 'use'. You tell Appirater about these events using the two methods:
171 [Appirater appLaunched:]
172 [Appirater appEnteredForeground:]
173
174 Users need to 'use' the same version of the app this many times before
175 before they will be prompted to rate it.
176 */
177 + (void) setUsesUntilPrompt:(NSInteger)value;
178
179 /*
180 A significant event can be anything you want to be in your app. In a
181 telephone app, a significant event might be placing or receiving a call.
182 In a game, it might be beating a level or a boss. This is just another
183 layer of filtering that can be used to make sure that only the most
184 loyal of your users are being prompted to rate you on the app store.
185 If you leave this at a value of -1, then this won't be a criteria
186 used for rating. To tell Appirater that the user has performed
187 a significant event, call the method:
188 [Appirater userDidSignificantEvent:];
189 */
190 + (void) setSignificantEventsUntilPrompt:(NSInteger)value;
191
192
193 /*
194 Once the rating alert is presented to the user, they might select
195 'Remind me later'. This value specifies how long (in days) Appirater
196 will wait before reminding them.
197 */
198 + (void) setTimeBeforeReminding:(double)value;
199
200 /*
201 'YES' will show the Appirater alert everytime. Useful for testing how your message
202 looks and making sure the link to your app's review page works.
203 */
204 + (void) setDebug:(BOOL)debug;
205
206 @end
207
208
f452be6 @hpique Mark appLaunched as deprecated
hpique authored Aug 31, 2012
209 @interface Appirater(Deprecated)
210
211 /*
212 DEPRECATED: While still functional, it's better to use
213 appLaunched:(BOOL)canPromptForRating instead.
214
215 Calls [Appirater appLaunched:YES]. See appLaunched: for details of functionality.
216 */
217 + (void)appLaunched __attribute__((deprecated));
218
219 @end
Something went wrong with that request. Please try again.