No Description

RNFetchBlobNetwork.h 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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) long long expectedBytes;
  23. @property (nonatomic) long long receivedBytes;
  24. @property (nonatomic) BOOL isServerPush;
  25. @property (nullable, nonatomic) NSMutableData * respData;
  26. @property (nullable, strong, nonatomic) RCTResponseSenderBlock callback;
  27. @property (nullable, nonatomic) RCTBridge * bridge;
  28. @property (nullable, nonatomic) NSDictionary * options;
  29. @property (nullable, nonatomic) RNFetchBlobFS * fileStream;
  30. @property (nullable, nonatomic) NSError * error;
  31. + (NSMutableDictionary * _Nullable ) normalizeHeaders:(NSDictionary * _Nullable)headers;
  32. + (void) cancelRequest:(NSString * _Nonnull)taskId;
  33. + (void) emitExpiredTasks;
  34. + (void) enableProgressReport:(NSString * _Nonnull) taskId config:(RNFetchBlobProgress * _Nullable)config;
  35. + (void) enableUploadProgress:(NSString * _Nonnull) taskId config:(RNFetchBlobProgress * _Nullable)config;
  36. - (nullable id) init;
  37. - (void) sendRequest:(NSDictionary * _Nullable )options contentLength:(long)contentLength bridge:(RCTBridge * _Nullable)bridgeRef taskId:(NSString * _Nullable)taskId withRequest:(NSURLRequest * _Nullable)req callback:(_Nullable RCTResponseSenderBlock) callback;
  38. @end
  39. #endif /* RNFetchBlobNetwork_h */