Skip to content

Commit

Permalink
Fix iOS Check, Small code tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
cocojoe committed Dec 11, 2018
1 parent 91fe7e2 commit 512873b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ios/A0Auth0.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ - (void)presentAuthenticationSession:(NSURL *)url {
filteredArrayUsingPredicate:predicate]
firstObject];
NSString *callbackURLScheme = queryItem.value;
RCTResponseSenderBlock callback = self.sessionCallback ? self.sessionCallback : ^void(NSArray *_unused) {};

if (@available(iOS 12.0, *)) {
self.authenticationSession = [[ASWebAuthenticationSession alloc]
initWithURL:url callbackURLScheme:callbackURLScheme
completionHandler:^(NSURL * _Nullable callbackURL,
NSError * _Nullable error) {
RCTResponseSenderBlock callback = self.sessionCallback ? self.sessionCallback : ^void(NSArray *_unused) {};
if ([[error domain] isEqualToString:ASWebAuthenticationSessionErrorDomain]) {
switch ([error code]) {
case SFAuthenticationErrorCanceledLogin:
Expand All @@ -99,12 +99,11 @@ - (void)presentAuthenticationSession:(NSURL *)url {
self.authenticationSession = nil;
}];
[(ASWebAuthenticationSession*) self.authenticationSession start];
} else if (@available(iOS 12.0, *)) {
} else if (@available(iOS 11.0, *)) {
self.authenticationSession = [[SFAuthenticationSession alloc]
initWithURL:url callbackURLScheme:callbackURLScheme
completionHandler:^(NSURL * _Nullable callbackURL,
NSError * _Nullable error) {
RCTResponseSenderBlock callback = self.sessionCallback ? self.sessionCallback : ^void(NSArray *_unused) {};
if ([[error domain] isEqualToString:SFAuthenticationErrorDomain]) {
switch ([error code]) {
case SFAuthenticationErrorCanceledLogin:
Expand Down

0 comments on commit 512873b

Please sign in to comment.