Nav apraksta

RNFetchBlobNetwork.h 2.2KB

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