GIDDataFetcher.m 843 B

1234567891011121314151617181920212223242526272829
  1. #import "GoogleSignIn/Sources/GIDDataFetcher/Implementations/GIDDataFetcher.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 GIDDataFetcher
  11. - (void)fetchURL:(NSURL *)URL
  12. withComment:(NSString *)comment
  13. completion:(void (^)(NSData *_Nullable, NSError *_Nullable))completion {
  14. NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:URL];
  15. GTMSessionFetcher *fetcher = [GTMSessionFetcher fetcherWithRequest:request];
  16. fetcher.retryEnabled = YES;
  17. fetcher.maxRetryInterval = kFetcherMaxRetryInterval;
  18. fetcher.comment = comment;
  19. [fetcher beginFetchWithCompletionHandler:completion];
  20. }
  21. @end
  22. NS_ASSUME_NONNULL_END