Skip to content

Commit

Permalink
Fixing .hide() on iOS (#570)
Browse files Browse the repository at this point in the history
Fixing hide on iOS
  • Loading branch information
stigi authored Dec 16, 2022
1 parent c19f5e1 commit 0a578c7
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions ios/A0Auth0.m
Original file line number Diff line number Diff line change
Expand Up @@ -191,16 +191,28 @@ - (void)presentAuthenticationSession:(NSURL *)url usingEphemeralSession:(BOOL)ep
- (void)terminateWithError:(id)error dismissing:(BOOL)dismissing animated:(BOOL)animated {
RCTResponseSenderBlock callback = self.sessionCallback ? self.sessionCallback : ^void(NSArray *_unused) {};
if (dismissing) {
[self.last.presentingViewController dismissViewControllerAnimated:animated
completion:^{
if (error) {
callback(@[error, [NSNull null]]);
}
}];
if (self.last.presentingViewController) {
[self.last.presentingViewController dismissViewControllerAnimated:animated
completion:^{
if (error) {
callback(@[error, [NSNull null]]);
}
}];
} else {
if ([self.authenticationSession isKindOfClass:ASWebAuthenticationSession.class]) {
[(ASWebAuthenticationSession *)self.authenticationSession cancel];
} else if ([self.authenticationSession isKindOfClass:SFAuthenticationSession.class]) {
[(SFAuthenticationSession *)self.authenticationSession cancel];
}
if (error) {
callback(@[error, [NSNull null]]);
}
}
} else if (error) {
callback(@[error, [NSNull null]]);
}
self.sessionCallback = nil;
self.authenticationSession = nil;
self.last = nil;
self.closeOnLoad = NO;
}
Expand Down

0 comments on commit 0a578c7

Please sign in to comment.