Skip to content

Commit

Permalink
Added firstVersionRun & lastRunVersion.
Browse files Browse the repository at this point in the history
[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
lhunath committed Mar 8, 2014
1 parent 081c2de commit 9e41ceb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Pearl/PearlConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 8 additions & 1 deletion Pearl/PearlConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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];
}];

Expand Down Expand Up @@ -204,6 +207,10 @@ - (void)forwardInvocation:(NSInvocation *)anInvocation {
}


- (BOOL)firstVersionRun {
return ![self.lastRunVersion isEqualToString:[PearlInfoPlist get].CFBundleVersion];
}

#pragma mark Audio

- (NSString *)firstTrack {
Expand Down

0 comments on commit 9e41ceb

Please sign in to comment.