@@ -24,7 +24,7 @@ - (dispatch_queue_t)methodQueue
24
24
return dispatch_get_main_queue ();
25
25
}
26
26
27
- #if TARGET_OS_IOS || TARGET_OS_MACCATALYST
27
+ #if TARGET_OS_IPHONE
28
28
UIBackgroundTaskIdentifier rnAppAuthTaskId;
29
29
#endif
30
30
@@ -358,7 +358,7 @@ - (void)authorizeWithConfiguration: (OIDServiceConfiguration *) configuration
358
358
additionalParameters: additionalParameters];
359
359
360
360
// performs authentication request
361
- #if TARGET_OS_IOS || TARGET_OS_MACCATALYST
361
+ #if TARGET_OS_IPHONE
362
362
id <UIApplicationDelegate, RNAppAuthAuthorizationFlowManager> appDelegate = (id <UIApplicationDelegate, RNAppAuthAuthorizationFlowManager>)[UIApplication sharedApplication ].delegate ;
363
363
#elif TARGET_OS_OSX
364
364
id <NSApplicationDelegate , RNAppAuthAuthorizationFlowManager> appDelegate = (id <NSApplicationDelegate , RNAppAuthAuthorizationFlowManager>)[NSApplication sharedApplication ].delegate ;
@@ -370,7 +370,7 @@ - (void)authorizeWithConfiguration: (OIDServiceConfiguration *) configuration
370
370
appDelegate.authorizationFlowManagerDelegate = self;
371
371
__weak typeof (self) weakSelf = self;
372
372
373
- #if TARGET_OS_IOS || TARGET_OS_MACCATALYST
373
+ #if TARGET_OS_IPHONE
374
374
rnAppAuthTaskId = [UIApplication.sharedApplication beginBackgroundTaskWithExpirationHandler: ^{
375
375
[UIApplication.sharedApplication endBackgroundTask: rnAppAuthTaskId];
376
376
rnAppAuthTaskId = UIBackgroundTaskInvalid;
@@ -385,18 +385,16 @@ - (void)authorizeWithConfiguration: (OIDServiceConfiguration *) configuration
385
385
}
386
386
#endif
387
387
388
- #if TARGET_OS_MACCATALYST
389
- id <OIDExternalUserAgent> externalUserAgent = nil ;
390
- #elif TARGET_OS_IOS
388
+ #if TARGET_OS_IOS && !TARGET_OS_MACCATALYST
391
389
id <OIDExternalUserAgent> externalUserAgent = iosCustomBrowser != nil ? [self getCustomBrowser: iosCustomBrowser] : nil ;
392
- #elif TARGET_OS_OSX
390
+ #elif TARGET_OS_IPHONE || TARGET_OS_OSX
393
391
id <OIDExternalUserAgent> externalUserAgent = nil ;
394
392
#endif
395
393
396
394
OIDAuthorizationCallback callback = ^(OIDAuthorizationResponse *_Nullable authorizationResponse, NSError *_Nullable error) {
397
395
typeof (self) strongSelf = weakSelf;
398
396
strongSelf->_currentSession = nil ;
399
- #if TARGET_OS_IOS || TARGET_OS_MACCATALYST
397
+ #if TARGET_OS_IPHONE
400
398
[UIApplication.sharedApplication endBackgroundTask: rnAppAuthTaskId];
401
399
rnAppAuthTaskId = UIBackgroundTaskInvalid;
402
400
#elif TARGET_OS_OSX
@@ -418,7 +416,7 @@ - (void)authorizeWithConfiguration: (OIDServiceConfiguration *) configuration
418
416
externalUserAgent: externalUserAgent
419
417
callback: callback];
420
418
} else {
421
- #if TARGET_OS_IOS || TARGET_OS_MACCATALYST
419
+ #if TARGET_OS_IPHONE
422
420
if (@available (iOS 13 , *)) {
423
421
_currentSession = [OIDAuthorizationService presentAuthorizationRequest: request
424
422
presentingViewController: presentingViewController
@@ -443,7 +441,7 @@ - (void)authorizeWithConfiguration: (OIDServiceConfiguration *) configuration
443
441
) {
444
442
typeof (self) strongSelf = weakSelf;
445
443
strongSelf->_currentSession = nil ;
446
- #if TARGET_OS_IOS || TARGET_OS_MACCATALYST
444
+ #if TARGET_OS_IPHONE
447
445
[UIApplication.sharedApplication endBackgroundTask: rnAppAuthTaskId];
448
446
rnAppAuthTaskId = UIBackgroundTaskInvalid;
449
447
#elif TARGET_OS_OSX
@@ -466,7 +464,7 @@ - (void)authorizeWithConfiguration: (OIDServiceConfiguration *) configuration
466
464
} else {
467
465
468
466
469
- #if TARGET_OS_IOS || TARGET_OS_MACCATALYST
467
+ #if TARGET_OS_IPHONE
470
468
if (@available (iOS 13 , *)) {
471
469
_currentSession = [OIDAuthState authStateByPresentingAuthorizationRequest: request
472
470
presentingViewController: presentingViewController
@@ -538,7 +536,7 @@ - (void)endSessionWithConfiguration: (OIDServiceConfiguration *) configuration
538
536
postLogoutRedirectURL: [NSURL URLWithString: postLogoutRedirectURL]
539
537
additionalParameters: additionalParameters];
540
538
541
- #if TARGET_OS_IOS || TARGET_OS_MACCATALYST
539
+ #if TARGET_OS_IPHONE
542
540
id <UIApplicationDelegate, RNAppAuthAuthorizationFlowManager> appDelegate = (id <UIApplicationDelegate, RNAppAuthAuthorizationFlowManager>)[UIApplication sharedApplication ].delegate ;
543
541
#elif TARGET_OS_OSX
544
542
id <NSApplicationDelegate , RNAppAuthAuthorizationFlowManager> appDelegate = (id <NSApplicationDelegate , RNAppAuthAuthorizationFlowManager>)[NSApplication sharedApplication ].delegate ;
@@ -550,7 +548,7 @@ - (void)endSessionWithConfiguration: (OIDServiceConfiguration *) configuration
550
548
appDelegate.authorizationFlowManagerDelegate = self;
551
549
__weak typeof (self) weakSelf = self;
552
550
553
- #if TARGET_OS_IOS || TARGET_OS_MACCATALYST
551
+ #if TARGET_OS_IPHONE
554
552
rnAppAuthTaskId = [UIApplication.sharedApplication beginBackgroundTaskWithExpirationHandler: ^{
555
553
[UIApplication.sharedApplication endBackgroundTask: rnAppAuthTaskId];
556
554
rnAppAuthTaskId = UIBackgroundTaskInvalid;
@@ -565,9 +563,7 @@ - (void)endSessionWithConfiguration: (OIDServiceConfiguration *) configuration
565
563
}
566
564
#endif
567
565
568
- #if TARGET_OS_MACCATALYST
569
- id <OIDExternalUserAgent> externalUserAgent = nil ;
570
- #elif TARGET_OS_IOS
566
+ #if TARGET_OS_IOS && !TARGET_OS_MACCATALYST
571
567
id <OIDExternalUserAgent> externalUserAgent = iosCustomBrowser != nil ? [self getCustomBrowser: iosCustomBrowser] : [self getExternalUserAgentWithPresentingViewController: presentingViewController
572
568
prefersEphemeralSession: prefersEphemeralSession];
573
569
#elif TARGET_OS_OSX
@@ -579,7 +575,7 @@ - (void)endSessionWithConfiguration: (OIDServiceConfiguration *) configuration
579
575
callback: ^(OIDEndSessionResponse *_Nullable response, NSError *_Nullable error) {
580
576
typeof (self) strongSelf = weakSelf;
581
577
strongSelf->_currentSession = nil ;
582
- #if TARGET_OS_IOS || TARGET_OS_MACCATALYST
578
+ #if TARGET_OS_IPHONE
583
579
[UIApplication.sharedApplication endBackgroundTask: rnAppAuthTaskId];
584
580
rnAppAuthTaskId = UIBackgroundTaskInvalid;
585
581
#elif TARGET_OS_OSX
@@ -752,7 +748,7 @@ - (NSString*)getErrorCode: (NSError*) error defaultCode: (NSString *) defaultCod
752
748
return defaultCode;
753
749
}
754
750
755
- #if TARGET_OS_IOS
751
+ #if TARGET_OS_IOS && !TARGET_OS_MACCATALYST
756
752
- (id <OIDExternalUserAgent>)getCustomBrowser : (NSString *) browserType {
757
753
typedef id <OIDExternalUserAgent> (^BrowserBlock)(void );
758
754
@@ -791,7 +787,7 @@ - (NSString*)getErrorMessage: (NSError*) error {
791
787
}
792
788
}
793
789
794
- #if TARGET_OS_IOS || TARGET_OS_MACCATALYST
790
+ #if TARGET_OS_IPHONE
795
791
- (id <OIDExternalUserAgent>)getExternalUserAgentWithPresentingViewController : (UIViewController *)presentingViewController
796
792
prefersEphemeralSession : (BOOL ) prefersEphemeralSession
797
793
#elif TARGET_OS_OSX
@@ -802,7 +798,7 @@ - (NSString*)getErrorMessage: (NSError*) error {
802
798
id <OIDExternalUserAgent> externalUserAgent;
803
799
#if TARGET_OS_MACCATALYST
804
800
externalUserAgent = [[OIDExternalUserAgentCatalyst alloc ] initWithPresentingViewController: presentingViewController];
805
- #elif TARGET_OS_IOS
801
+ #elif TARGET_OS_IPHONE
806
802
if (@available (iOS 13 , *)) {
807
803
externalUserAgent = [[OIDExternalUserAgentIOS alloc ] initWithPresentingViewController:
808
804
presentingViewController
0 commit comments