Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 226 lines (184 sloc) 8.6 kB
4cbab7e Changed license to X11
arashpayan authored
1 /*
2 This file is part of Appirater.
3
9305827 Appirater now requires iOS 4
Arash Payan authored
4 Copyright (c) 2012, Arash Payan
4cbab7e Changed license to X11
arashpayan authored
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
15
4cbab7e Changed license to X11
arashpayan authored
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
18
4cbab7e Changed license to X11
arashpayan authored
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
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
34 * Copyright 2012 Arash Payan. All rights reserved.
e119a75 First commit
arashpayan authored
35 */
36
37 #import <Foundation/Foundation.h>
e475e36 added a delegate protocol to let the app know when things happen: ale…
Robert Haining authored
38 #import "AppiraterDelegate.h"
e119a75 First commit
arashpayan authored
39
3d1fc36 *Multitasking aware and can track when the app is brought into the fo…
Arash Payan authored
40 extern NSString *const kAppiraterFirstUseDate;
41 extern NSString *const kAppiraterUseCount;
42 extern NSString *const kAppiraterSignificantEventCount;
e119a75 First commit
arashpayan authored
43 extern NSString *const kAppiraterCurrentVersion;
44 extern NSString *const kAppiraterRatedCurrentVersion;
45 extern NSString *const kAppiraterDeclinedToRate;
9305827 Appirater now requires iOS 4
Arash Payan authored
46 extern NSString *const kAppiraterReminderRequestDate;
e119a75 First commit
arashpayan authored
47
48 /*
644e655 *Improved Russian translation
Arash Payan authored
49 Your localized app's name.
50 */
51 #define APPIRATER_LOCALIZED_APP_NAME [[[NSBundle mainBundle] localizedInfoDictionary] objectForKey:(NSString *)kCFBundleNameKey]
52
e119a75 First commit
arashpayan authored
53 /*
54 Your app's name.
55 */
644e655 *Improved Russian translation
Arash Payan authored
56 #define APPIRATER_APP_NAME APPIRATER_LOCALIZED_APP_NAME ? APPIRATER_LOCALIZED_APP_NAME : [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleNameKey]
e119a75 First commit
arashpayan authored
57
58 /*
59 This is the message your users will see once they've passed the day+launches
60 threshold.
61 */
a351d98 Don't clobber an app's existing Localizable.strings files.
Andy Molloy authored
62 #define APPIRATER_LOCALIZED_MESSAGE NSLocalizedStringFromTable(@"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!", @"AppiraterLocalizable", nil)
9305827 Appirater now requires iOS 4
Arash Payan authored
63 #define APPIRATER_MESSAGE [NSString stringWithFormat:APPIRATER_LOCALIZED_MESSAGE, APPIRATER_APP_NAME]
e119a75 First commit
arashpayan authored
64
65 /*
66 This is the title of the message alert that users will see.
67 */
a351d98 Don't clobber an app's existing Localizable.strings files.
Andy Molloy authored
68 #define APPIRATER_LOCALIZED_MESSAGE_TITLE NSLocalizedStringFromTable(@"Rate %@", @"AppiraterLocalizable", nil)
9305827 Appirater now requires iOS 4
Arash Payan authored
69 #define APPIRATER_MESSAGE_TITLE [NSString stringWithFormat:APPIRATER_LOCALIZED_MESSAGE_TITLE, APPIRATER_APP_NAME]
e119a75 First commit
arashpayan authored
70
71 /*
72 The text of the button that rejects reviewing the app.
73 */
a351d98 Don't clobber an app's existing Localizable.strings files.
Andy Molloy authored
74 #define APPIRATER_CANCEL_BUTTON NSLocalizedStringFromTable(@"No, Thanks", @"AppiraterLocalizable", nil)
e119a75 First commit
arashpayan authored
75
76 /*
77 Text of button that will send user to app review page.
78 */
a351d98 Don't clobber an app's existing Localizable.strings files.
Andy Molloy authored
79 #define APPIRATER_LOCALIZED_RATE_BUTTON NSLocalizedStringFromTable(@"Rate %@", @"AppiraterLocalizable", nil)
9305827 Appirater now requires iOS 4
Arash Payan authored
80 #define APPIRATER_RATE_BUTTON [NSString stringWithFormat:APPIRATER_LOCALIZED_RATE_BUTTON, APPIRATER_APP_NAME]
e119a75 First commit
arashpayan authored
81
82 /*
83 Text for button to remind the user to review later.
84 */
a351d98 Don't clobber an app's existing Localizable.strings files.
Andy Molloy authored
85 #define APPIRATER_RATE_LATER NSLocalizedStringFromTable(@"Remind me later", @"AppiraterLocalizable", nil)
e119a75 First commit
arashpayan authored
86
87 @interface Appirater : NSObject <UIAlertViewDelegate> {
88
cc35e15 @meachware Revised to auto dismiss review alert upon will resign active notifica…
meachware authored
89 UIAlertView *ratingAlert;
e119a75 First commit
arashpayan authored
90 }
91
6fa0954 @hpique Convert to ARC
hpique authored
92 @property(nonatomic, strong) UIAlertView *ratingAlert;
e475e36 added a delegate protocol to let the app know when things happen: ale…
Robert Haining authored
93 @property(nonatomic, weak) NSObject <AppiraterDelegate> *delegate;
cc35e15 @meachware Revised to auto dismiss review alert upon will resign active notifica…
meachware authored
94
3d1fc36 *Multitasking aware and can track when the app is brought into the fo…
Arash Payan authored
95 /*
96 Tells Appirater that the app has launched, and on devices that do NOT
97 support multitasking, the 'uses' count will be incremented. You should
98 call this method at the end of your application delegate's
99 application:didFinishLaunchingWithOptions: method.
100
101 If the app has been used enough to be rated (and enough significant events),
102 you can suppress the rating alert
103 by passing NO for canPromptForRating. The rating alert will simply be postponed
104 until it is called again with YES for canPromptForRating. The rating alert
105 can also be triggered by appEnteredForeground: and userDidSignificantEvent:
106 (as long as you pass YES for canPromptForRating in those methods).
107 */
108 + (void)appLaunched:(BOOL)canPromptForRating;
109
110 /*
111 Tells Appirater that the app was brought to the foreground on multitasking
112 devices. You should call this method from the application delegate's
113 applicationWillEnterForeground: method.
114
115 If the app has been used enough to be rated (and enough significant events),
116 you can suppress the rating alert
117 by passing NO for canPromptForRating. The rating alert will simply be postponed
118 until it is called again with YES for canPromptForRating. The rating alert
119 can also be triggered by appLaunched: and userDidSignificantEvent:
120 (as long as you pass YES for canPromptForRating in those methods).
121 */
122 + (void)appEnteredForeground:(BOOL)canPromptForRating;
123
124 /*
125 Tells Appirater that the user performed a significant event. A significant
126 event is whatever you want it to be. If you're app is used to make VoIP
127 calls, then you might want to call this method whenever the user places
128 a call. If it's a game, you might want to call this whenever the user
129 beats a level boss.
130
131 If the user has performed enough significant events and used the app enough,
132 you can suppress the rating alert by passing NO for canPromptForRating. The
133 rating alert will simply be postponed until it is called again with YES for
134 canPromptForRating. The rating alert can also be triggered by appLaunched:
135 and appEnteredForeground: (as long as you pass YES for canPromptForRating
136 in those methods).
137 */
138 + (void)userDidSignificantEvent:(BOOL)canPromptForRating;
139
c640665 @mmorearty Refactor so there is a new rateApp method to explicitly rate the app.
mmorearty authored
140 /*
141 Tells Appirater to open the App Store page where the user can specify a
142 rating for the app. Also records the fact that this has happened, so the
143 user won't be prompted again to rate the app.
144
145 The only case where you should call this directly is if your app has an
146 explicit "Rate this app" command somewhere. In all other cases, don't worry
147 about calling this -- instead, just call the other functions listed above,
148 and let Appirater handle the bookkeeping of deciding when to ask the user
149 whether to rate the app.
150 */
151 + (void)rateApp;
152
e119a75 First commit
arashpayan authored
153 @end
f452be6 @hpique Mark appLaunched as deprecated
hpique authored
154
96dbd13 @hpique Dynamic configuration
hpique authored
155 @interface Appirater(Configuration)
156
157 /*
158 Set your Apple generated software id here.
159 */
160 + (void) setAppId:(NSString*)appId;
161
162 /*
163 Users will need to have the same version of your app installed for this many
164 days before they will be prompted to rate it.
165 */
166 + (void) setDaysUntilPrompt:(double)value;
167
168 /*
169 An example of a 'use' would be if the user launched the app. Bringing the app
170 into the foreground (on devices that support it) would also be considered
171 a 'use'. You tell Appirater about these events using the two methods:
172 [Appirater appLaunched:]
173 [Appirater appEnteredForeground:]
174
175 Users need to 'use' the same version of the app this many times before
176 before they will be prompted to rate it.
177 */
178 + (void) setUsesUntilPrompt:(NSInteger)value;
179
180 /*
181 A significant event can be anything you want to be in your app. In a
182 telephone app, a significant event might be placing or receiving a call.
183 In a game, it might be beating a level or a boss. This is just another
184 layer of filtering that can be used to make sure that only the most
185 loyal of your users are being prompted to rate you on the app store.
186 If you leave this at a value of -1, then this won't be a criteria
187 used for rating. To tell Appirater that the user has performed
188 a significant event, call the method:
189 [Appirater userDidSignificantEvent:];
190 */
191 + (void) setSignificantEventsUntilPrompt:(NSInteger)value;
192
193
194 /*
195 Once the rating alert is presented to the user, they might select
196 'Remind me later'. This value specifies how long (in days) Appirater
197 will wait before reminding them.
198 */
199 + (void) setTimeBeforeReminding:(double)value;
200
201 /*
202 'YES' will show the Appirater alert everytime. Useful for testing how your message
203 looks and making sure the link to your app's review page works.
204 */
205 + (void) setDebug:(BOOL)debug;
206
e475e36 added a delegate protocol to let the app know when things happen: ale…
Robert Haining authored
207 /*
208 Set the delegate if you want to know when Appirater does something
209 */
210 + (void)setDelegate:(id<AppiraterDelegate>)delegate;
211
96dbd13 @hpique Dynamic configuration
hpique authored
212 @end
213
214
f452be6 @hpique Mark appLaunched as deprecated
hpique authored
215 @interface Appirater(Deprecated)
216
217 /*
218 DEPRECATED: While still functional, it's better to use
219 appLaunched:(BOOL)canPromptForRating instead.
220
221 Calls [Appirater appLaunched:YES]. See appLaunched: for details of functionality.
222 */
223 + (void)appLaunched __attribute__((deprecated));
224
225 @end
Something went wrong with that request. Please try again.