暂无描述

RNFetchBlobNetwork.h 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //
  2. // RNFetchBlobNetwork.h
  3. // RNFetchBlob
  4. //
  5. // Created by wkh237 on 2016/6/6.
  6. // Copyright © 2016 wkh237. All rights reserved.
  7. //
  8. #ifndef RNFetchBlobNetwork_h
  9. #define RNFetchBlobNetwork_h
  10. #import <Foundation/Foundation.h>
  11. #import "RCTBridgeModule.h"
  12. #import "RNFetchBlobProgress.h"
  13. #import "RNFetchBlobFS.h"
  14. typedef void(^CompletionHander)(NSURL * _Nullable location, NSURLResponse * _Nullable response, NSError * _Nullable error);
  15. typedef void(^DataTaskCompletionHander) (NSData * _Nullable resp, NSURLResponse * _Nullable response, NSError * _Nullable error);
  16. @interface RNFetchBlobNetwork : NSObject <NSURLSessionDelegate, NSURLSessionTaskDelegate, NSURLSessionDataDelegate>
  17. @property (nullable, nonatomic) NSString * taskId;
  18. @property (nonatomic) int expectedBytes;
  19. @property (nonatomic) int receivedBytes;
  20. @property (nonatomic) BOOL isServerPush;
  21. @property (nullable, nonatomic) NSMutableData * respData;
  22. @property (strong, nonatomic) RCTResponseSenderBlock callback;
  23. @property (nullable, nonatomic) RCTBridge * bridge;
  24. @property (nullable, nonatomic) NSDictionary * options;
  25. @property (nullable, nonatomic) RNFetchBlobFS * fileStream;
  26. @property (strong, nonatomic) CompletionHander fileTaskCompletionHandler;
  27. @property (strong, nonatomic) DataTaskCompletionHander dataTaskCompletionHandler;
  28. @property (nullable, nonatomic) NSError * error;
  29. + (NSMutableDictionary * _Nullable ) normalizeHeaders:(NSDictionary * _Nullable)headers;
  30. + (void) cancelRequest:(NSString *)taskId;
  31. + (void) enableProgressReport:(NSString *) taskId;
  32. + (void) enableUploadProgress:(NSString *) taskId;
  33. + (void) emitExpiredTasks;
  34. - (nullable id) init;
  35. - (void) sendRequest;
  36. - (void) sendRequest:(NSDictionary * _Nullable )options contentLength:(long)contentLength bridge:(RCTBridge * _Nullable)bridgeRef taskId:(NSString * _Nullable)taskId withRequest:(NSURLRequest * _Nullable)req callback:(_Nullable RCTResponseSenderBlock) callback;
  37. + (void) enableProgressReport:(NSString *) taskId config:(RNFetchBlobProgress *)config;
  38. + (void) enableUploadProgress:(NSString *) taskId config:(RNFetchBlobProgress *)config;
  39. + (NSArray *) getCookies:(NSString *) url;
  40. @end
  41. #endif /* RNFetchBlobNetwork_h */