Nextrek
Diff Revisions
376
vs
438
for /iOS/SafariArte/trunk/Pods/RFRateMe/RFRateMe/RFRateMe.m
|
@@ -11,7 +11,7 @@ |
11 |
11 |
|
|
12 |
12 |
|
#define kNumberOfDaysUntilShowAgain 3 |
13 |
13 |
|
#define kAppStoreAddress @"https://itunes.apple.com/" |
14 |
|
- |
#define kAppName @"Safari d'Arte" |
|
14 |
+ |
#define kAppName [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleNameKey] |
15 |
15 |
|
|
16 |
16 |
|
@implementation RFRateMe |
17 |
17 |
|
|
|
@@ -51,8 +51,8 @@ |
51 |
51 |
|
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(kAppName, @"") |
52 |
52 |
|
message:NSLocalizedString(@"RateMessage", nil) |
53 |
53 |
|
delegate:nil |
54 |
|
- |
cancelButtonTitle:NSLocalizedString(@"Never ask me again", @"") |
55 |
|
- |
otherButtonTitles:NSLocalizedString(@"Rate it now", @""),NSLocalizedString(@"Remind me later",@""), nil]; |
|
54 |
+ |
cancelButtonTitle:NSLocalizedString(@"NeverAskMeAgain", @"") |
|
55 |
+ |
otherButtonTitles:NSLocalizedString(@"RateItNow", @""),NSLocalizedString(@"RemindMeLater",@""), nil]; |
56 |
56 |
|
|
57 |
57 |
|
[alertView showWithCompletion:^(UIAlertView *alertView, NSInteger buttonIndex) { |
58 |
58 |
|
|
|
@@ -87,6 +87,45 @@ |
87 |
87 |
|
}]; |
88 |
88 |
|
} |
89 |
89 |
|
|
|
90 |
+ |
|
|
91 |
+ |
+(void)showRateAlertAnyway{ |
|
92 |
+ |
|
|
93 |
+ |
|
|
94 |
+ |
//Show rate alert |
|
95 |
+ |
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(kAppName, @"") |
|
96 |
+ |
message:NSLocalizedString(@"RateMessage", nil) |
|
97 |
+ |
delegate:nil |
|
98 |
+ |
cancelButtonTitle:nil |
|
99 |
+ |
otherButtonTitles:NSLocalizedString(@"RateItNow", @""),NSLocalizedString(@"RemindMeLater",@""), nil]; |
|
100 |
+ |
|
|
101 |
+ |
[alertView showWithCompletion:^(UIAlertView *alertView, NSInteger buttonIndex) { |
|
102 |
+ |
|
|
103 |
+ |
switch (buttonIndex) { |
|
104 |
+ |
|
|
105 |
+ |
case 0: |
|
106 |
+ |
|
|
107 |
+ |
NSLog(@"Rate it now"); |
|
108 |
+ |
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"RateCompleted"]; |
|
109 |
+ |
[[NSUserDefaults standardUserDefaults] synchronize]; |
|
110 |
+ |
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:kAppStoreAddress]]; |
|
111 |
+ |
|
|
112 |
+ |
break; |
|
113 |
+ |
case 1: |
|
114 |
+ |
|
|
115 |
+ |
NSLog(@"Remind me later"); |
|
116 |
+ |
NSDateFormatter *dateFormatter=[[NSDateFormatter alloc] init]; |
|
117 |
+ |
[dateFormatter setDateFormat:@"yyyy-MM-dd"]; |
|
118 |
+ |
NSDate *now = [NSDate date]; |
|
119 |
+ |
[[NSUserDefaults standardUserDefaults] setObject:[dateFormatter stringFromDate:now] forKey:@"StartDate"]; |
|
120 |
+ |
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"RemindMeLater"]; |
|
121 |
+ |
[[NSUserDefaults standardUserDefaults] synchronize]; |
|
122 |
+ |
|
|
123 |
+ |
break; |
|
124 |
+ |
} |
|
125 |
+ |
}]; |
|
126 |
+ |
|
|
127 |
+ |
|
|
128 |
+ |
} |
90 |
129 |
|
+(void)showRateAlertAfterTimesOpened:(int)times { |
91 |
130 |
|
//Thanks @kylnew for feedback and idea! |
92 |
131 |
|
|