Skip to content

Commit

Permalink
Extracts resetAuthToken
Browse files Browse the repository at this point in the history
  • Loading branch information
jleandroperez committed Aug 14, 2021
1 parent 82109fb commit 79204f3
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Simperium/Simperium.m
Original file line number Diff line number Diff line change
Expand Up @@ -604,9 +604,8 @@ - (void)signOutAndRemoveLocalData:(BOOL)remove completion:(SimperiumSignoutCompl
[self stopNetworkManagers];

// Clear the token and user
[self.authenticator reset];
self.user = nil;

[self resetAuthToken];

// Reset the network manager and processors; any enqueued tasks will get skipped
self.logoutInProgress = YES;

Expand Down Expand Up @@ -813,8 +812,7 @@ - (void)authenticationDidCreateAccount

- (void)authenticationDidCancel {
[self stopNetworkManagers];
[self.authenticator reset];
self.user.authToken = nil;
[self resetAuthToken];
[self closeAuthViewControllerAnimated:YES];

if ([self.delegate respondsToSelector:@selector(simperiumDidCancelLogin:)]) {
Expand All @@ -840,6 +838,11 @@ - (void)authenticationDidFail {
[self scheduleOpenAuthViewController];
}

- (void)resetAuthToken {
[self.authenticator reset];
self.user = nil;
}

- (BOOL)authenticateIfNecessary {
if (!self.networkEnabled || !self.authenticationEnabled || !self.appID) {
return NO;
Expand Down

0 comments on commit 79204f3

Please # to comment.