Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added config option for disabling animation (used in StoreKit views) …

…and delegate methods for showing/hiding the modal StoreKit view.
  • Loading branch information...
commit e1589427d25253c0673800ec00c1827d3f0f1a56 1 parent 5f82bec
@ngreenstein ngreenstein authored
Showing with 17 additions and 5 deletions.
  1. +5 −0 Appirater.h
  2. +10 −4 Appirater.m
  3. +2 −1  AppiraterDelegate.h
View
5 Appirater.h
@@ -214,6 +214,11 @@ extern NSString *const kAppiraterReminderRequestDate;
*/
+ (void)setDelegate:(id<AppiraterDelegate>)delegate;
+/*
+ Set whether or not Appirater uses animation (currently respected when pushing modal StoreKit rating VCs).
+ */
++ (void)setUsesAnimation:(BOOL)animation;
+
@end
View
14 Appirater.m
@@ -55,6 +55,7 @@
static double _timeBeforeReminding = 1;
static BOOL _debug = NO;
static id<AppiraterDelegate> _delegate;
+static BOOL _usesAnimation = TRUE;
static UIStatusBarStyle _statusBarStyle;
@interface Appirater ()
@@ -96,6 +97,9 @@ + (void) setDebug:(BOOL)debug {
+ (void)setDelegate:(id<AppiraterDelegate>)delegate{
_delegate = delegate;
}
++ (void)setUsesAnimation:(BOOL)animation {
+ _usesAnimation = animation;
+}
+ (void)setStatusBarStyle:(UIStatusBarStyle)style {
_statusBarStyle = style;
}
@@ -377,10 +381,11 @@ + (void)rateApp {
NSNumber *appId = [NSNumber numberWithInteger:_appId.integerValue];
[storeViewController loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier:appId} completionBlock:nil];
storeViewController.delegate = self.sharedInstance;
- [[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:storeViewController animated:YES completion:^{
+ [self.sharedInstance.delegate appiraterWillPresentModalView:self.sharedInstance animated:_usesAnimation];
+ [[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:storeViewController animated:_usesAnimation completion:^{
//Temporarily use a black status bar to match the StoreKit view.
[self setStatusBarStyle:[UIApplication sharedApplication].statusBarStyle];
- [[UIApplication sharedApplication]setStatusBarStyle:UIStatusBarStyleBlackOpaque animated:YES];
+ [[UIApplication sharedApplication]setStatusBarStyle:UIStatusBarStyleBlackOpaque animated:_usesAnimation];
}];
//Use the standard openUrl method if StoreKit is unavailable.
@@ -433,9 +438,10 @@ - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)butto
//Close the in-app rating (StoreKit) view and restore the previous status bar style.
- (void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController {
- [[UIApplication sharedApplication]setStatusBarStyle:_statusBarStyle animated:YES];
- [[UIApplication sharedApplication].keyWindow.rootViewController dismissViewControllerAnimated:YES completion:nil];
+ [[UIApplication sharedApplication]setStatusBarStyle:_statusBarStyle animated:_usesAnimation];
+ [[UIApplication sharedApplication].keyWindow.rootViewController dismissViewControllerAnimated:_usesAnimation completion:nil];
[self.class setStatusBarStyle:(UIStatusBarStyle)nil];
+ [self.delegate appiraterDidDismissModalView:self animated:_usesAnimation];
}
@end
View
3  AppiraterDelegate.h
@@ -17,5 +17,6 @@
-(void)appiraterDidDeclineToRate:(Appirater *)appirater;
-(void)appiraterDidOptToRate:(Appirater *)appirater;
-(void)appiraterDidOptToRemindLater:(Appirater *)appirater;
-
+-(void)appiraterWillPresentModalView:(Appirater *)appirater animated:(BOOL)animated;
+-(void)appiraterDidDismissModalView:(Appirater *)appirater animated:(BOOL)animated;
@end
Please sign in to comment.
Something went wrong with that request. Please try again.