From 1144f68e9b1f5cd5069f9ca6106f82b692612256 Mon Sep 17 00:00:00 2001 From: Blake Watters Date: Fri, 3 May 2013 14:23:30 -0400 Subject: [PATCH] Avoid showing the user multiple rating alerts --- Appirater.h | 7 ++----- Appirater.m | 5 ++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Appirater.h b/Appirater.h index e3208abf..5a72cc1e 100644 --- a/Appirater.h +++ b/Appirater.h @@ -85,12 +85,9 @@ extern NSString *const kAppiraterReminderRequestDate; */ #define APPIRATER_RATE_LATER NSLocalizedStringFromTable(@"Remind me later", @"AppiraterLocalizable", nil) -@interface Appirater : NSObject { +@interface Appirater : NSObject - UIAlertView *ratingAlert; -} - -@property(nonatomic, strong) UIAlertView *ratingAlert; +@property(nonatomic, weak) UIAlertView *ratingAlert; #if __has_feature(objc_arc_weak) @property(nonatomic, weak) NSObject *delegate; #else diff --git a/Appirater.m b/Appirater.m index 5c1ad5c1..9db227b0 100644 --- a/Appirater.m +++ b/Appirater.m @@ -73,9 +73,7 @@ - (void)incrementUseCount; - (void)hideRatingAlert; @end -@implementation Appirater - -@synthesize ratingAlert; +@implementation Appirater + (void) setAppId:(NSString *)appId { _appId = appId; @@ -164,6 +162,7 @@ + (Appirater*)sharedInstance { } - (void)showRatingAlert { + if (self.ratingAlert) return; // We never want to show multiple alerts to the user UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:APPIRATER_MESSAGE_TITLE message:APPIRATER_MESSAGE delegate:self