GIDHTTPFetcher.m 1003 B

1234567891011121314151617181920212223242526272829303132
  1. #import "GoogleSignIn/Sources/GIDHTTPFetcher/Implementations/GIDHTTPFetcher.h"
  2. #ifdef SWIFT_PACKAGE
  3. @import GTMAppAuth;
  4. #else
  5. #import <GTMAppAuth/GTMAppAuth.h>
  6. #endif
  7. NS_ASSUME_NONNULL_BEGIN
  8. // Maximum retry interval in seconds for the fetcher.
  9. static const NSTimeInterval kFetcherMaxRetryInterval = 15.0;
  10. @implementation GIDHTTPFetcher
  11. - (void)fetchURLRequest:(NSURLRequest *)urlRequest
  12. #pragma clang diagnostic ignored "-Wdeprecated-declarations"
  13. withAuthorizer:(id<GTMFetcherAuthorizationProtocol>)authorizer
  14. #pragma clang diagnostic pop
  15. withComment:(NSString *)comment
  16. completion:(void (^)(NSData *_Nullable, NSError *_Nullable))completion {
  17. GTMSessionFetcher *fetcher = [GTMSessionFetcher fetcherWithRequest:urlRequest];
  18. fetcher.authorizer = authorizer;
  19. fetcher.retryEnabled = YES;
  20. fetcher.maxRetryInterval = kFetcherMaxRetryInterval;
  21. fetcher.comment = comment;
  22. [fetcher beginFetchWithCompletionHandler:completion];
  23. }
  24. @end
  25. NS_ASSUME_NONNULL_END