1818
1919#import " GoogleSignIn/Sources/GIDSignInPreferences.h"
2020
21- #if TARGET_OS_IOS
21+ #if TARGET_OS_IOS && !TARGET_OS_MACCATALYST
2222#import " GoogleSignIn/Sources/GIDEMMErrorHandler.h"
2323#import " GoogleSignIn/Sources/GIDMDMPasscodeState.h"
24- #endif
24+ #endif // TARGET_OS_IOS && !TARGET_OS_MACCATALYST
2525
2626#import " GoogleSignIn/Sources/Public/GoogleSignIn/GIDSignIn.h"
2727
5757// New UIDevice system name for iOS.
5858static NSString *const kNewIOSSystemName = @" iOS" ;
5959
60- #if TARGET_OS_IOS
60+ #if TARGET_OS_IOS && !TARGET_OS_MACCATALYST
6161
6262// The specialized GTMAppAuthFetcherAuthorization delegate that handles potential EMM error
6363// responses.
@@ -149,7 +149,7 @@ - (void)authorizeRequest:(nullable NSMutableURLRequest *)request
149149
150150@end
151151
152- #endif
152+ #endif // TARGET_OS_IOS && !TARGET_OS_MACCATALYST
153153
154154@implementation GIDAuthentication {
155155 // A queue for pending authentication handlers so we don't fire multiple requests in parallel.
@@ -197,24 +197,24 @@ - (nullable NSDate *)idTokenExpirationDate {
197197
198198#pragma mark - Private property accessors
199199
200- #if TARGET_OS_IOS
200+ #if TARGET_OS_IOS && !TARGET_OS_MACCATALYST
201201- (NSString *)emmSupport {
202202 return
203203 _authState.lastAuthorizationResponse .request .additionalParameters [kEMMSupportParameterName ];
204204}
205- #endif
205+ #endif // TARGET_OS_IOS && !TARGET_OS_MACCATALYST
206206
207207#pragma mark - Public methods
208208
209209- (id <GTMFetcherAuthorizationProtocol>)fetcherAuthorizer {
210- #if TARGET_OS_IOS
210+ #if TARGET_OS_IOS && !TARGET_OS_MACCATALYST
211211 GTMAppAuthFetcherAuthorization *authorization = self.emmSupport ?
212212 [[GTMAppAuthFetcherAuthorizationWithEMMSupport alloc ] initWithAuthState: _authState] :
213213 [[GTMAppAuthFetcherAuthorization alloc ] initWithAuthState: _authState];
214- #else // TARGET_OS_OSX or TARGET_OS_MACCATALYST
214+ #elif TARGET_OS_OSX || TARGET_OS_MACCATALYST
215215 GTMAppAuthFetcherAuthorization *authorization =
216216 [[GTMAppAuthFetcherAuthorization alloc ] initWithAuthState: _authState];
217- #endif
217+ #endif // TARGET_OS_IOS && !TARGET_OS_MACCATALYST
218218 authorization.tokenRefreshDelegate = self;
219219 return authorization;
220220}
@@ -237,14 +237,14 @@ - (void)doWithFreshTokens:(GIDAuthenticationAction)action {
237237 }
238238 // This is the first handler in the queue, a fetch is needed.
239239 NSMutableDictionary *additionalParameters = [@{} mutableCopy];
240- #if TARGET_OS_IOS
240+ #if TARGET_OS_IOS && !TARGET_OS_MACCATALYST
241241 [additionalParameters addEntriesFromDictionary:
242242 [GIDAuthentication updatedEMMParametersWithParameters:
243243 _authState.lastTokenResponse.request.additionalParameters]];
244- #else // TARGET_OS_OSX or TARGET_OS_MACCATALYST
244+ #elif TARGET_OS_OSX || TARGET_OS_MACCATALYST
245245 [additionalParameters addEntriesFromDictionary:
246246 _authState.lastTokenResponse.request.additionalParameters];
247- #endif
247+ #endif // TARGET_OS_IOS && !TARGET_OS_MACCATALYST
248248 additionalParameters[kSDKVersionLoggingParameter ] = GIDVersion ();
249249 additionalParameters[kEnvironmentLoggingParameter ] = GIDEnvironment ();
250250
@@ -269,7 +269,7 @@ - (void)doWithFreshTokens:(GIDAuthenticationAction)action {
269269 [self ->_authState updateWithAuthorizationError: error];
270270 }
271271 }
272- #if TARGET_OS_IOS
272+ #if TARGET_OS_IOS && !TARGET_OS_MACCATALYST
273273 [GIDAuthentication handleTokenFetchEMMError: error completion: ^(NSError *_Nullable error) {
274274 // Process the handler queue to call back.
275275 NSArray *authenticationHandlerQueue;
@@ -283,7 +283,7 @@ - (void)doWithFreshTokens:(GIDAuthenticationAction)action {
283283 });
284284 }
285285 }];
286- #else // TARGET_OS_OSX or TARGET_OS_MACCATALYST
286+ #elif TARGET_OS_OSX || TARGET_OS_MACCATALYST
287287 NSArray *authenticationHandlerQueue;
288288 @synchronized (self->_authenticationHandlerQueue ) {
289289 authenticationHandlerQueue = [self ->_authenticationHandlerQueue copy ];
@@ -294,12 +294,14 @@ - (void)doWithFreshTokens:(GIDAuthenticationAction)action {
294294 action (error ? nil : self, error);
295295 });
296296 }
297- #endif
297+ #endif // TARGET_OS_IOS && !TARGET_OS_MACCATALYST
298298 }];
299299}
300300
301301#pragma mark - Private methods
302- #if TARGET_OS_IOS
302+
303+ #if TARGET_OS_IOS && !TARGET_OS_MACCATALYST
304+
303305+ (NSDictionary *)parametersWithParameters : (NSDictionary *)parameters
304306 emmSupport : (nullable NSString *)emmSupport
305307 isPasscodeInfoRequired : (BOOL )isPasscodeInfoRequired {
@@ -346,18 +348,19 @@ + (void)handleTokenFetchEMMError:(nullable NSError *)error
346348 completion (error);
347349 }
348350}
349- #endif
351+
352+ #endif // TARGET_OS_IOS && !TARGET_OS_MACCATALYST
350353
351354#pragma mark - GTMAppAuthFetcherAuthorizationTokenRefreshDelegate
352355
353356- (nullable NSDictionary *)additionalRefreshParameters :
354357 (GTMAppAuthFetcherAuthorization *)authorization {
355- #if TARGET_OS_IOS
358+ #if TARGET_OS_IOS && !TARGET_OS_MACCATALYST
356359 return [GIDAuthentication updatedEMMParametersWithParameters:
357360 authorization.authState.lastTokenResponse.request.additionalParameters];
358- #else // TARGET_OS_MACCATALYST or TARGET_OS_OSX
361+ #elif TARGET_OS_OSX || TARGET_OS_MACCATALYST
359362 return authorization.authState .lastTokenResponse .request .additionalParameters ;
360- #endif
363+ #endif // TARGET_OS_IOS && !TARGET_OS_MACCATALYST
361364}
362365
363366#pragma mark - NSSecureCoding
0 commit comments