Skip to content

Commit cceee6f

Browse files
authored
Update RNAppAuth.m (#697)
rename taskId to avoid conflicts with other libraries
1 parent af1fdbe commit cceee6f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

ios/RNAppAuth.m

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ - (dispatch_queue_t)methodQueue
2424
return dispatch_get_main_queue();
2525
}
2626

27-
UIBackgroundTaskIdentifier taskId;
27+
UIBackgroundTaskIdentifier rnAppAuthTaskId;
2828

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

308-
taskId = [UIApplication.sharedApplication beginBackgroundTaskWithExpirationHandler:^{
309-
[UIApplication.sharedApplication endBackgroundTask:taskId];
310-
taskId = UIBackgroundTaskInvalid;
308+
rnAppAuthTaskId = [UIApplication.sharedApplication beginBackgroundTaskWithExpirationHandler:^{
309+
[UIApplication.sharedApplication endBackgroundTask:rnAppAuthTaskId];
310+
rnAppAuthTaskId = UIBackgroundTaskInvalid;
311311
}];
312312

313313
UIViewController *presentingViewController = appDelegate.window.rootViewController.view.window ? appDelegate.window.rootViewController : appDelegate.window.rootViewController.presentedViewController;
@@ -318,8 +318,8 @@ - (void)authorizeWithConfiguration: (OIDServiceConfiguration *) configuration
318318
callback:^(OIDAuthorizationResponse *_Nullable authorizationResponse, NSError *_Nullable error) {
319319
typeof(self) strongSelf = weakSelf;
320320
strongSelf->_currentSession = nil;
321-
[UIApplication.sharedApplication endBackgroundTask:taskId];
322-
taskId = UIBackgroundTaskInvalid;
321+
[UIApplication.sharedApplication endBackgroundTask:rnAppAuthTaskId];
322+
rnAppAuthTaskId = UIBackgroundTaskInvalid;
323323
if (authorizationResponse) {
324324
resolve([self formatAuthorizationResponse:authorizationResponse withCodeVerifier:codeVerifier]);
325325
} else {
@@ -334,8 +334,8 @@ - (void)authorizeWithConfiguration: (OIDServiceConfiguration *) configuration
334334
NSError *_Nullable error) {
335335
typeof(self) strongSelf = weakSelf;
336336
strongSelf->_currentSession = nil;
337-
[UIApplication.sharedApplication endBackgroundTask:taskId];
338-
taskId = UIBackgroundTaskInvalid;
337+
[UIApplication.sharedApplication endBackgroundTask:rnAppAuthTaskId];
338+
rnAppAuthTaskId = UIBackgroundTaskInvalid;
339339
if (authState) {
340340
resolve([self formatResponse:authState.lastTokenResponse
341341
withAuthResponse:authState.lastAuthorizationResponse]);

0 commit comments

Comments
 (0)