Skip to content

Commit

Permalink
address outdated code
Browse files Browse the repository at this point in the history
  • Loading branch information
BrandonStalnaker committed Nov 8, 2024
1 parent 90a9e48 commit 094ceb0
Showing 1 changed file with 3 additions and 38 deletions.
41 changes: 3 additions & 38 deletions mParticle-Apple-SDK/Utils/MPStateMachine.m
Original file line number Diff line number Diff line change
Expand Up @@ -385,43 +385,7 @@ - (NSString *)deviceTokenType {
}

- (NSNumber *)firstSeenInstallation {
if (_firstSeenInstallation != nil) {
return _firstSeenInstallation;
}

MPIUserDefaults *userDefaults = [MPIUserDefaults standardUserDefaults];
NSNumber *firstSeenInstallation = userDefaults[kMPAppFirstSeenInstallationKey];
if (firstSeenInstallation != nil) {
_firstSeenInstallation = firstSeenInstallation;
} else {
[self willChangeValueForKey:@"firstSeenInstallation"];
_firstSeenInstallation = @YES;
[self didChangeValueForKey:@"firstSeenInstallation"];

dispatch_async(dispatch_get_main_queue(), ^{
userDefaults[kMPAppFirstSeenInstallationKey] = self->_firstSeenInstallation;
});
}

return _firstSeenInstallation;
}

- (void)setFirstSeenInstallation:(NSNumber *)firstSeenInstallation {
if (_firstSeenInstallation != nil) {
return;
}

MPIUserDefaults *userDefaults = [MPIUserDefaults standardUserDefaults];
NSNumber *fsi = userDefaults[kMPAppFirstSeenInstallationKey];
if (fsi == nil) {
[self willChangeValueForKey:@"firstSeenInstallation"];
_firstSeenInstallation = firstSeenInstallation;
[self didChangeValueForKey:@"firstSeenInstallation"];

dispatch_async(dispatch_get_main_queue(), ^{
userDefaults[kMPAppFirstSeenInstallationKey] = self->_firstSeenInstallation;
});
}
return _firstSeenInstallation ? @YES : @NO;
}

- (MPInstallationType)installationType {
Expand All @@ -440,6 +404,7 @@ - (MPInstallationType)installationType {
}
} else {
_installationType = MPInstallationTypeKnownInstall;
_firstSeenInstallation = @YES;
}

[self didChangeValueForKey:@"installationType"];
Expand All @@ -452,7 +417,7 @@ - (void)setInstallationType:(MPInstallationType)installationType {
_installationType = installationType;
[self didChangeValueForKey:@"installationType"];

self.firstSeenInstallation = (installationType != MPInstallationTypeKnownUpgrade && installationType != MPInstallationTypeKnownSameVersion) ? @YES : @NO;
_firstSeenInstallation = @(installationType == MPInstallationTypeKnownInstall);
}

#if TARGET_OS_IOS == 1
Expand Down

0 comments on commit 094ceb0

Please sign in to comment.