Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion mParticle-Apple-SDK/Network/MPNetworkCommunication.m
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,9 @@ - (NSNumber *)maxAgeForCache:(nonnull NSString *)cache {
}

- (void)checkResponseCodeToDisableEventLogging:(NSInteger)responseCode {
if (responseCode == HTTPStatusCodeBadRequest || responseCode == HTTPStatusCodeUnauthorized || responseCode == HTTPStatusCodeForbidden) {
NSNumber *currentStatus = [MParticle sharedInstance].stateMachine.attAuthorizationStatus;

if (responseCode == HTTPStatusCodeBadRequest || responseCode == HTTPStatusCodeUnauthorized || responseCode == HTTPStatusCodeForbidden || currentStatus.integerValue == MPATTAuthorizationStatusDenied) {
[MPStateMachine setCanWriteMessagesToDB:NO];
MPILogError(@"API Key appears to be invalid based on server response, disabling event logging to prevent excessive local database growth");
} else {
Expand Down
7 changes: 7 additions & 0 deletions mParticle-Apple-SDK/mParticle.m
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,13 @@ - (void)setATTStatus:(MPATTAuthorizationStatus)status withATTStatusTimestampMill
if (attStatusTimestampMillis != nil) {
[MParticle sharedInstance].stateMachine.attAuthorizationTimestamp = attStatusTimestampMillis;
}

if (status == MPATTAuthorizationStatusDenied) {
[MPStateMachine setCanWriteMessagesToDB:NO];
MPILogError(@"ATT Status is denied, disabling event logging to prevent excessive local database growth");
} else {
[MPStateMachine setCanWriteMessagesToDB:YES];
}
}
}

Expand Down