Renamed RCTDataManager to RCTNetworking
This commit is contained in:
parent
dc393162c3
commit
5263b23321
|
@ -18,7 +18,7 @@ var SourceMapConsumer = require('SourceMap').SourceMapConsumer;
|
||||||
var SourceMapURL = require('./source-map-url');
|
var SourceMapURL = require('./source-map-url');
|
||||||
|
|
||||||
var RCTSourceCode = NativeModules.SourceCode;
|
var RCTSourceCode = NativeModules.SourceCode;
|
||||||
var RCTDataManager = NativeModules.DataManager;
|
var RCTNetworking = NativeModules.Networking;
|
||||||
|
|
||||||
function loadSourceMap(): Promise {
|
function loadSourceMap(): Promise {
|
||||||
return fetchSourceMap()
|
return fetchSourceMap()
|
||||||
|
@ -34,9 +34,9 @@ function fetchSourceMap(): Promise {
|
||||||
return Promise.reject(new Error('RCTSourceCode module is not available'));
|
return Promise.reject(new Error('RCTSourceCode module is not available'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!RCTDataManager) {
|
if (!RCTNetworking) {
|
||||||
// Used internally by fetch
|
// Used internally by fetch
|
||||||
return Promise.reject(new Error('RCTDataManager module is not available'));
|
return Promise.reject(new Error('RCTNetworking module is not available'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Promise(RCTSourceCode.getScriptText)
|
return new Promise(RCTSourceCode.getScriptText)
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
1372B7371AB03E7B00659ED6 /* RCTReachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 1372B7361AB03E7B00659ED6 /* RCTReachability.m */; };
|
1372B7371AB03E7B00659ED6 /* RCTReachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 1372B7361AB03E7B00659ED6 /* RCTReachability.m */; };
|
||||||
352DA0BA1B17855800AA15A8 /* RCTHTTPRequestHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 352DA0B81B17855800AA15A8 /* RCTHTTPRequestHandler.m */; };
|
352DA0BA1B17855800AA15A8 /* RCTHTTPRequestHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 352DA0B81B17855800AA15A8 /* RCTHTTPRequestHandler.m */; };
|
||||||
58B512081A9E6CE300147676 /* RCTDataManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 58B512071A9E6CE300147676 /* RCTDataManager.m */; };
|
58B512081A9E6CE300147676 /* RCTNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = 58B512071A9E6CE300147676 /* RCTNetworking.m */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXCopyFilesBuildPhase section */
|
/* Begin PBXCopyFilesBuildPhase section */
|
||||||
|
@ -30,8 +30,8 @@
|
||||||
352DA0B71B17855800AA15A8 /* RCTHTTPRequestHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTHTTPRequestHandler.h; sourceTree = "<group>"; };
|
352DA0B71B17855800AA15A8 /* RCTHTTPRequestHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTHTTPRequestHandler.h; sourceTree = "<group>"; };
|
||||||
352DA0B81B17855800AA15A8 /* RCTHTTPRequestHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTHTTPRequestHandler.m; sourceTree = "<group>"; };
|
352DA0B81B17855800AA15A8 /* RCTHTTPRequestHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTHTTPRequestHandler.m; sourceTree = "<group>"; };
|
||||||
58B511DB1A9E6C8500147676 /* libRCTNetwork.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTNetwork.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
58B511DB1A9E6C8500147676 /* libRCTNetwork.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTNetwork.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
58B512061A9E6CE300147676 /* RCTDataManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTDataManager.h; sourceTree = "<group>"; };
|
58B512061A9E6CE300147676 /* RCTNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTNetworking.h; sourceTree = "<group>"; };
|
||||||
58B512071A9E6CE300147676 /* RCTDataManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTDataManager.m; sourceTree = "<group>"; };
|
58B512071A9E6CE300147676 /* RCTNetworking.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTNetworking.m; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
@ -48,8 +48,8 @@
|
||||||
58B511D21A9E6C8500147676 = {
|
58B511D21A9E6C8500147676 = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
58B512061A9E6CE300147676 /* RCTDataManager.h */,
|
58B512061A9E6CE300147676 /* RCTNetworking.h */,
|
||||||
58B512071A9E6CE300147676 /* RCTDataManager.m */,
|
58B512071A9E6CE300147676 /* RCTNetworking.m */,
|
||||||
352DA0B71B17855800AA15A8 /* RCTHTTPRequestHandler.h */,
|
352DA0B71B17855800AA15A8 /* RCTHTTPRequestHandler.h */,
|
||||||
352DA0B81B17855800AA15A8 /* RCTHTTPRequestHandler.m */,
|
352DA0B81B17855800AA15A8 /* RCTHTTPRequestHandler.m */,
|
||||||
1372B7351AB03E7B00659ED6 /* RCTReachability.h */,
|
1372B7351AB03E7B00659ED6 /* RCTReachability.h */,
|
||||||
|
@ -125,7 +125,7 @@
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
1372B7371AB03E7B00659ED6 /* RCTReachability.m in Sources */,
|
1372B7371AB03E7B00659ED6 /* RCTReachability.m in Sources */,
|
||||||
58B512081A9E6CE300147676 /* RCTDataManager.m in Sources */,
|
58B512081A9E6CE300147676 /* RCTNetworking.m in Sources */,
|
||||||
352DA0BA1B17855800AA15A8 /* RCTHTTPRequestHandler.m in Sources */,
|
352DA0BA1B17855800AA15A8 /* RCTHTTPRequestHandler.m in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
#import "RCTBridgeModule.h"
|
#import "RCTBridgeModule.h"
|
||||||
|
|
||||||
@interface RCTDataManager : NSObject <RCTBridgeModule>
|
@interface RCTNetworking : NSObject <RCTBridgeModule>
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#import "RCTDataManager.h"
|
#import "RCTNetworking.h"
|
||||||
|
|
||||||
#import "RCTAssert.h"
|
#import "RCTAssert.h"
|
||||||
#import "RCTConvert.h"
|
#import "RCTConvert.h"
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
typedef void (^RCTHTTPQueryResult)(NSError *error, NSDictionary *result);
|
typedef void (^RCTHTTPQueryResult)(NSError *error, NSDictionary *result);
|
||||||
|
|
||||||
@interface RCTDataManager ()<RCTURLRequestDelegate>
|
@interface RCTNetworking ()<RCTURLRequestDelegate>
|
||||||
|
|
||||||
- (void)processDataForHTTPQuery:(NSDictionary *)data callback:(void (^)(NSError *error, NSDictionary *result))callback;
|
- (void)processDataForHTTPQuery:(NSDictionary *)data callback:(void (^)(NSError *error, NSDictionary *result))callback;
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ typedef void (^RCTHTTPQueryResult)(NSError *error, NSDictionary *result);
|
||||||
*/
|
*/
|
||||||
@interface RCTHTTPFormDataHelper : NSObject
|
@interface RCTHTTPFormDataHelper : NSObject
|
||||||
|
|
||||||
@property (nonatomic, weak) RCTDataManager *dataManager;
|
@property (nonatomic, weak) RCTNetworking *dataManager;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ typedef void (^RCTDataLoaderCallback)(NSData *data, NSString *MIMEType, NSError
|
||||||
/**
|
/**
|
||||||
* Bridge module that provides the JS interface to the network stack.
|
* Bridge module that provides the JS interface to the network stack.
|
||||||
*/
|
*/
|
||||||
@implementation RCTDataManager
|
@implementation RCTNetworking
|
||||||
{
|
{
|
||||||
NSInteger _currentRequestID;
|
NSInteger _currentRequestID;
|
||||||
NSMapTable *_activeRequests;
|
NSMapTable *_activeRequests;
|
|
@ -12,7 +12,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var FormData = require('FormData');
|
var FormData = require('FormData');
|
||||||
var RCTDataManager = require('NativeModules').DataManager;
|
var RCTNetworking = require('NativeModules').Networking;
|
||||||
var RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
|
var RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
|
||||||
|
|
||||||
var XMLHttpRequestBase = require('XMLHttpRequestBase');
|
var XMLHttpRequestBase = require('XMLHttpRequestBase');
|
||||||
|
@ -89,7 +89,7 @@ class XMLHttpRequest extends XMLHttpRequestBase {
|
||||||
if (data instanceof FormData) {
|
if (data instanceof FormData) {
|
||||||
data = {formData: data.getParts()};
|
data = {formData: data.getParts()};
|
||||||
}
|
}
|
||||||
RCTDataManager.sendRequest(
|
RCTNetworking.sendRequest(
|
||||||
{
|
{
|
||||||
method,
|
method,
|
||||||
url,
|
url,
|
||||||
|
@ -103,7 +103,7 @@ class XMLHttpRequest extends XMLHttpRequestBase {
|
||||||
|
|
||||||
abortImpl(): void {
|
abortImpl(): void {
|
||||||
if (this._requestId) {
|
if (this._requestId) {
|
||||||
RCTDataManager.cancelRequest(this._requestId);
|
RCTNetworking.cancelRequest(this._requestId);
|
||||||
this._clearSubscriptions();
|
this._clearSubscriptions();
|
||||||
this._requestId = null;
|
this._requestId = null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue