Skip to content

Commit

Permalink
Merge pull request #31 from Andrew-Tan/OpenToAll
Browse files Browse the repository at this point in the history
Implement handleNotification to ensure compatibility with iOS 10 and earlier
  • Loading branch information
shankari authored Sep 4, 2018
2 parents 10b0305 + e03bc4d commit 27f24b4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
id="edu.berkeley.eecs.emission.cordova.auth"
version="1.3.0">
version="1.3.1">

<name>JWTAuth</name>
<description>Get the user email and associated JWT tokens from both native
Expand Down
10 changes: 9 additions & 1 deletion src/ios/OpenIDAuth.m
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,15 @@ - (nullable OIDAuthState *)getAuthState {

-(void)handleNotification:(NSNotification *)notification
{
[self logMessage:@"OpenIDAuth Error: handleNotification should not be called!"];
// For compatibility with iOS 10 and earlier
NSURL* url = [notification object];
if ([url.scheme isEqualToString:@"emission.auth"]) {
if([self.currentAuthorizationFlow resumeAuthorizationFlowWithURL:url]) {
self.currentAuthorizationFlow = nil;
} else {
[LocalNotificationManager addNotification:[NSString stringWithFormat:@"[iOS Auth] Resuming authorization flow failed with redirect URL: %@", url]];
}
}
}

- (NSString*) getStoredUsername
Expand Down

0 comments on commit 27f24b4

Please sign in to comment.