Permalink
Browse files

Added firstVersionRun & lastVersionRun.

[ADDED]     firstVersionRun: YES if this is the first time the app is running for the current version.
  • Loading branch information...
1 parent 081c2de commit fe7fd61f296fb9fe74216776d092c351b3da8cda @lhunath lhunath committed Mar 8, 2014
Showing with 10 additions and 1 deletion.
  1. +2 −0 Pearl/PearlConfig.h
  2. +8 −1 Pearl/PearlConfig.m
View
@@ -57,6 +57,8 @@ extern NSString *const PearlConfigChangedNotification;
@property(nonatomic, readwrite, retain) NSString *version;
@property(nonatomic, readwrite, retain) NSString *copyright;
@property(nonatomic, readwrite, retain) NSNumber *firstRun;
+@property(nonatomic, readonly) BOOL firstVersionRun;
+@property(nonatomic, readwrite, retain) NSString *lastVersionRun;
@property(nonatomic, readwrite, retain) NSNumber *launchCount;
@property(nonatomic, readwrite, retain) NSNumber *askForReviews;
@property(nonatomic, readwrite, retain) NSNumber *reviewAfterLaunches;
View
@@ -41,7 +41,7 @@ @implementation PearlConfig {
unsigned *_gameRandomCounters;
}
-@dynamic build, version, copyright, firstRun, launchCount, askForReviews, reviewAfterLaunches, reviewInApp, reviewedVersion, iTunesID;
+@dynamic build, version, copyright, firstRun, lastVersionRun, launchCount, askForReviews, reviewAfterLaunches, reviewInApp, reviewedVersion, iTunesID;
@dynamic supportedNotifications, deviceToken;
@dynamic fontSize, largeFontSize, smallFontSize, fontName, fixedFontName, symbolicFontName;
@dynamic shadeColor, transitionDuration;
@@ -65,6 +65,7 @@ - (id)init {
NSStringFromSelector( @selector(version) ) : @"",
NSStringFromSelector( @selector(copyright) ) : @"",
NSStringFromSelector( @selector(firstRun) ) : @YES,
+ NSStringFromSelector( @selector(lastVersionRun) ) : @"",
NSStringFromSelector( @selector(launchCount) ) : @0,
NSStringFromSelector( @selector(askForReviews) ) : @NO,
NSStringFromSelector( @selector(reviewAfterLaunches) ) : @10,
@@ -112,6 +113,7 @@ - (id)init {
#endif
[[NSNotificationCenter defaultCenter] addObserverForName:notification object:nil queue:nil usingBlock:^(NSNotification *note) {
self.firstRun = @NO;
+ self.lastVersionRun = [PearlInfoPlist get].CFBundleVersion;
[[self class] flush];
}];
#if TARGET_OS_IPHONE
@@ -121,6 +123,7 @@ - (id)init {
#endif
[[NSNotificationCenter defaultCenter] addObserverForName:notification object:nil queue:nil usingBlock:^(NSNotification *note) {
self.firstRun = @NO;
+ self.lastVersionRun = [PearlInfoPlist get].CFBundleVersion;
[[self class] flush];
}];
@@ -204,6 +207,10 @@ - (void)forwardInvocation:(NSInvocation *)anInvocation {
}
+- (BOOL)firstVersionRun {
+ return ![self.lastVersionRun isEqualToString:[PearlInfoPlist get].CFBundleVersion];
+}
+
#pragma mark Audio
- (NSString *)firstTrack {

0 comments on commit fe7fd61

Please sign in to comment.