react-native 0.83.0-nightly-20251007-854268275 → 0.83.0-nightly-20251009-24d0d4414
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Libraries/Animated/nodes/AnimatedColor.js +26 -10
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Network/RCTInspectorNetworkReporter.h +8 -8
- package/Libraries/Network/RCTInspectorNetworkReporter.mm +18 -20
- package/Libraries/Network/RCTNetworkTask.h +5 -1
- package/Libraries/Network/RCTNetworkTask.mm +13 -0
- package/Libraries/Network/RCTNetworking+Internal.h +21 -0
- package/Libraries/Network/RCTNetworking.h +3 -0
- package/Libraries/Network/RCTNetworking.ios.js +3 -0
- package/Libraries/Network/RCTNetworking.mm +81 -34
- package/React/Base/RCTBridgeModule.h +2 -2
- package/React/Base/RCTVersion.m +1 -1
- package/React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h +6 -0
- package/React/FBReactNativeSpec/FBReactNativeSpecJSI-generated.cpp +6 -0
- package/React/FBReactNativeSpec/FBReactNativeSpecJSI.h +9 -0
- package/ReactAndroid/api/ReactAndroid.api +21 -0
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/animated/InterpolationAnimatedNode.kt +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt +7 -1
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt +11 -1
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt +3 -1
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt +3 -1
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt +12 -1
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt +3 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/appearance/AppearanceModule.kt +12 -0
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java +10 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollViewManager.kt +3 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java +19 -1
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewHelper.kt +45 -16
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewManager.kt +3 -0
- package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp +15 -1
- package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h +4 -1
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/ReactCommon/hermes/executor/HermesExecutorFactory.cpp +68 -1
- package/ReactCommon/hermes/inspector-modern/chrome/ConnectionDemux.cpp +142 -0
- package/ReactCommon/hermes/inspector-modern/chrome/ConnectionDemux.h +62 -0
- package/ReactCommon/hermes/inspector-modern/chrome/HermesRuntimeAgentDelegate.cpp +3 -4
- package/ReactCommon/hermes/inspector-modern/chrome/HermesRuntimeTargetDelegate.cpp +54 -0
- package/ReactCommon/hermes/inspector-modern/chrome/HermesRuntimeTargetDelegate.h +3 -0
- package/ReactCommon/hermes/inspector-modern/chrome/Registration.cpp +37 -0
- package/ReactCommon/hermes/inspector-modern/chrome/Registration.h +41 -0
- package/ReactCommon/jsinspector-modern/CMakeLists.txt +1 -0
- package/ReactCommon/jsinspector-modern/EnumArray.h +45 -0
- package/ReactCommon/jsinspector-modern/FallbackRuntimeTargetDelegate.cpp +6 -0
- package/ReactCommon/jsinspector-modern/FallbackRuntimeTargetDelegate.h +3 -0
- package/ReactCommon/jsinspector-modern/HostAgent.cpp +19 -0
- package/ReactCommon/jsinspector-modern/NetworkIOAgent.cpp +4 -4
- package/ReactCommon/jsinspector-modern/React-jsinspector.podspec +1 -1
- package/ReactCommon/jsinspector-modern/RuntimeAgent.cpp +46 -17
- package/ReactCommon/jsinspector-modern/RuntimeTarget.cpp +64 -18
- package/ReactCommon/jsinspector-modern/RuntimeTarget.h +67 -9
- package/ReactCommon/jsinspector-modern/RuntimeTargetConsole.cpp +10 -28
- package/ReactCommon/jsinspector-modern/RuntimeTargetNetwork.cpp +98 -0
- package/ReactCommon/jsinspector-modern/ScopedExecutor.h +29 -0
- package/ReactCommon/jsinspector-modern/SessionState.h +1 -0
- package/ReactCommon/jsinspector-modern/network/NetworkHandler.cpp +33 -3
- package/ReactCommon/jsinspector-modern/network/NetworkHandler.h +12 -1
- package/ReactCommon/jsinspector-modern/tests/DebuggerSessionObserverTest.cpp +44 -0
- package/ReactCommon/jsinspector-modern/tests/InspectorMocks.h +5 -0
- package/ReactCommon/jsinspector-modern/tests/JsiIntegrationTest.cpp +82 -0
- package/ReactCommon/jsinspector-modern/tests/JsiIntegrationTest.h +54 -0
- package/ReactCommon/jsinspector-modern/tests/NetworkReporterTest.cpp +126 -0
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp +5 -1
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h +6 -1
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp +37 -19
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h +4 -2
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h +5 -1
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h +10 -1
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h +2 -1
- package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp +7 -2
- package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h +4 -2
- package/ReactCommon/react/renderer/animated/NativeAnimatedNodesManager.cpp +8 -3
- package/ReactCommon/react/renderer/animated/NativeAnimatedNodesManager.h +3 -2
- package/ReactCommon/react/renderer/animated/NativeAnimatedNodesManagerProvider.h +1 -1
- package/ReactCommon/react/renderer/animationbackend/AnimationBackend.h +13 -11
- package/ReactCommon/react/renderer/components/scrollview/platform/android/react/renderer/components/scrollview/AndroidHorizontalScrollContentViewShadowNode.h +5 -1
- package/ReactCommon/react/renderer/graphics/Transform.h +2 -3
- package/ReactCommon/react/renderer/graphics/platform/android/react/renderer/graphics/PlatformColorParser.h +59 -23
- package/ReactCommon/react/renderer/graphics/platform/android/react/renderer/graphics/configurePlatformColorCacheInvalidationHook.cpp +27 -0
- package/ReactCommon/react/renderer/graphics/platform/android/react/renderer/graphics/configurePlatformColorCacheInvalidationHook.h +12 -0
- package/ReactCommon/react/renderer/imagemanager/platform/android/react/renderer/imagemanager/ImageFetcher.cpp +37 -12
- package/ReactCommon/react/renderer/imagemanager/platform/android/react/renderer/imagemanager/ImageFetcher.h +7 -14
- package/ReactCommon/react/renderer/uimanager/UIManager.cpp +3 -2
- package/ReactCommon/react/renderer/uimanager/UIManager.h +8 -4
- package/ReactCommon/react/renderer/uimanager/UIManagerAnimationBackend.h +24 -0
- package/ReactCommon/react/runtime/hermes/HermesInstance.cpp +89 -0
- package/ReactCommon/react/utils/CMakeLists.txt +1 -1
- package/ReactCommon/react/utils/Uuid.cpp +69 -0
- package/ReactCommon/react/utils/Uuid.h +20 -0
- package/ReactCommon/react/utils/tests/UuidTest.cpp +28 -0
- package/package.json +8 -8
- package/sdks/hermes-engine/hermes-engine.podspec +14 -0
- package/sdks/hermes-engine/utils/build-apple-framework.sh +12 -0
- package/sdks/hermesc/osx-bin/hermes +0 -0
- package/sdks/hermesc/osx-bin/hermesc +0 -0
- package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
- package/src/private/featureflags/ReactNativeFeatureFlags.js +6 -1
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +2 -1
- package/src/private/specs_DEPRECATED/modules/NativeNetworkingIOS.js +1 -0
- package/types_generated/Libraries/Animated/nodes/AnimatedColor.d.ts +5 -1
|
@@ -110,6 +110,27 @@ function isRgbaAnimatedValue(value: any): boolean {
|
|
|
110
110
|
);
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
export function getRgbaValueAndNativeColor(
|
|
114
|
+
value: RgbaValue | ColorValue,
|
|
115
|
+
): $ReadOnly<{
|
|
116
|
+
rgbaValue: RgbaValue,
|
|
117
|
+
nativeColor?: NativeColorValue,
|
|
118
|
+
}> {
|
|
119
|
+
const processedColor: RgbaValue | NativeColorValue =
|
|
120
|
+
// $FlowFixMe[incompatible-type] - Type is verified above
|
|
121
|
+
processColor((value: ColorValue | RgbaValue)) ?? defaultColor;
|
|
122
|
+
if (isRgbaValue(processedColor)) {
|
|
123
|
+
// $FlowFixMe[incompatible-type] - Type is verified above
|
|
124
|
+
return {rgbaValue: (processedColor: RgbaValue)};
|
|
125
|
+
} else {
|
|
126
|
+
return {
|
|
127
|
+
// $FlowFixMe[incompatible-type] - Type is verified above
|
|
128
|
+
nativeColor: (processedColor: NativeColorValue),
|
|
129
|
+
rgbaValue: defaultColor,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
113
134
|
export default class AnimatedColor extends AnimatedWithChildren {
|
|
114
135
|
r: AnimatedValue;
|
|
115
136
|
g: AnimatedValue;
|
|
@@ -132,18 +153,13 @@ export default class AnimatedColor extends AnimatedWithChildren {
|
|
|
132
153
|
this.b = rgbaAnimatedValue.b;
|
|
133
154
|
this.a = rgbaAnimatedValue.a;
|
|
134
155
|
} else {
|
|
135
|
-
const
|
|
136
|
-
// $FlowFixMe[incompatible-type] - Type is verified above
|
|
137
|
-
processColor((value: ColorValue | RgbaValue)) ?? defaultColor;
|
|
138
|
-
let initColor: RgbaValue = defaultColor;
|
|
139
|
-
if (isRgbaValue(processedColor)) {
|
|
156
|
+
const {rgbaValue: initColor, nativeColor} = getRgbaValueAndNativeColor(
|
|
140
157
|
// $FlowFixMe[incompatible-type] - Type is verified above
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
this.nativeColor =
|
|
158
|
+
(value: ColorValue | RgbaValue),
|
|
159
|
+
);
|
|
160
|
+
if (nativeColor) {
|
|
161
|
+
this.nativeColor = nativeColor;
|
|
145
162
|
}
|
|
146
|
-
|
|
147
163
|
this.r = new AnimatedValue(initColor.r);
|
|
148
164
|
this.g = new AnimatedValue(initColor.g);
|
|
149
165
|
this.b = new AnimatedValue(initColor.b);
|
|
@@ -29,7 +29,7 @@ export default class ReactNativeVersion {
|
|
|
29
29
|
static major: number = 0;
|
|
30
30
|
static minor: number = 83;
|
|
31
31
|
static patch: number = 0;
|
|
32
|
-
static prerelease: string | null = 'nightly-
|
|
32
|
+
static prerelease: string | null = 'nightly-20251009-24d0d4414';
|
|
33
33
|
|
|
34
34
|
static getVersionString(): string {
|
|
35
35
|
return `${this.major}.${this.minor}.${this.patch}${this.prerelease != null ? `-${this.prerelease}` : ''}`;
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* - Corresponds to `PerformanceResourceTiming.requestStart` (specifically,
|
|
28
28
|
* marking when the native request was initiated).
|
|
29
29
|
*/
|
|
30
|
-
+ (void)reportRequestStart:(
|
|
30
|
+
+ (void)reportRequestStart:(NSString *)requestId
|
|
31
31
|
request:(NSURLRequest *)request
|
|
32
32
|
encodedDataLength:(int)encodedDataLength;
|
|
33
33
|
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
* `PerformanceResourceTiming.connectStart`. Defined as "immediately before
|
|
41
41
|
* the browser starts to establish the connection to the server".
|
|
42
42
|
*/
|
|
43
|
-
+ (void)reportConnectionTiming:(
|
|
43
|
+
+ (void)reportConnectionTiming:(NSString *)requestId request:(NSURLRequest *)request;
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
46
|
* Report when HTTP response headers have been received, corresponding to
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
* - Corresponds to `Network.responseReceived` in CDP.
|
|
50
50
|
* - Corresponds to `PerformanceResourceTiming.responseStart`.
|
|
51
51
|
*/
|
|
52
|
-
+ (void)reportResponseStart:(
|
|
52
|
+
+ (void)reportResponseStart:(NSString *)requestId
|
|
53
53
|
response:(NSURLResponse *)response
|
|
54
54
|
statusCode:(int)statusCode
|
|
55
55
|
headers:(NSDictionary<NSString *, NSString *> *)headers;
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
*
|
|
60
60
|
* Corresponds to `Network.dataReceived` in CDP.
|
|
61
61
|
*/
|
|
62
|
-
+ (void)reportDataReceived:(
|
|
62
|
+
+ (void)reportDataReceived:(NSString *)requestId data:(NSData *)data;
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
65
|
* Report when a network request is complete and we are no longer receiving
|
|
@@ -68,20 +68,20 @@
|
|
|
68
68
|
* - Corresponds to `Network.loadingFinished` in CDP.
|
|
69
69
|
* - Corresponds to `PerformanceResourceTiming.responseEnd`.
|
|
70
70
|
*/
|
|
71
|
-
+ (void)reportResponseEnd:(
|
|
71
|
+
+ (void)reportResponseEnd:(NSString *)requestId encodedDataLength:(int)encodedDataLength;
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
74
|
* Report when a network request has failed.
|
|
75
75
|
*
|
|
76
76
|
* - Corresponds to `Network.loadingFailed` in CDP.
|
|
77
77
|
*/
|
|
78
|
-
+ (void)reportRequestFailed:(
|
|
78
|
+
+ (void)reportRequestFailed:(NSString *)requestId cancelled:(BOOL)cancelled;
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
81
|
* Store response body preview. This is an optional reporting method, and is a
|
|
82
82
|
* no-op if CDP debugging is disabled.
|
|
83
83
|
*/
|
|
84
|
-
+ (void)maybeStoreResponseBody:(
|
|
84
|
+
+ (void)maybeStoreResponseBody:(NSString *)requestId data:(NSData *)data base64Encoded:(bool)base64Encoded;
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
87
|
* Incrementally store a response body preview, when a string response is
|
|
@@ -91,6 +91,6 @@
|
|
|
91
91
|
* As with `maybeStoreResponseBody`, calling this method is optional and a
|
|
92
92
|
* no-op if CDP debugging is disabled.
|
|
93
93
|
*/
|
|
94
|
-
+ (void)maybeStoreResponseBodyIncremental:(
|
|
94
|
+
+ (void)maybeStoreResponseBodyIncremental:(NSString *)requestId data:(NSString *)data;
|
|
95
95
|
|
|
96
96
|
@end
|
|
@@ -48,14 +48,14 @@ std::string convertRequestBodyToStringTruncated(NSURLRequest *request)
|
|
|
48
48
|
#ifdef REACT_NATIVE_DEBUGGER_ENABLED
|
|
49
49
|
|
|
50
50
|
// Dictionary to buffer incremental response bodies (CDP debugging active only)
|
|
51
|
-
static const NSMutableDictionary<
|
|
51
|
+
static const NSMutableDictionary<NSString *, NSMutableString *> *responseBuffers = nil;
|
|
52
52
|
|
|
53
53
|
#endif
|
|
54
54
|
|
|
55
55
|
@implementation RCTInspectorNetworkReporter {
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
+ (void)reportRequestStart:(
|
|
58
|
+
+ (void)reportRequestStart:(NSString *)requestId
|
|
59
59
|
request:(NSURLRequest *)request
|
|
60
60
|
encodedDataLength:(int)encodedDataLength
|
|
61
61
|
{
|
|
@@ -68,11 +68,10 @@ static const NSMutableDictionary<NSNumber *, NSMutableString *> *responseBuffers
|
|
|
68
68
|
requestInfo.httpBody = convertRequestBodyToStringTruncated(request);
|
|
69
69
|
#endif
|
|
70
70
|
|
|
71
|
-
NetworkReporter::getInstance().reportRequestStart(
|
|
72
|
-
requestId.stringValue.UTF8String, requestInfo, encodedDataLength, std::nullopt);
|
|
71
|
+
NetworkReporter::getInstance().reportRequestStart(requestId.UTF8String, requestInfo, encodedDataLength, std::nullopt);
|
|
73
72
|
}
|
|
74
73
|
|
|
75
|
-
+ (void)reportConnectionTiming:(
|
|
74
|
+
+ (void)reportConnectionTiming:(NSString *)requestId request:(NSURLRequest *)request
|
|
76
75
|
{
|
|
77
76
|
Headers headersMap;
|
|
78
77
|
|
|
@@ -81,10 +80,10 @@ static const NSMutableDictionary<NSNumber *, NSMutableString *> *responseBuffers
|
|
|
81
80
|
headersMap = convertNSDictionaryToHeaders(request.allHTTPHeaderFields);
|
|
82
81
|
#endif
|
|
83
82
|
|
|
84
|
-
NetworkReporter::getInstance().reportConnectionTiming(requestId.
|
|
83
|
+
NetworkReporter::getInstance().reportConnectionTiming(requestId.UTF8String, headersMap);
|
|
85
84
|
}
|
|
86
85
|
|
|
87
|
-
+ (void)reportResponseStart:(
|
|
86
|
+
+ (void)reportResponseStart:(NSString *)requestId
|
|
88
87
|
response:(NSURLResponse *)response
|
|
89
88
|
statusCode:(int)statusCode
|
|
90
89
|
headers:(NSDictionary<NSString *, NSString *> *)headers
|
|
@@ -99,17 +98,17 @@ static const NSMutableDictionary<NSNumber *, NSMutableString *> *responseBuffers
|
|
|
99
98
|
#endif
|
|
100
99
|
|
|
101
100
|
NetworkReporter::getInstance().reportResponseStart(
|
|
102
|
-
requestId.
|
|
101
|
+
requestId.UTF8String, responseInfo, response.expectedContentLength);
|
|
103
102
|
}
|
|
104
103
|
|
|
105
|
-
+ (void)reportDataReceived:(
|
|
104
|
+
+ (void)reportDataReceived:(NSString *)requestId data:(NSData *)data
|
|
106
105
|
{
|
|
107
|
-
NetworkReporter::getInstance().reportDataReceived(requestId.
|
|
106
|
+
NetworkReporter::getInstance().reportDataReceived(requestId.UTF8String, (int)data.length, std::nullopt);
|
|
108
107
|
}
|
|
109
108
|
|
|
110
|
-
+ (void)reportResponseEnd:(
|
|
109
|
+
+ (void)reportResponseEnd:(NSString *)requestId encodedDataLength:(int)encodedDataLength
|
|
111
110
|
{
|
|
112
|
-
NetworkReporter::getInstance().reportResponseEnd(requestId.
|
|
111
|
+
NetworkReporter::getInstance().reportResponseEnd(requestId.UTF8String, encodedDataLength);
|
|
113
112
|
|
|
114
113
|
#ifdef REACT_NATIVE_DEBUGGER_ENABLED
|
|
115
114
|
// Debug build: Check for buffered response body and flush to NetworkReporter
|
|
@@ -118,7 +117,7 @@ static const NSMutableDictionary<NSNumber *, NSMutableString *> *responseBuffers
|
|
|
118
117
|
if (buffer != nullptr) {
|
|
119
118
|
if (buffer.length > 0) {
|
|
120
119
|
NetworkReporter::getInstance().storeResponseBody(
|
|
121
|
-
requestId.
|
|
120
|
+
requestId.UTF8String, RCTStringViewFromNSString(buffer), false);
|
|
122
121
|
}
|
|
123
122
|
[responseBuffers removeObjectForKey:requestId];
|
|
124
123
|
}
|
|
@@ -126,9 +125,9 @@ static const NSMutableDictionary<NSNumber *, NSMutableString *> *responseBuffers
|
|
|
126
125
|
#endif
|
|
127
126
|
}
|
|
128
127
|
|
|
129
|
-
+ (void)reportRequestFailed:(
|
|
128
|
+
+ (void)reportRequestFailed:(NSString *)requestId cancelled:(bool)cancelled
|
|
130
129
|
{
|
|
131
|
-
NetworkReporter::getInstance().reportRequestFailed(requestId.
|
|
130
|
+
NetworkReporter::getInstance().reportRequestFailed(requestId.UTF8String, cancelled);
|
|
132
131
|
|
|
133
132
|
#ifdef REACT_NATIVE_DEBUGGER_ENABLED
|
|
134
133
|
// Debug build: Clear buffer for request
|
|
@@ -138,7 +137,7 @@ static const NSMutableDictionary<NSNumber *, NSMutableString *> *responseBuffers
|
|
|
138
137
|
#endif
|
|
139
138
|
}
|
|
140
139
|
|
|
141
|
-
+ (void)maybeStoreResponseBody:(
|
|
140
|
+
+ (void)maybeStoreResponseBody:(NSString *)requestId data:(id)data base64Encoded:(bool)base64Encoded
|
|
142
141
|
{
|
|
143
142
|
#ifdef REACT_NATIVE_DEBUGGER_ENABLED
|
|
144
143
|
// Debug build: Process response body and report to NetworkReporter
|
|
@@ -152,7 +151,7 @@ static const NSMutableDictionary<NSNumber *, NSMutableString *> *responseBuffers
|
|
|
152
151
|
NSString *encodedString = [(NSData *)data base64EncodedStringWithOptions:0];
|
|
153
152
|
if (encodedString != nullptr) {
|
|
154
153
|
networkReporter.storeResponseBody(
|
|
155
|
-
requestId.
|
|
154
|
+
requestId.UTF8String, RCTStringViewFromNSString(encodedString), base64Encoded);
|
|
156
155
|
} else {
|
|
157
156
|
RCTLogWarn(@"Failed to encode response data for request %@", requestId);
|
|
158
157
|
}
|
|
@@ -160,13 +159,12 @@ static const NSMutableDictionary<NSNumber *, NSMutableString *> *responseBuffers
|
|
|
160
159
|
RCTLogWarn(@"Exception while encoding response data: %@", exception.reason);
|
|
161
160
|
}
|
|
162
161
|
} else if ([data isKindOfClass:[NSString class]] && [(NSString *)data length] > 0) {
|
|
163
|
-
networkReporter.storeResponseBody(
|
|
164
|
-
requestId.stringValue.UTF8String, RCTStringViewFromNSString((NSString *)data), base64Encoded);
|
|
162
|
+
networkReporter.storeResponseBody(requestId.UTF8String, RCTStringViewFromNSString((NSString *)data), base64Encoded);
|
|
165
163
|
}
|
|
166
164
|
#endif
|
|
167
165
|
}
|
|
168
166
|
|
|
169
|
-
+ (void)maybeStoreResponseBodyIncremental:(
|
|
167
|
+
+ (void)maybeStoreResponseBodyIncremental:(NSString *)requestId data:(NSString *)data
|
|
170
168
|
{
|
|
171
169
|
#ifdef REACT_NATIVE_DEBUGGER_ENABLED
|
|
172
170
|
// Debug build: Buffer incremental response body contents
|
|
@@ -28,6 +28,7 @@ typedef NS_ENUM(NSInteger, RCTNetworkTaskStatus) {
|
|
|
28
28
|
@property (nonatomic, readonly) NSNumber *requestID;
|
|
29
29
|
@property (nonatomic, readonly, weak) id requestToken;
|
|
30
30
|
@property (nonatomic, readonly) NSURLResponse *response;
|
|
31
|
+
@property (nonatomic, readonly) NSString *devToolsRequestId;
|
|
31
32
|
|
|
32
33
|
@property (nonatomic, copy) RCTURLRequestCompletionBlock completionBlock;
|
|
33
34
|
@property (nonatomic, copy) RCTURLRequestProgressBlock downloadProgressBlock;
|
|
@@ -40,7 +41,10 @@ typedef NS_ENUM(NSInteger, RCTNetworkTaskStatus) {
|
|
|
40
41
|
- (instancetype)initWithRequest:(NSURLRequest *)request
|
|
41
42
|
handler:(id<RCTURLRequestHandler>)handler
|
|
42
43
|
callbackQueue:(dispatch_queue_t)callbackQueue NS_DESIGNATED_INITIALIZER;
|
|
43
|
-
|
|
44
|
+
- (instancetype)initWithDevToolsRequestId:(NSString *)devToolsRequestId
|
|
45
|
+
request:(NSURLRequest *)request
|
|
46
|
+
handler:(id<RCTURLRequestHandler>)handler
|
|
47
|
+
callbackQueue:(dispatch_queue_t)callbackQueue;
|
|
44
48
|
- (void)start;
|
|
45
49
|
- (void)cancel;
|
|
46
50
|
|
|
@@ -26,6 +26,15 @@ static auto currentRequestId = std::atomic<NSUInteger>(0);
|
|
|
26
26
|
- (instancetype)initWithRequest:(NSURLRequest *)request
|
|
27
27
|
handler:(id<RCTURLRequestHandler>)handler
|
|
28
28
|
callbackQueue:(dispatch_queue_t)callbackQueue
|
|
29
|
+
{
|
|
30
|
+
self = [self initWithDevToolsRequestId:nil request:request handler:handler callbackQueue:callbackQueue];
|
|
31
|
+
return self;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
- (instancetype)initWithDevToolsRequestId:(NSString *)devToolsRequestId
|
|
35
|
+
request:(NSURLRequest *)request
|
|
36
|
+
handler:(id<RCTURLRequestHandler>)handler
|
|
37
|
+
callbackQueue:(dispatch_queue_t)callbackQueue
|
|
29
38
|
{
|
|
30
39
|
RCTAssertParam(request);
|
|
31
40
|
RCTAssertParam(handler);
|
|
@@ -33,6 +42,10 @@ static auto currentRequestId = std::atomic<NSUInteger>(0);
|
|
|
33
42
|
|
|
34
43
|
if ((self = [super init])) {
|
|
35
44
|
_requestID = @(currentRequestId++);
|
|
45
|
+
_devToolsRequestId = devToolsRequestId;
|
|
46
|
+
if (_devToolsRequestId == nil) {
|
|
47
|
+
_devToolsRequestId = [[NSUUID UUID] UUIDString];
|
|
48
|
+
}
|
|
36
49
|
_request = request;
|
|
37
50
|
_handler = handler;
|
|
38
51
|
_callbackQueue = callbackQueue;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#import "RCTNetworking.h"
|
|
9
|
+
|
|
10
|
+
@protocol RCTNetworkingTextResponseHandler <NSObject>
|
|
11
|
+
|
|
12
|
+
- (BOOL)canHandleNetworkingTextResponseForRequest:(NSURLRequest *)request;
|
|
13
|
+
- (void)handleNetworkingResponseText:(NSString *)responseText request:(NSURLRequest *)request;
|
|
14
|
+
|
|
15
|
+
@end
|
|
16
|
+
|
|
17
|
+
@interface RCTNetworking (Internal)
|
|
18
|
+
|
|
19
|
+
- (void)addTextResponseHandler:(id<RCTNetworkingTextResponseHandler>)handler;
|
|
20
|
+
|
|
21
|
+
@end
|
|
@@ -47,6 +47,9 @@
|
|
|
47
47
|
*/
|
|
48
48
|
- (RCTNetworkTask *)networkTaskWithRequest:(NSURLRequest *)request
|
|
49
49
|
completionBlock:(RCTURLRequestCompletionBlock)completionBlock;
|
|
50
|
+
- (RCTNetworkTask *)networkTaskWithDevToolsRequestId:(NSString *)devToolsRequestId
|
|
51
|
+
request:(NSURLRequest *)request
|
|
52
|
+
completionBlock:(RCTURLRequestCompletionBlock)completionBlock;
|
|
50
53
|
|
|
51
54
|
- (void)addRequestHandler:(id<RCTNetworkingRequestHandler>)handler;
|
|
52
55
|
|
|
@@ -40,6 +40,8 @@ const RCTNetworking = {
|
|
|
40
40
|
withCredentials: boolean,
|
|
41
41
|
) {
|
|
42
42
|
const body = convertRequestBody(data);
|
|
43
|
+
const devToolsRequestId =
|
|
44
|
+
global.__NETWORK_REPORTER__?.createDevToolsRequestId();
|
|
43
45
|
NativeNetworkingIOS.sendRequest(
|
|
44
46
|
{
|
|
45
47
|
method,
|
|
@@ -50,6 +52,7 @@ const RCTNetworking = {
|
|
|
50
52
|
incrementalUpdates,
|
|
51
53
|
timeout,
|
|
52
54
|
withCredentials,
|
|
55
|
+
unstable_devToolsRequestId: devToolsRequestId,
|
|
53
56
|
},
|
|
54
57
|
callback,
|
|
55
58
|
);
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
#import <React/RCTConvert.h>
|
|
13
13
|
#import <React/RCTLog.h>
|
|
14
14
|
#import <React/RCTNetworkTask.h>
|
|
15
|
-
#import <React/RCTNetworking.h>
|
|
16
15
|
#import <React/RCTUtils.h>
|
|
17
16
|
|
|
18
17
|
#import <React/RCTHTTPRequestHandler.h>
|
|
@@ -20,6 +19,8 @@
|
|
|
20
19
|
|
|
21
20
|
#import "RCTInspectorNetworkReporter.h"
|
|
22
21
|
#import "RCTNetworkPlugins.h"
|
|
22
|
+
#import "RCTNetworking+Internal.h"
|
|
23
|
+
#import "RCTNetworking.h"
|
|
23
24
|
|
|
24
25
|
typedef RCTURLRequestCancellationBlock (^RCTHTTPQueryResult)(NSError *error, NSDictionary<NSString *, id> *result);
|
|
25
26
|
|
|
@@ -28,6 +29,7 @@ NSString *const RCTNetworkingPHUploadHackScheme = @"ph-upload";
|
|
|
28
29
|
@interface RCTNetworking () <NativeNetworkingIOSSpec>
|
|
29
30
|
|
|
30
31
|
- (RCTURLRequestCancellationBlock)processDataForHTTPQuery:(NSDictionary<NSString *, id> *)data
|
|
32
|
+
devToolsRequestId:(NSString *)devToolsRequestId
|
|
31
33
|
callback:(RCTHTTPQueryResult)callback;
|
|
32
34
|
@end
|
|
33
35
|
|
|
@@ -69,7 +71,9 @@ static NSString *RCTGenerateFormBoundary()
|
|
|
69
71
|
freeWhenDone:YES];
|
|
70
72
|
}
|
|
71
73
|
|
|
72
|
-
- (RCTURLRequestCancellationBlock)process:(NSArray<NSDictionary *> *)formData
|
|
74
|
+
- (RCTURLRequestCancellationBlock)process:(NSArray<NSDictionary *> *)formData
|
|
75
|
+
devToolsRequestId:(NSString *)devToolsRequestId
|
|
76
|
+
callback:(RCTHTTPQueryResult)callback
|
|
73
77
|
{
|
|
74
78
|
RCTAssertThread(_networker.methodQueue, @"process: must be called on request queue");
|
|
75
79
|
|
|
@@ -93,12 +97,15 @@ static NSString *RCTGenerateFormBoundary()
|
|
|
93
97
|
}
|
|
94
98
|
|
|
95
99
|
return [_networker processDataForHTTPQuery:_parts[0]
|
|
100
|
+
devToolsRequestId:devToolsRequestId
|
|
96
101
|
callback:^(NSError *error, NSDictionary<NSString *, id> *result) {
|
|
97
|
-
return [self handleResult:result error:error];
|
|
102
|
+
return [self handleResult:result error:error devToolsRequestId:devToolsRequestId];
|
|
98
103
|
}];
|
|
99
104
|
}
|
|
100
105
|
|
|
101
|
-
- (RCTURLRequestCancellationBlock)handleResult:(NSDictionary<NSString *, id> *)result
|
|
106
|
+
- (RCTURLRequestCancellationBlock)handleResult:(NSDictionary<NSString *, id> *)result
|
|
107
|
+
error:(NSError *)error
|
|
108
|
+
devToolsRequestId:(NSString *)devToolsRequestId
|
|
102
109
|
{
|
|
103
110
|
RCTAssertThread(_networker.methodQueue, @"handleResult: must be called on request queue");
|
|
104
111
|
|
|
@@ -129,8 +136,9 @@ static NSString *RCTGenerateFormBoundary()
|
|
|
129
136
|
[_parts removeObjectAtIndex:0];
|
|
130
137
|
if (_parts.count) {
|
|
131
138
|
return [_networker processDataForHTTPQuery:_parts[0]
|
|
139
|
+
devToolsRequestId:devToolsRequestId
|
|
132
140
|
callback:^(NSError *err, NSDictionary<NSString *, id> *res) {
|
|
133
|
-
return [self handleResult:res error:err];
|
|
141
|
+
return [self handleResult:res error:err devToolsRequestId:devToolsRequestId];
|
|
134
142
|
}];
|
|
135
143
|
}
|
|
136
144
|
|
|
@@ -153,6 +161,7 @@ static NSString *RCTGenerateFormBoundary()
|
|
|
153
161
|
NSArray<id<RCTURLRequestHandler>> * (^_handlersProvider)(RCTModuleRegistry *);
|
|
154
162
|
NSMutableArray<id<RCTNetworkingRequestHandler>> *_requestHandlers;
|
|
155
163
|
NSMutableArray<id<RCTNetworkingResponseHandler>> *_responseHandlers;
|
|
164
|
+
NSMutableArray<id<RCTNetworkingTextResponseHandler>> *_textResponseHandlers;
|
|
156
165
|
dispatch_queue_t _requestQueue;
|
|
157
166
|
}
|
|
158
167
|
|
|
@@ -300,6 +309,7 @@ RCT_EXPORT_MODULE()
|
|
|
300
309
|
}
|
|
301
310
|
|
|
302
311
|
- (RCTURLRequestCancellationBlock)buildRequest:(NSDictionary<NSString *, id> *)query
|
|
312
|
+
devToolsRequestId:(NSString *)devToolsRequestId
|
|
303
313
|
completionBlock:(void (^)(NSURLRequest *request))block
|
|
304
314
|
{
|
|
305
315
|
RCTAssertThread(_methodQueue, @"buildRequest: must be called on request queue");
|
|
@@ -330,6 +340,7 @@ RCT_EXPORT_MODULE()
|
|
|
330
340
|
[NSURLProtocol setProperty:trackingName forKey:@"trackingName" inRequest:request];
|
|
331
341
|
}
|
|
332
342
|
return [self processDataForHTTPQuery:data
|
|
343
|
+
devToolsRequestId:devToolsRequestId
|
|
333
344
|
callback:^(NSError *error, NSDictionary<NSString *, id> *result) {
|
|
334
345
|
if (error) {
|
|
335
346
|
RCTLogError(@"Error processing request body: %@", error);
|
|
@@ -396,6 +407,7 @@ RCT_EXPORT_MODULE()
|
|
|
396
407
|
*/
|
|
397
408
|
- (RCTURLRequestCancellationBlock)
|
|
398
409
|
processDataForHTTPQuery:(nullable NSDictionary<NSString *, id> *)query
|
|
410
|
+
devToolsRequestId:(NSString *)devToolsRequestId
|
|
399
411
|
callback:(RCTURLRequestCancellationBlock (^)(NSError *error, NSDictionary<NSString *, id> *result))
|
|
400
412
|
callback
|
|
401
413
|
{
|
|
@@ -425,23 +437,24 @@ RCT_EXPORT_MODULE()
|
|
|
425
437
|
NSURLRequest *request = [RCTConvert NSURLRequest:query[@"uri"]];
|
|
426
438
|
if (request) {
|
|
427
439
|
__block RCTURLRequestCancellationBlock cancellationBlock = nil;
|
|
428
|
-
RCTNetworkTask *task =
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
440
|
+
RCTNetworkTask *task = [self
|
|
441
|
+
networkTaskWithDevToolsRequestId:devToolsRequestId
|
|
442
|
+
request:request
|
|
443
|
+
completionBlock:^(NSURLResponse *response, NSData *data, NSError *error) {
|
|
444
|
+
dispatch_async(self->_methodQueue, ^{
|
|
445
|
+
cancellationBlock = callback(
|
|
446
|
+
error,
|
|
447
|
+
data ? @{@"body" : data, @"contentType" : RCTNullIfNil(response.MIMEType)} : nil);
|
|
448
|
+
});
|
|
449
|
+
}];
|
|
436
450
|
|
|
437
451
|
[task start];
|
|
438
452
|
|
|
439
453
|
__weak RCTNetworkTask *weakTask = task;
|
|
440
|
-
NSNumber *requestId = [task.requestID copy];
|
|
441
454
|
return ^{
|
|
442
455
|
[weakTask cancel];
|
|
443
456
|
if (facebook::react::ReactNativeFeatureFlags::enableNetworkEventReporting()) {
|
|
444
|
-
[RCTInspectorNetworkReporter reportRequestFailed:
|
|
457
|
+
[RCTInspectorNetworkReporter reportRequestFailed:devToolsRequestId cancelled:YES];
|
|
445
458
|
}
|
|
446
459
|
if (cancellationBlock) {
|
|
447
460
|
cancellationBlock();
|
|
@@ -452,7 +465,7 @@ RCT_EXPORT_MODULE()
|
|
|
452
465
|
if (formData) {
|
|
453
466
|
RCTHTTPFormDataHelper *formDataHelper = [RCTHTTPFormDataHelper new];
|
|
454
467
|
formDataHelper.networker = self;
|
|
455
|
-
return [formDataHelper process:formData callback:callback];
|
|
468
|
+
return [formDataHelper process:formData devToolsRequestId:devToolsRequestId callback:callback];
|
|
456
469
|
}
|
|
457
470
|
// Nothing in the data payload, at least nothing we could understand anyway.
|
|
458
471
|
// Ignore and treat it as if it were null.
|
|
@@ -571,7 +584,7 @@ RCT_EXPORT_MODULE()
|
|
|
571
584
|
}
|
|
572
585
|
bool base64Encoded = [responseType isEqualToString:@"base64"] || [responseType isEqualToString:@"blob"];
|
|
573
586
|
|
|
574
|
-
[RCTInspectorNetworkReporter maybeStoreResponseBody:task.
|
|
587
|
+
[RCTInspectorNetworkReporter maybeStoreResponseBody:task.devToolsRequestId
|
|
575
588
|
data:responseDataForPreview
|
|
576
589
|
base64Encoded:base64Encoded];
|
|
577
590
|
}
|
|
@@ -583,6 +596,7 @@ RCT_EXPORT_MODULE()
|
|
|
583
596
|
responseType:(NSString *)responseType
|
|
584
597
|
incrementalUpdates:(BOOL)incrementalUpdates
|
|
585
598
|
responseSender:(RCTResponseSenderBlock)responseSender
|
|
599
|
+
devToolsRequestId:(NSString *)devToolsRequestId
|
|
586
600
|
{
|
|
587
601
|
RCTAssertThread(_methodQueue, @"sendRequest: must be called on request queue");
|
|
588
602
|
__weak __typeof(self) weakSelf = self;
|
|
@@ -608,7 +622,7 @@ RCT_EXPORT_MODULE()
|
|
|
608
622
|
NSArray<id> *responseJSON = @[ task.requestID, @(status), headers, responseURL ];
|
|
609
623
|
|
|
610
624
|
if (facebook::react::ReactNativeFeatureFlags::enableNetworkEventReporting()) {
|
|
611
|
-
[RCTInspectorNetworkReporter reportResponseStart:task.
|
|
625
|
+
[RCTInspectorNetworkReporter reportResponseStart:task.devToolsRequestId
|
|
612
626
|
response:response
|
|
613
627
|
statusCode:status
|
|
614
628
|
headers:headers];
|
|
@@ -648,8 +662,8 @@ RCT_EXPORT_MODULE()
|
|
|
648
662
|
];
|
|
649
663
|
|
|
650
664
|
if (facebook::react::ReactNativeFeatureFlags::enableNetworkEventReporting()) {
|
|
651
|
-
[RCTInspectorNetworkReporter reportDataReceived:task.
|
|
652
|
-
[RCTInspectorNetworkReporter maybeStoreResponseBodyIncremental:task.
|
|
665
|
+
[RCTInspectorNetworkReporter reportDataReceived:task.devToolsRequestId data:data];
|
|
666
|
+
[RCTInspectorNetworkReporter maybeStoreResponseBodyIncremental:task.devToolsRequestId data:responseString];
|
|
653
667
|
}
|
|
654
668
|
[weakSelf sendEventWithName:@"didReceiveNetworkIncrementalData" body:responseJSON];
|
|
655
669
|
};
|
|
@@ -672,21 +686,33 @@ RCT_EXPORT_MODULE()
|
|
|
672
686
|
if (!(incrementalUpdates && [responseType isEqualToString:@"text"])) {
|
|
673
687
|
[strongSelf sendData:data responseType:responseType response:response forTask:task];
|
|
674
688
|
}
|
|
689
|
+
|
|
690
|
+
if ([responseType isEqualToString:@"text"]) {
|
|
691
|
+
for (id<RCTNetworkingTextResponseHandler> handler in strongSelf->_textResponseHandlers) {
|
|
692
|
+
if ([handler canHandleNetworkingTextResponseForRequest:task.request]) {
|
|
693
|
+
NSString *responseString = [RCTNetworking decodeTextData:data
|
|
694
|
+
fromResponse:task.response
|
|
695
|
+
withCarryData:[NSMutableData new]];
|
|
696
|
+
[handler handleNetworkingResponseText:responseString request:task.request];
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
|
|
675
701
|
NSArray *responseJSON =
|
|
676
702
|
@[ task.requestID, RCTNullIfNil(error.localizedDescription), error.code == kCFURLErrorTimedOut ? @YES : @NO ];
|
|
677
703
|
|
|
678
704
|
if (facebook::react::ReactNativeFeatureFlags::enableNetworkEventReporting()) {
|
|
679
705
|
if (error != nullptr) {
|
|
680
|
-
[RCTInspectorNetworkReporter reportRequestFailed:task.
|
|
706
|
+
[RCTInspectorNetworkReporter reportRequestFailed:task.devToolsRequestId cancelled:NO];
|
|
681
707
|
} else {
|
|
682
|
-
[RCTInspectorNetworkReporter reportResponseEnd:task.
|
|
708
|
+
[RCTInspectorNetworkReporter reportResponseEnd:task.devToolsRequestId encodedDataLength:data.length];
|
|
683
709
|
}
|
|
684
710
|
}
|
|
685
711
|
[strongSelf sendEventWithName:@"didCompleteNetworkResponse" body:responseJSON];
|
|
686
712
|
[strongSelf->_tasksByRequestID removeObjectForKey:task.requestID];
|
|
687
713
|
};
|
|
688
714
|
|
|
689
|
-
task = [self
|
|
715
|
+
task = [self networkTaskWithDevToolsRequestId:devToolsRequestId request:request completionBlock:completionBlock];
|
|
690
716
|
task.downloadProgressBlock = downloadProgressBlock;
|
|
691
717
|
task.incrementalDataBlock = incrementalDataBlock;
|
|
692
718
|
task.responseBlock = responseBlock;
|
|
@@ -699,10 +725,10 @@ RCT_EXPORT_MODULE()
|
|
|
699
725
|
_tasksByRequestID[task.requestID] = task;
|
|
700
726
|
responseSender(@[ task.requestID ]);
|
|
701
727
|
if (facebook::react::ReactNativeFeatureFlags::enableNetworkEventReporting()) {
|
|
702
|
-
[RCTInspectorNetworkReporter reportRequestStart:task.
|
|
728
|
+
[RCTInspectorNetworkReporter reportRequestStart:task.devToolsRequestId
|
|
703
729
|
request:request
|
|
704
730
|
encodedDataLength:task.response.expectedContentLength];
|
|
705
|
-
[RCTInspectorNetworkReporter reportConnectionTiming:task.
|
|
731
|
+
[RCTInspectorNetworkReporter reportConnectionTiming:task.devToolsRequestId request:task.request];
|
|
706
732
|
}
|
|
707
733
|
}
|
|
708
734
|
|
|
@@ -727,6 +753,14 @@ RCT_EXPORT_MODULE()
|
|
|
727
753
|
[_responseHandlers addObject:handler];
|
|
728
754
|
}
|
|
729
755
|
|
|
756
|
+
- (void)addTextResponseHandler:(id<RCTNetworkingTextResponseHandler>)handler
|
|
757
|
+
{
|
|
758
|
+
if (!_textResponseHandlers) {
|
|
759
|
+
_textResponseHandlers = [NSMutableArray new];
|
|
760
|
+
}
|
|
761
|
+
[_textResponseHandlers addObject:handler];
|
|
762
|
+
}
|
|
763
|
+
|
|
730
764
|
- (void)removeRequestHandler:(id<RCTNetworkingRequestHandler>)handler
|
|
731
765
|
{
|
|
732
766
|
[_requestHandlers removeObject:handler];
|
|
@@ -739,6 +773,13 @@ RCT_EXPORT_MODULE()
|
|
|
739
773
|
|
|
740
774
|
- (RCTNetworkTask *)networkTaskWithRequest:(NSURLRequest *)request
|
|
741
775
|
completionBlock:(RCTURLRequestCompletionBlock)completionBlock
|
|
776
|
+
{
|
|
777
|
+
return [self networkTaskWithDevToolsRequestId:nil request:request completionBlock:completionBlock];
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
- (RCTNetworkTask *)networkTaskWithDevToolsRequestId:(NSString *)devToolsRequestId
|
|
781
|
+
request:(NSURLRequest *)request
|
|
782
|
+
completionBlock:(RCTURLRequestCompletionBlock)completionBlock
|
|
742
783
|
{
|
|
743
784
|
id<RCTURLRequestHandler> handler = [self handlerForRequest:request];
|
|
744
785
|
if (!handler) {
|
|
@@ -746,7 +787,10 @@ RCT_EXPORT_MODULE()
|
|
|
746
787
|
return nil;
|
|
747
788
|
}
|
|
748
789
|
|
|
749
|
-
RCTNetworkTask *task = [[RCTNetworkTask alloc]
|
|
790
|
+
RCTNetworkTask *task = [[RCTNetworkTask alloc] initWithDevToolsRequestId:devToolsRequestId
|
|
791
|
+
request:request
|
|
792
|
+
handler:handler
|
|
793
|
+
callbackQueue:_methodQueue];
|
|
750
794
|
task.completionBlock = completionBlock;
|
|
751
795
|
return task;
|
|
752
796
|
}
|
|
@@ -765,6 +809,7 @@ RCT_EXPORT_METHOD(sendRequest
|
|
|
765
809
|
bool queryIncrementalUpdates = query.incrementalUpdates();
|
|
766
810
|
double timeout = query.timeout();
|
|
767
811
|
bool withCredentials = query.withCredentials();
|
|
812
|
+
NSString *devToolsRequestId = query.unstable_devToolsRequestId();
|
|
768
813
|
|
|
769
814
|
dispatch_async(_methodQueue, ^{
|
|
770
815
|
NSDictionary *queryDict = @{
|
|
@@ -782,14 +827,16 @@ RCT_EXPORT_METHOD(sendRequest
|
|
|
782
827
|
// no way to invoke it, if, for example the request is cancelled while
|
|
783
828
|
// loading a large file to build the request body
|
|
784
829
|
[self buildRequest:queryDict
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
830
|
+
devToolsRequestId:devToolsRequestId
|
|
831
|
+
completionBlock:^(NSURLRequest *request) {
|
|
832
|
+
NSString *responseType = [RCTConvert NSString:queryDict[@"responseType"]];
|
|
833
|
+
BOOL incrementalUpdates = [RCTConvert BOOL:queryDict[@"incrementalUpdates"]];
|
|
834
|
+
[self sendRequest:request
|
|
835
|
+
responseType:responseType
|
|
836
|
+
incrementalUpdates:incrementalUpdates
|
|
837
|
+
responseSender:responseSender
|
|
838
|
+
devToolsRequestId:devToolsRequestId];
|
|
839
|
+
}];
|
|
793
840
|
});
|
|
794
841
|
}
|
|
795
842
|
|
|
@@ -69,7 +69,7 @@ RCT_EXTERN_C_END
|
|
|
69
69
|
* will be used as the JS module name. If omitted, the JS module name will
|
|
70
70
|
* match the Objective-C class name.
|
|
71
71
|
*/
|
|
72
|
-
#ifndef
|
|
72
|
+
#ifndef RCT_DISABLE_STATIC_MODULE_REGISTRATION
|
|
73
73
|
#define RCT_EXPORT_MODULE(js_name) \
|
|
74
74
|
RCT_EXTERN void RCTRegisterModule(Class); \
|
|
75
75
|
+(NSString *)moduleName \
|
|
@@ -90,7 +90,7 @@ RCT_EXTERN_C_END
|
|
|
90
90
|
return @ #js_name; \
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
#endif //
|
|
93
|
+
#endif // RCT_DISABLE_STATIC_MODULE_REGISTRATION
|
|
94
94
|
|
|
95
95
|
/**
|
|
96
96
|
* Same as RCT_EXPORT_MODULE, but uses __attribute__((constructor)) for module
|