From d1cdd1cd59811ee408d75fb171f59fc00df5dfae Mon Sep 17 00:00:00 2001 From: Renato Formato Date: Wed, 29 Dec 2021 11:10:58 +0100 Subject: [PATCH] Update RNAppAuth.m rename taskId to avoid conflicts with other libraries --- ios/RNAppAuth.m | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ios/RNAppAuth.m b/ios/RNAppAuth.m index 3ab8a78aa..fb89d2063 100644 --- a/ios/RNAppAuth.m +++ b/ios/RNAppAuth.m @@ -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. */ @@ -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; @@ -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 { @@ -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]);