Нет описания

RNFetchBlobNetwork.h 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 RNFetchBlobResp_h
  9. #define RNFetchBlobResp_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. - (nullable id) init;
  30. - (void) sendRequest;
  31. + (NSMutableDictionary * _Nullable ) normalizeHeaders:(NSDictionary * _Nullable)headers;
  32. + (void) cancelRequest:(NSString *)taskId;
  33. + (void) enableProgressReport:(NSString *) taskId config:(RNFetchBlobProgress *)config;
  34. + (void) enableUploadProgress:(NSString *) taskId config:(RNFetchBlobProgress *)config;
  35. - (void) sendRequest:(NSDictionary * _Nullable )options contentLength:(long)contentLength bridge:(RCTBridge * _Nullable)bridgeRef taskId:(NSString * _Nullable)taskId withRequest:(NSURLRequest * _Nullable)req callback:(_Nullable RCTResponseSenderBlock) callback;
  36. @end
  37. #endif /* RNFetchBlobResp_h */