Permalink
Browse files

Added firstVersionRun & lastRunVersion.

[ADDED]     firstVersionRun: YES if this is the first time the app is running for the current version.
[ADDED]     lastRunVersion: The version that the user was running the last time he used the app.
  • Loading branch information...
1 parent 081c2de commit 9e41cebeba085fce2bbae2592d52bbfd740f9ffb @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 *lastRunVersion;
@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, lastRunVersion, 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(lastRunVersion) ) : @"",
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.lastRunVersion = [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.lastRunVersion = [PearlInfoPlist get].CFBundleVersion;
[[self class] flush];
}];
@@ -204,6 +207,10 @@ - (void)forwardInvocation:(NSInvocation *)anInvocation {
}
+- (BOOL)firstVersionRun {
+ return ![self.lastRunVersion isEqualToString:[PearlInfoPlist get].CFBundleVersion];
+}
+
#pragma mark Audio
- (NSString *)firstTrack {

0 comments on commit 9e41ceb

Please sign in to comment.