12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331 |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- #import <Foundation/Foundation.h>
-
- #if TARGET_OS_IPHONE
- #import <UIKit/UIKit.h>
- #endif
- #if TARGET_OS_WATCH
- #import <WatchKit/WatchKit.h>
- #endif
-
-
-
- #ifndef STRIP_GTM_FETCH_LOGGING
- #if !DEBUG
- #define STRIP_GTM_FETCH_LOGGING 1
- #else
- #define STRIP_GTM_FETCH_LOGGING 0
- #endif
- #endif
-
-
- #ifndef GTMSESSION_LOG_DEBUG
- #if DEBUG
- #define GTMSESSION_LOG_DEBUG(...) NSLog(__VA_ARGS__)
- #else
- #define GTMSESSION_LOG_DEBUG(...) do { } while (0)
- #endif
- #endif
-
-
-
- #ifndef GTMSESSION_ASSERT_DEBUG
- #if DEBUG && !defined(NS_BLOCK_ASSERTIONS) && !GTMSESSION_ASSERT_AS_LOG
- #undef GTMSESSION_ASSERT_AS_LOG
- #define GTMSESSION_ASSERT_AS_LOG 1
- #endif
-
- #if DEBUG && !GTMSESSION_ASSERT_AS_LOG
- #define GTMSESSION_ASSERT_DEBUG(...) NSAssert(__VA_ARGS__)
- #elif DEBUG
- #define GTMSESSION_ASSERT_DEBUG(pred, ...) if (!(pred)) { NSLog(__VA_ARGS__); }
- #else
- #define GTMSESSION_ASSERT_DEBUG(pred, ...) do { } while (0)
- #endif
- #endif
-
-
-
- #ifndef GTMSESSION_ASSERT_DEBUG_OR_LOG
- #if DEBUG && !GTMSESSION_ASSERT_AS_LOG
- #define GTMSESSION_ASSERT_DEBUG_OR_LOG(...) NSAssert(__VA_ARGS__)
- #else
- #define GTMSESSION_ASSERT_DEBUG_OR_LOG(pred, ...) if (!(pred)) { NSLog(__VA_ARGS__); }
- #endif
- #endif
-
-
- #if 0
- #define GTM_LOG_SESSION_DELEGATE(...) GTMSESSION_LOG_DEBUG(__VA_ARGS__)
- #else
- #define GTM_LOG_SESSION_DELEGATE(...)
- #endif
-
- #ifndef GTM_NULLABLE
- #if __has_feature(nullability) // Available starting in Xcode 6.3
- #define GTM_NULLABLE_TYPE __nullable
- #define GTM_NONNULL_TYPE __nonnull
- #define GTM_NULLABLE nullable
- #define GTM_NONNULL_DECL nonnull // GTM_NONNULL is used by GTMDefines.h
- #define GTM_NULL_RESETTABLE null_resettable
-
- #define GTM_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
- #define GTM_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
- #else
- #define GTM_NULLABLE_TYPE
- #define GTM_NONNULL_TYPE
- #define GTM_NULLABLE
- #define GTM_NONNULL_DECL
- #define GTM_NULL_RESETTABLE
- #define GTM_ASSUME_NONNULL_BEGIN
- #define GTM_ASSUME_NONNULL_END
- #endif // __has_feature(nullability)
- #endif // GTM_NULLABLE
-
- #if (TARGET_OS_TV \
- || TARGET_OS_WATCH \
- || (!TARGET_OS_IPHONE && defined(MAC_OS_X_VERSION_10_12) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_12) \
- || (TARGET_OS_IPHONE && defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0))
- #define GTMSESSION_DEPRECATE_ON_2016_SDKS(_MSG) __attribute__((deprecated("" _MSG)))
- #else
- #define GTMSESSION_DEPRECATE_ON_2016_SDKS(_MSG)
- #endif
-
- #ifndef GTM_DECLARE_GENERICS
- #if __has_feature(objc_generics)
- #define GTM_DECLARE_GENERICS 1
- #else
- #define GTM_DECLARE_GENERICS 0
- #endif
- #endif
-
- #ifndef GTM_NSArrayOf
- #if GTM_DECLARE_GENERICS
- #define GTM_NSArrayOf(value) NSArray<value>
- #define GTM_NSDictionaryOf(key, value) NSDictionary<key, value>
- #else
- #define GTM_NSArrayOf(value) NSArray
- #define GTM_NSDictionaryOf(key, value) NSDictionary
- #endif // __has_feature(objc_generics)
- #endif // GTM_NSArrayOf
-
-
-
-
-
-
-
-
-
-
- #if TARGET_OS_IPHONE && !TARGET_OS_WATCH && !defined(GTM_BACKGROUND_TASK_FETCHING)
- #define GTM_BACKGROUND_TASK_FETCHING 1
- #endif
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #if (TARGET_OS_TV \
- || TARGET_OS_WATCH \
- || (!TARGET_OS_IPHONE && defined(MAC_OS_X_VERSION_10_11) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_11) \
- || (TARGET_OS_IPHONE && defined(__IPHONE_9_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_9_0))
- #ifndef GTM_USE_SESSION_FETCHER
- #define GTM_USE_SESSION_FETCHER 1
- #endif
- #endif
-
- #if !defined(GTMBridgeFetcher)
-
- #if GTM_USE_SESSION_FETCHER
-
- #define GTMBridgeFetcher GTMSessionFetcher
- #define GTMBridgeFetcherService GTMSessionFetcherService
- #define GTMBridgeFetcherServiceProtocol GTMSessionFetcherServiceProtocol
- #define GTMBridgeAssertValidSelector GTMSessionFetcherAssertValidSelector
- #define GTMBridgeCookieStorage GTMSessionCookieStorage
- #define GTMBridgeCleanedUserAgentString GTMFetcherCleanedUserAgentString
- #define GTMBridgeSystemVersionString GTMFetcherSystemVersionString
- #define GTMBridgeApplicationIdentifier GTMFetcherApplicationIdentifier
- #define kGTMBridgeFetcherStatusDomain kGTMSessionFetcherStatusDomain
- #define kGTMBridgeFetcherStatusBadRequest GTMSessionFetcherStatusBadRequest
- #else
-
- #define GTMBridgeFetcher GTMHTTPFetcher
- #define GTMBridgeFetcherService GTMHTTPFetcherService
- #define GTMBridgeFetcherServiceProtocol GTMHTTPFetcherServiceProtocol
- #define GTMBridgeAssertValidSelector GTMAssertSelectorNilOrImplementedWithArgs
- #define GTMBridgeCookieStorage GTMCookieStorage
- #define GTMBridgeCleanedUserAgentString GTMCleanedUserAgentString
- #define GTMBridgeSystemVersionString GTMSystemVersionString
- #define GTMBridgeApplicationIdentifier GTMApplicationIdentifier
- #define kGTMBridgeFetcherStatusDomain kGTMHTTPFetcherStatusDomain
- #define kGTMBridgeFetcherStatusBadRequest kGTMHTTPFetcherStatusBadRequest
- #endif // GTM_USE_SESSION_FETCHER
- #endif
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- #ifndef GTMSESSION_RECONNECT_BACKGROUND_SESSIONS_ON_LAUNCH
-
- #if TARGET_OS_IOS && defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
- #define GTMSESSION_RECONNECT_BACKGROUND_SESSIONS_ON_LAUNCH 1
- #else
- #define GTMSESSION_RECONNECT_BACKGROUND_SESSIONS_ON_LAUNCH 0
- #endif
- #endif
-
- GTM_ASSUME_NONNULL_BEGIN
-
-
-
-
- extern NSString *const kGTMSessionFetcherStartedNotification;
- extern NSString *const kGTMSessionFetcherStoppedNotification;
- extern NSString *const kGTMSessionFetcherRetryDelayStartedNotification;
- extern NSString *const kGTMSessionFetcherRetryDelayStoppedNotification;
-
-
-
-
-
-
-
- extern NSString *const kGTMSessionFetcherCompletionInvokedNotification;
- extern NSString *const kGTMSessionFetcherCompletionDataKey;
- extern NSString *const kGTMSessionFetcherCompletionErrorKey;
-
-
-
- extern NSString *const kGTMSessionFetcherErrorDomain;
-
-
-
-
-
-
- extern NSString *const kGTMSessionFetcherStatusDomain;
- extern NSString *const kGTMSessionFetcherStatusDataKey;
- extern NSString *const kGTMSessionFetcherStatusDataContentTypeKey;
-
-
-
- extern NSString *const kGTMSessionFetcherNumberOfRetriesDoneKey;
- extern NSString *const kGTMSessionFetcherElapsedIntervalWithRetriesKey;
-
-
-
-
-
- @interface GTMSessionFetcherUserDefaultsFactory : NSObject
-
- + (NSUserDefaults *)fetcherUserDefaults;
-
- @end
-
- #ifdef __cplusplus
- }
- #endif
-
- typedef NS_ENUM(NSInteger, GTMSessionFetcherError) {
- GTMSessionFetcherErrorDownloadFailed = -1,
- GTMSessionFetcherErrorUploadChunkUnavailable = -2,
- GTMSessionFetcherErrorBackgroundExpiration = -3,
- GTMSessionFetcherErrorBackgroundFetchFailed = -4,
- GTMSessionFetcherErrorInsecureRequest = -5,
- GTMSessionFetcherErrorTaskCreationFailed = -6,
- };
-
- typedef NS_ENUM(NSInteger, GTMSessionFetcherStatus) {
-
- GTMSessionFetcherStatusNotModified = 304,
- GTMSessionFetcherStatusBadRequest = 400,
- GTMSessionFetcherStatusUnauthorized = 401,
- GTMSessionFetcherStatusForbidden = 403,
- GTMSessionFetcherStatusPreconditionFailed = 412
- };
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- @class GTMSessionCookieStorage;
- @class GTMSessionFetcher;
-
-
-
- typedef void (^GTMSessionFetcherConfigurationBlock)(GTMSessionFetcher *fetcher,
- NSURLSessionConfiguration *configuration);
- typedef void (^GTMSessionFetcherSystemCompletionHandler)(void);
- typedef void (^GTMSessionFetcherCompletionHandler)(NSData * GTM_NULLABLE_TYPE data,
- NSError * GTM_NULLABLE_TYPE error);
- typedef void (^GTMSessionFetcherBodyStreamProviderResponse)(NSInputStream *bodyStream);
- typedef void (^GTMSessionFetcherBodyStreamProvider)(GTMSessionFetcherBodyStreamProviderResponse response);
- typedef void (^GTMSessionFetcherDidReceiveResponseDispositionBlock)(NSURLSessionResponseDisposition disposition);
- typedef void (^GTMSessionFetcherDidReceiveResponseBlock)(NSURLResponse *response,
- GTMSessionFetcherDidReceiveResponseDispositionBlock dispositionBlock);
- typedef void (^GTMSessionFetcherChallengeDispositionBlock)(NSURLSessionAuthChallengeDisposition disposition,
- NSURLCredential * GTM_NULLABLE_TYPE credential);
- typedef void (^GTMSessionFetcherChallengeBlock)(GTMSessionFetcher *fetcher,
- NSURLAuthenticationChallenge *challenge,
- GTMSessionFetcherChallengeDispositionBlock dispositionBlock);
- typedef void (^GTMSessionFetcherWillRedirectResponse)(NSURLRequest * GTM_NULLABLE_TYPE redirectedRequest);
- typedef void (^GTMSessionFetcherWillRedirectBlock)(NSHTTPURLResponse *redirectResponse,
- NSURLRequest *redirectRequest,
- GTMSessionFetcherWillRedirectResponse response);
- typedef void (^GTMSessionFetcherAccumulateDataBlock)(NSData * GTM_NULLABLE_TYPE buffer);
- typedef void (^GTMSessionFetcherSimulateByteTransferBlock)(NSData * GTM_NULLABLE_TYPE buffer,
- int64_t bytesWritten,
- int64_t totalBytesWritten,
- int64_t totalBytesExpectedToWrite);
- typedef void (^GTMSessionFetcherReceivedProgressBlock)(int64_t bytesWritten,
- int64_t totalBytesWritten);
- typedef void (^GTMSessionFetcherDownloadProgressBlock)(int64_t bytesWritten,
- int64_t totalBytesWritten,
- int64_t totalBytesExpectedToWrite);
- typedef void (^GTMSessionFetcherSendProgressBlock)(int64_t bytesSent,
- int64_t totalBytesSent,
- int64_t totalBytesExpectedToSend);
- typedef void (^GTMSessionFetcherWillCacheURLResponseResponse)(NSCachedURLResponse * GTM_NULLABLE_TYPE cachedResponse);
- typedef void (^GTMSessionFetcherWillCacheURLResponseBlock)(NSCachedURLResponse *proposedResponse,
- GTMSessionFetcherWillCacheURLResponseResponse responseBlock);
- typedef void (^GTMSessionFetcherRetryResponse)(BOOL shouldRetry);
- typedef void (^GTMSessionFetcherRetryBlock)(BOOL suggestedWillRetry,
- NSError * GTM_NULLABLE_TYPE error,
- GTMSessionFetcherRetryResponse response);
-
- typedef void (^GTMSessionFetcherTestResponse)(NSHTTPURLResponse * GTM_NULLABLE_TYPE response,
- NSData * GTM_NULLABLE_TYPE data,
- NSError * GTM_NULLABLE_TYPE error);
- typedef void (^GTMSessionFetcherTestBlock)(GTMSessionFetcher *fetcherToTest,
- GTMSessionFetcherTestResponse testResponse);
-
- void GTMSessionFetcherAssertValidSelector(id GTM_NULLABLE_TYPE obj, SEL GTM_NULLABLE_TYPE sel, ...);
-
-
-
-
-
-
-
-
-
-
-
- NSString *GTMFetcherStandardUserAgentString(NSBundle * GTM_NULLABLE_TYPE bundle);
-
-
-
-
-
-
-
-
-
-
- NSString *GTMFetcherApplicationIdentifier(NSBundle * GTM_NULLABLE_TYPE bundle);
-
-
- NSString *GTMFetcherSystemVersionString(void);
-
-
-
-
-
-
- NSString *GTMFetcherCleanedUserAgentString(NSString *str);
-
-
-
-
-
-
-
-
-
-
-
-
- NSData * GTM_NULLABLE_TYPE GTMDataFromInputStream(NSInputStream *inputStream, NSError **outError);
-
- #ifdef __cplusplus
- }
- #endif
-
-
- #if !GTM_USE_SESSION_FETCHER
- @protocol GTMHTTPFetcherServiceProtocol;
- #endif
-
-
-
-
-
- @protocol GTMSessionFetcherServiceProtocol <NSObject>
-
-
-
- @property(atomic, strong) dispatch_queue_t callbackQueue;
-
- - (BOOL)fetcherShouldBeginFetching:(GTMSessionFetcher *)fetcher;
- - (void)fetcherDidCreateSession:(GTMSessionFetcher *)fetcher;
- - (void)fetcherDidBeginFetching:(GTMSessionFetcher *)fetcher;
- - (void)fetcherDidStop:(GTMSessionFetcher *)fetcher;
-
- - (GTMSessionFetcher *)fetcherWithRequest:(NSURLRequest *)request;
- - (BOOL)isDelayingFetcher:(GTMSessionFetcher *)fetcher;
-
- @property(atomic, assign) BOOL reuseSession;
- - (GTM_NULLABLE NSURLSession *)session;
- - (GTM_NULLABLE NSURLSession *)sessionForFetcherCreation;
- - (GTM_NULLABLE id<NSURLSessionDelegate>)sessionDelegate;
- - (GTM_NULLABLE NSDate *)stoppedAllFetchersDate;
-
-
- @property(atomic, readonly, strong, GTM_NULLABLE) NSOperationQueue *delegateQueue;
-
- @end
-
- #ifndef GTM_FETCHER_AUTHORIZATION_PROTOCOL
- #define GTM_FETCHER_AUTHORIZATION_PROTOCOL 1
- @protocol GTMFetcherAuthorizationProtocol <NSObject>
- @required
-
-
- - (void)authorizeRequest:(GTM_NULLABLE NSMutableURLRequest *)request
- delegate:(id)delegate
- didFinishSelector:(SEL)sel;
-
- - (void)stopAuthorization;
-
- - (void)stopAuthorizationForRequest:(NSURLRequest *)request;
-
- - (BOOL)isAuthorizingRequest:(NSURLRequest *)request;
-
- - (BOOL)isAuthorizedRequest:(NSURLRequest *)request;
-
- @property(atomic, strong, readonly, GTM_NULLABLE) NSString *userEmail;
-
- @optional
-
-
-
- @property(atomic, readonly) BOOL canAuthorize;
-
-
-
- @property(atomic, assign) BOOL shouldAuthorizeAllRequests;
-
- - (void)authorizeRequest:(GTM_NULLABLE NSMutableURLRequest *)request
- completionHandler:(void (^)(NSError * GTM_NULLABLE_TYPE error))handler;
-
- #if GTM_USE_SESSION_FETCHER
- @property(atomic, weak, GTM_NULLABLE) id<GTMSessionFetcherServiceProtocol> fetcherService;
- #else
- @property(atomic, weak, GTM_NULLABLE) id<GTMHTTPFetcherServiceProtocol> fetcherService;
- #endif
-
- - (BOOL)primeForRefresh;
-
- @end
- #endif // GTM_FETCHER_AUTHORIZATION_PROTOCOL
-
- #if GTM_BACKGROUND_TASK_FETCHING
-
-
- @protocol GTMUIApplicationProtocol <NSObject>
- - (UIBackgroundTaskIdentifier)beginBackgroundTaskWithName:(nullable NSString *)taskName
- expirationHandler:(void(^ __nullable)(void))handler;
- - (void)endBackgroundTask:(UIBackgroundTaskIdentifier)identifier;
- @end
- #endif
-
- #pragma mark -
-
-
-
-
- @interface GTMSessionFetcher : NSObject <NSURLSessionDelegate>
-
-
-
-
-
-
-
- + (instancetype)fetcherWithRequest:(GTM_NULLABLE NSURLRequest *)request;
-
-
- + (instancetype)fetcherWithURL:(NSURL *)requestURL;
- + (instancetype)fetcherWithURLString:(NSString *)requestURLString;
-
-
- + (instancetype)fetcherWithDownloadResumeData:(NSData *)resumeData;
- + (GTM_NULLABLE instancetype)fetcherWithSessionIdentifier:(NSString *)sessionIdentifier;
-
-
-
- + (GTM_NSArrayOf(GTMSessionFetcher *) *)fetchersForBackgroundSessions;
-
-
-
-
-
-
-
-
- - (instancetype)initWithRequest:(GTM_NULLABLE NSURLRequest *)request
- configuration:(GTM_NULLABLE NSURLSessionConfiguration *)configuration;
-
-
-
- @property(atomic, strong, GTM_NULLABLE) NSURLRequest *request;
-
-
-
- - (void)setRequestValue:(GTM_NULLABLE NSString *)value forHTTPHeaderField:(NSString *)field;
-
-
- @property(atomic, readonly, GTM_NULLABLE) NSData *downloadResumeData;
-
-
-
-
-
-
-
-
- @property(atomic, strong, GTM_NULLABLE) NSURLSessionConfiguration *configuration;
-
-
-
-
-
-
-
-
-
-
-
- @property(atomic, copy, GTM_NULLABLE) GTMSessionFetcherConfigurationBlock configurationBlock;
-
-
-
- @property(atomic, strong, GTM_NULLABLE) NSURLSession *session;
-
-
- @property(atomic, readonly, GTM_NULLABLE) NSURLSessionTask *sessionTask;
-
-
- @property(atomic, readonly, GTM_NULLABLE) NSString *sessionIdentifier;
-
-
- @property(atomic, readonly) BOOL wasCreatedFromBackgroundSession;
-
-
-
-
- @property(atomic, strong, GTM_NULLABLE) GTM_NSDictionaryOf(NSString *, NSString *) *sessionUserInfo;
-
-
- @property(atomic, copy, GTM_NULLABLE) NSString *taskDescription;
-
-
-
- @property(atomic, assign) float taskPriority;
-
-
-
-
- - (GTM_NULLABLE GTM_NSDictionaryOf(NSString *, NSString *) *)sessionIdentifierMetadata;
-
- #if TARGET_OS_IPHONE && !TARGET_OS_WATCH
-
-
- + (void)application:(UIApplication *)application
- handleEventsForBackgroundURLSession:(NSString *)identifier
- completionHandler:(GTMSessionFetcherSystemCompletionHandler)completionHandler;
- #endif
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- @property(atomic, assign) BOOL useBackgroundSession;
-
-
- @property(atomic, readonly, getter=isUsingBackgroundSession) BOOL usingBackgroundSession;
-
-
-
- @property(atomic, assign) BOOL useUploadTask;
-
-
- @property(atomic, readonly) BOOL canShareSession;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- @property(atomic, copy, GTM_NULLABLE) GTM_NSArrayOf(NSString *) *allowedInsecureSchemes;
-
-
-
-
-
-
-
-
- @property(atomic, assign) BOOL allowLocalhostRequest;
-
-
-
- @property(atomic, assign) BOOL allowInvalidServerCertificates;
-
-
-
-
-
-
-
-
-
- @property(atomic, strong, GTM_NULLABLE) NSHTTPCookieStorage *cookieStorage;
-
-
-
- @property(atomic, strong, GTM_NULLABLE) NSURLCredential *credential;
-
-
-
- @property(atomic, strong, GTM_NULLABLE) NSURLCredential *proxyCredential;
-
-
-
- @property(atomic, strong, GTM_NULLABLE) NSData *bodyData;
-
-
- @property(atomic, strong, GTM_NULLABLE) NSURL *bodyFileURL;
-
-
- @property(atomic, readonly) int64_t bodyLength;
-
-
-
- @property(atomic, copy, GTM_NULLABLE) GTMSessionFetcherBodyStreamProvider bodyStreamProvider;
-
-
-
-
- @property(atomic, strong, GTM_NULLABLE) id<GTMFetcherAuthorizationProtocol> authorizer;
-
-
- @property(atomic, strong) id<GTMSessionFetcherServiceProtocol> service;
-
-
- @property(atomic, copy, GTM_NULLABLE) NSString *serviceHost;
-
-
-
-
-
-
-
-
- @property(atomic, assign) NSInteger servicePriority;
-
-
-
-
-
- @property(atomic, copy, GTM_NULLABLE) GTMSessionFetcherDidReceiveResponseBlock didReceiveResponseBlock;
-
-
-
-
-
-
-
-
-
-
-
-
- @property(atomic, copy, GTM_NULLABLE) GTMSessionFetcherChallengeBlock challengeBlock;
-
-
-
-
-
- @property(atomic, copy, GTM_NULLABLE) GTMSessionFetcherWillRedirectBlock willRedirectBlock;
-
-
-
-
- @property(atomic, copy, GTM_NULLABLE) GTMSessionFetcherSendProgressBlock sendProgressBlock;
-
-
-
-
-
-
-
-
- @property(atomic, copy, GTM_NULLABLE) GTMSessionFetcherAccumulateDataBlock accumulateDataBlock;
-
-
-
-
-
- @property(atomic, copy, GTM_NULLABLE) GTMSessionFetcherReceivedProgressBlock receivedProgressBlock;
-
-
-
-
-
- @property(atomic, copy, GTM_NULLABLE) GTMSessionFetcherDownloadProgressBlock downloadProgressBlock;
-
-
-
-
-
- @property(atomic, copy, GTM_NULLABLE) GTMSessionFetcherWillCacheURLResponseBlock willCacheURLResponseBlock;
-
-
-
- @property(atomic, assign, getter=isRetryEnabled) BOOL retryEnabled;
-
-
-
-
-
-
- @property(atomic, copy, GTM_NULLABLE) GTMSessionFetcherRetryBlock retryBlock;
-
-
-
-
-
- @property(atomic, assign) NSTimeInterval maxRetryInterval;
-
-
-
-
- @property(atomic, assign) NSTimeInterval minRetryInterval;
-
-
-
- @property(atomic, assign) double retryFactor;
-
-
- @property(atomic, readonly) NSUInteger retryCount;
-
-
- @property(atomic, readonly) NSTimeInterval nextRetryInterval;
-
- #if GTM_BACKGROUND_TASK_FETCHING
-
-
-
-
-
-
- @property(atomic, assign) BOOL skipBackgroundTask;
- #endif // GTM_BACKGROUND_TASK_FETCHING
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - (void)beginFetchWithDelegate:(GTM_NULLABLE id)delegate
- didFinishSelector:(GTM_NULLABLE SEL)finishedSEL;
-
- - (void)beginFetchWithCompletionHandler:(GTM_NULLABLE GTMSessionFetcherCompletionHandler)handler;
-
-
- @property(atomic, readonly, getter=isFetching) BOOL fetching;
-
-
-
- - (void)stopFetching;
-
-
- @property(atomic, copy, GTM_NULLABLE) GTMSessionFetcherCompletionHandler completionHandler;
-
-
- @property(atomic, strong, GTM_NULLABLE) void (^resumeDataBlock)(NSData *);
-
-
- @property(atomic, readonly) NSInteger statusCode;
-
-
- @property(atomic, strong, readonly, GTM_NULLABLE) GTM_NSDictionaryOf(NSString *, NSString *) *responseHeaders;
-
-
- @property(atomic, strong, readonly, GTM_NULLABLE) NSURLResponse *response;
-
-
- @property(atomic, readonly) int64_t downloadedLength;
-
-
- @property(atomic, readonly, strong, GTM_NULLABLE) NSData *downloadedData;
-
-
-
-
-
- @property(atomic, strong, GTM_NULLABLE) NSURL *destinationFileURL;
-
-
-
- @property(atomic, strong, readonly, GTM_NULLABLE) NSDate *initialBeginFetchDate;
-
-
- @property(atomic, strong, GTM_NULLABLE) id userData;
-
-
- @property(atomic, copy, GTM_NULLABLE) GTM_NSDictionaryOf(NSString *, id) *properties;
-
- - (void)setProperty:(GTM_NULLABLE id)obj forKey:(NSString *)key;
- - (GTM_NULLABLE id)propertyForKey:(NSString *)key;
-
- - (void)addPropertiesFromDictionary:(GTM_NSDictionaryOf(NSString *, id) *)dict;
-
-
- @property(atomic, copy, GTM_NULLABLE) NSString *comment;
-
- - (void)setCommentWithFormat:(NSString *)format, ... NS_FORMAT_FUNCTION(1, 2);
-
-
- @property(atomic, copy, GTM_NULLABLE) NSString *log;
-
-
- @property(atomic, strong, GTM_NULL_RESETTABLE) dispatch_queue_t callbackQueue;
-
-
-
-
-
-
-
-
-
-
-
- @property(atomic, strong, GTM_NULL_RESETTABLE) NSOperationQueue *sessionDelegateQueue;
-
-
-
-
-
-
-
-
-
- - (BOOL)waitForCompletionWithTimeout:(NSTimeInterval)timeoutInSeconds;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- @property(atomic, copy, GTM_NULLABLE) GTMSessionFetcherTestBlock testBlock;
-
- + (void)setGlobalTestBlock:(GTM_NULLABLE GTMSessionFetcherTestBlock)block;
-
-
-
-
-
- @property(atomic, readwrite) NSUInteger testBlockAccumulateDataChunkCount;
-
- #if GTM_BACKGROUND_TASK_FETCHING
-
-
- + (void)setSubstituteUIApplication:(nullable id<GTMUIApplicationProtocol>)substituteUIApplication;
- + (nullable id<GTMUIApplicationProtocol>)substituteUIApplication;
- #endif // GTM_BACKGROUND_TASK_FETCHING
-
-
- + (GTMSessionCookieStorage *)staticCookieStorage;
- + (BOOL)appAllowsInsecureRequests;
-
- #if STRIP_GTM_FETCH_LOGGING
-
-
- + (void)setLoggingEnabled:(BOOL)flag;
- + (BOOL)isLoggingEnabled;
-
- #else
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- @property(atomic, copy, GTM_NULLABLE) NSString *logRequestBody;
- @property(atomic, assign) BOOL deferResponseBodyLogging;
- @property(atomic, copy, GTM_NULLABLE) NSString *logResponseBody;
-
-
- @property(atomic, readonly) NSData *loggedStreamData;
- @property(atomic, assign) BOOL hasLoggedError;
- @property(atomic, strong, GTM_NULLABLE) NSURL *redirectedFromURL;
- - (void)appendLoggedStreamData:(NSData *)dataToAdd;
- - (void)clearLoggedStreamData;
-
- #endif // STRIP_GTM_FETCH_LOGGING
-
- @end
-
- @interface GTMSessionFetcher (BackwardsCompatibilityOnly)
-
-
- - (void)setCookieStorageMethod:(NSInteger)method;
- @end
-
-
-
-
-
-
-
- @interface GTMSessionCookieStorage : NSHTTPCookieStorage
-
-
-
- - (void)setCookies:(GTM_NULLABLE GTM_NSArrayOf(NSHTTPCookie *) *)cookies;
-
- - (void)removeAllCookies;
-
- @end
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- #ifdef __OBJC__
-
-
-
-
- #if DEBUG && (!defined(NS_BLOCK_ASSERTIONS) || GTMSESSION_ASSERT_AS_LOG)
- #define __GTMSessionMonitorSynchronizedVariableInner(varname, counter) \
- varname ## counter
- #define __GTMSessionMonitorSynchronizedVariable(varname, counter) \
- __GTMSessionMonitorSynchronizedVariableInner(varname, counter)
-
- #define GTMSessionMonitorSynchronized(obj) \
- NS_VALID_UNTIL_END_OF_SCOPE id \
- __GTMSessionMonitorSynchronizedVariable(__monitor, __COUNTER__) = \
- [[GTMSessionSyncMonitorInternal alloc] initWithSynchronizationObject:obj \
- allowRecursive:NO \
- functionName:__func__]
-
- #define GTMSessionMonitorRecursiveSynchronized(obj) \
- NS_VALID_UNTIL_END_OF_SCOPE id \
- __GTMSessionMonitorSynchronizedVariable(__monitor, __COUNTER__) = \
- [[GTMSessionSyncMonitorInternal alloc] initWithSynchronizationObject:obj \
- allowRecursive:YES \
- functionName:__func__]
-
- #define GTMSessionCheckSynchronized(obj) { \
- GTMSESSION_ASSERT_DEBUG( \
- [GTMSessionSyncMonitorInternal functionsHoldingSynchronizationOnObject:obj], \
- @"GTMSessionCheckSynchronized(" #obj ") failed: not sync'd" \
- @" on " #obj " in %s. Call stack:\n%@", \
- __func__, [NSThread callStackSymbols]); \
- }
-
- #define GTMSessionCheckNotSynchronized(obj) { \
- GTMSESSION_ASSERT_DEBUG( \
- ![GTMSessionSyncMonitorInternal functionsHoldingSynchronizationOnObject:obj], \
- @"GTMSessionCheckNotSynchronized(" #obj ") failed: was sync'd" \
- @" on " #obj " in %s by %@. Call stack:\n%@", __func__, \
- [GTMSessionSyncMonitorInternal functionsHoldingSynchronizationOnObject:obj], \
- [NSThread callStackSymbols]); \
- }
-
-
-
-
-
-
- @interface GTMSessionSyncMonitorInternal : NSObject
- - (instancetype)initWithSynchronizationObject:(id)object
- allowRecursive:(BOOL)allowRecursive
- functionName:(const char *)functionName;
-
- + (NSArray *)functionsHoldingSynchronizationOnObject:(id)object;
- @end
-
- #else
- #define GTMSessionMonitorSynchronized(obj) do { } while (0)
- #define GTMSessionMonitorRecursiveSynchronized(obj) do { } while (0)
- #define GTMSessionCheckSynchronized(obj) do { } while (0)
- #define GTMSessionCheckNotSynchronized(obj) do { } while (0)
- #endif // !DEBUG
- #endif // __OBJC__
-
-
- GTM_ASSUME_NONNULL_END
|