Skip to content
Merged
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
16 changes: 8 additions & 8 deletions ios/RNAppAuth.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ - (dispatch_queue_t)methodQueue
return dispatch_get_main_queue();
}

UIBackgroundTaskIdentifier taskId;
UIBackgroundTaskIdentifier rnAppAuthTaskId;

/*! @brief Number of random bytes generated for the @ state.
*/
Expand Down Expand Up @@ -305,9 +305,9 @@ - (void)authorizeWithConfiguration: (OIDServiceConfiguration *) configuration
appDelegate.authorizationFlowManagerDelegate = self;
__weak typeof(self) weakSelf = self;

taskId = [UIApplication.sharedApplication beginBackgroundTaskWithExpirationHandler:^{
[UIApplication.sharedApplication endBackgroundTask:taskId];
taskId = UIBackgroundTaskInvalid;
rnAppAuthTaskId = [UIApplication.sharedApplication beginBackgroundTaskWithExpirationHandler:^{
[UIApplication.sharedApplication endBackgroundTask:rnAppAuthTaskId];
rnAppAuthTaskId = UIBackgroundTaskInvalid;
}];

UIViewController *presentingViewController = appDelegate.window.rootViewController.view.window ? appDelegate.window.rootViewController : appDelegate.window.rootViewController.presentedViewController;
Expand All @@ -318,8 +318,8 @@ - (void)authorizeWithConfiguration: (OIDServiceConfiguration *) configuration
callback:^(OIDAuthorizationResponse *_Nullable authorizationResponse, NSError *_Nullable error) {
typeof(self) strongSelf = weakSelf;
strongSelf->_currentSession = nil;
[UIApplication.sharedApplication endBackgroundTask:taskId];
taskId = UIBackgroundTaskInvalid;
[UIApplication.sharedApplication endBackgroundTask:rnAppAuthTaskId];
rnAppAuthTaskId = UIBackgroundTaskInvalid;
if (authorizationResponse) {
resolve([self formatAuthorizationResponse:authorizationResponse withCodeVerifier:codeVerifier]);
} else {
Expand All @@ -334,8 +334,8 @@ - (void)authorizeWithConfiguration: (OIDServiceConfiguration *) configuration
NSError *_Nullable error) {
typeof(self) strongSelf = weakSelf;
strongSelf->_currentSession = nil;
[UIApplication.sharedApplication endBackgroundTask:taskId];
taskId = UIBackgroundTaskInvalid;
[UIApplication.sharedApplication endBackgroundTask:rnAppAuthTaskId];
rnAppAuthTaskId = UIBackgroundTaskInvalid;
if (authState) {
resolve([self formatResponse:authState.lastTokenResponse
withAuthResponse:authState.lastAuthorizationResponse]);
Expand Down