react-native-windows 0.72.0 → 0.72.2
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/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Network/RCTNetworking.windows.js +10 -16
- package/Microsoft.ReactNative/Fabric/ImageRequest.cpp +11 -14
- package/Microsoft.ReactNative/Fabric/WindowsImageManager.cpp +1 -1
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +1 -3
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters +0 -7
- package/Microsoft.ReactNative/Modules/LinkingManagerModule.cpp +1 -1
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +11 -10
- package/Microsoft.ReactNative.Managed/packages.lock.json +2 -71
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/PropertySheets/React.Cpp.props +2 -3
- package/Shared/BaseFileReaderResource.cpp +95 -0
- package/Shared/BaseFileReaderResource.h +41 -0
- package/Shared/CreateModules.h +27 -5
- package/Shared/IFileReaderResource.h +36 -0
- package/Shared/Modules/BlobModule.cpp +93 -297
- package/Shared/Modules/BlobModule.h +25 -87
- package/Shared/Modules/CxxModuleUtilities.cpp +32 -0
- package/Shared/Modules/CxxModuleUtilities.h +17 -0
- package/Shared/Modules/FileReaderModule.cpp +118 -51
- package/Shared/Modules/FileReaderModule.h +27 -1
- package/Shared/Modules/HttpModule.cpp +133 -9
- package/Shared/Modules/HttpModule.h +33 -0
- package/Shared/Modules/IRequestBodyHandler.h +6 -4
- package/Shared/Modules/IResponseHandler.h +3 -3
- package/Shared/Modules/IUriHandler.h +3 -3
- package/Shared/Modules/IWebSocketModuleContentHandler.h +6 -4
- package/Shared/Modules/WebSocketModule.cpp +190 -7
- package/Shared/Modules/WebSocketTurboModule.h +52 -0
- package/Shared/Networking/DefaultBlobResource.cpp +323 -0
- package/Shared/Networking/DefaultBlobResource.h +133 -0
- package/Shared/Networking/IBlobResource.h +56 -0
- package/Shared/Networking/IHttpResource.h +6 -5
- package/Shared/Networking/WinRTHttpResource.cpp +40 -32
- package/Shared/Networking/WinRTHttpResource.h +4 -3
- package/Shared/Networking/WinRTTypes.h +3 -3
- package/Shared/Shared.vcxitems +8 -1
- package/Shared/Shared.vcxitems.filters +24 -3
- package/package.json +11 -11
- package/types/experimental.d.ts +101 -0
- package/types/index.d.ts +216 -0
- package/types/modules/BatchedBridge.d.ts +32 -0
- package/types/modules/Codegen.d.ts +74 -0
- package/types/modules/Devtools.d.ts +31 -0
- package/types/modules/LaunchScreen.d.ts +18 -0
- package/types/modules/globals.d.ts +579 -0
- package/types/private/TimerMixin.d.ts +19 -0
- package/types/private/Utilities.d.ts +10 -0
- package/types/public/DeprecatedPropertiesAlias.d.ts +185 -0
- package/types/public/Insets.d.ts +15 -0
- package/types/public/ReactNativeRenderer.d.ts +144 -0
- package/types/public/ReactNativeTypes.d.ts +143 -0
- package/Microsoft.ReactNative/Base/CoreNativeModules.cpp +0 -44
- package/Microsoft.ReactNative/Base/CoreNativeModules.h +0 -30
- /package/Shared/{Modules/IBlobPersistor.h → IBlobPersistor.h} +0 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#pragma once
|
|
5
|
+
|
|
6
|
+
#include "IBlobResource.h"
|
|
7
|
+
|
|
8
|
+
#include <IBlobPersistor.h>
|
|
9
|
+
#include <Modules/IRequestBodyHandler.h>
|
|
10
|
+
#include <Modules/IResponseHandler.h>
|
|
11
|
+
#include <Modules/IWebSocketModuleContentHandler.h>
|
|
12
|
+
|
|
13
|
+
// React Native Windows
|
|
14
|
+
#include <ReactPropertyBag.h>
|
|
15
|
+
|
|
16
|
+
// Boost Libraries
|
|
17
|
+
#include <boost/uuid/uuid_generators.hpp>
|
|
18
|
+
|
|
19
|
+
// Standard Library
|
|
20
|
+
#include <mutex>
|
|
21
|
+
#include <unordered_set>
|
|
22
|
+
|
|
23
|
+
namespace Microsoft::React::Networking {
|
|
24
|
+
|
|
25
|
+
class MemoryBlobPersistor final : public IBlobPersistor {
|
|
26
|
+
std::unordered_map<std::string, std::vector<uint8_t>> m_blobs;
|
|
27
|
+
std::mutex m_mutex;
|
|
28
|
+
boost::uuids::random_generator m_guidGenerator;
|
|
29
|
+
|
|
30
|
+
public:
|
|
31
|
+
#pragma region IBlobPersistor
|
|
32
|
+
|
|
33
|
+
winrt::array_view<uint8_t const> ResolveMessage(std::string &&blobId, int64_t offset, int64_t size) override;
|
|
34
|
+
|
|
35
|
+
void RemoveMessage(std::string &&blobId) noexcept override;
|
|
36
|
+
|
|
37
|
+
void StoreMessage(std::vector<uint8_t> &&message, std::string &&blobId) noexcept override;
|
|
38
|
+
|
|
39
|
+
std::string StoreMessage(std::vector<uint8_t> &&message) noexcept override;
|
|
40
|
+
|
|
41
|
+
#pragma endregion IBlobPersistor
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
class BlobWebSocketModuleContentHandler final : public IWebSocketModuleContentHandler {
|
|
45
|
+
std::unordered_set<int64_t> m_socketIds;
|
|
46
|
+
std::mutex m_mutex;
|
|
47
|
+
std::shared_ptr<IBlobPersistor> m_blobPersistor;
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
BlobWebSocketModuleContentHandler(std::shared_ptr<IBlobPersistor> blobPersistor) noexcept;
|
|
51
|
+
|
|
52
|
+
#pragma region IWebSocketModuleContentHandler
|
|
53
|
+
|
|
54
|
+
void ProcessMessage(std::string &&message, winrt::Microsoft::ReactNative::JSValueObject ¶ms) noexcept override;
|
|
55
|
+
|
|
56
|
+
void ProcessMessage(std::vector<uint8_t> &&message, winrt::Microsoft::ReactNative::JSValueObject ¶ms) noexcept
|
|
57
|
+
override;
|
|
58
|
+
|
|
59
|
+
#pragma endregion IWebSocketModuleContentHandler
|
|
60
|
+
|
|
61
|
+
void Register(int64_t socketID) noexcept;
|
|
62
|
+
|
|
63
|
+
void Unregister(int64_t socketID) noexcept;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
class BlobModuleRequestBodyHandler final : public IRequestBodyHandler {
|
|
67
|
+
std::shared_ptr<IBlobPersistor> m_blobPersistor;
|
|
68
|
+
|
|
69
|
+
public:
|
|
70
|
+
BlobModuleRequestBodyHandler(std::shared_ptr<IBlobPersistor> blobPersistor) noexcept;
|
|
71
|
+
|
|
72
|
+
#pragma region IRequestBodyHandler
|
|
73
|
+
|
|
74
|
+
bool Supports(winrt::Microsoft::ReactNative::JSValueObject &data) override;
|
|
75
|
+
|
|
76
|
+
winrt::Microsoft::ReactNative::JSValueObject ToRequestBody(
|
|
77
|
+
winrt::Microsoft::ReactNative::JSValueObject &data,
|
|
78
|
+
std::string &contentType) override;
|
|
79
|
+
|
|
80
|
+
#pragma endregion IRequestBodyHandler
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
class BlobModuleResponseHandler final : public IResponseHandler {
|
|
84
|
+
std::shared_ptr<IBlobPersistor> m_blobPersistor;
|
|
85
|
+
|
|
86
|
+
public:
|
|
87
|
+
BlobModuleResponseHandler(std::shared_ptr<IBlobPersistor> blobPersistor) noexcept;
|
|
88
|
+
|
|
89
|
+
#pragma region IResponseHandler
|
|
90
|
+
|
|
91
|
+
bool Supports(std::string &responseType) override;
|
|
92
|
+
|
|
93
|
+
winrt::Microsoft::ReactNative::JSValueObject ToResponseData(std::vector<uint8_t> &&content) override;
|
|
94
|
+
|
|
95
|
+
#pragma endregion IResponseHandler
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
class DefaultBlobResource : public IBlobResource, public std::enable_shared_from_this<DefaultBlobResource> {
|
|
99
|
+
std::shared_ptr<MemoryBlobPersistor> m_blobPersistor;
|
|
100
|
+
std::shared_ptr<BlobWebSocketModuleContentHandler> m_contentHandler;
|
|
101
|
+
std::shared_ptr<BlobModuleRequestBodyHandler> m_requestBodyHandler;
|
|
102
|
+
std::shared_ptr<BlobModuleResponseHandler> m_responseHandler;
|
|
103
|
+
winrt::Microsoft::ReactNative::ReactPropertyBag m_propertyBag;
|
|
104
|
+
BlobCallbacks m_callbacks;
|
|
105
|
+
|
|
106
|
+
public:
|
|
107
|
+
DefaultBlobResource(
|
|
108
|
+
std::shared_ptr<MemoryBlobPersistor> blobPersistor,
|
|
109
|
+
std::shared_ptr<BlobWebSocketModuleContentHandler> contentHandler,
|
|
110
|
+
std::shared_ptr<BlobModuleRequestBodyHandler> requestBodyHandler,
|
|
111
|
+
std::shared_ptr<BlobModuleResponseHandler> responseHandler,
|
|
112
|
+
winrt::Microsoft::ReactNative::ReactPropertyBag propertyBag);
|
|
113
|
+
|
|
114
|
+
#pragma region IBlobResource
|
|
115
|
+
|
|
116
|
+
void SendOverSocket(std::string &&blobId, int64_t offset, int64_t size, int64_t socketId) noexcept override;
|
|
117
|
+
|
|
118
|
+
void CreateFromParts(winrt::Microsoft::ReactNative::JSValueArray &&parts, std::string &&blobId) noexcept override;
|
|
119
|
+
|
|
120
|
+
void Release(std::string &&blobId) noexcept override;
|
|
121
|
+
|
|
122
|
+
void AddNetworkingHandler() noexcept override;
|
|
123
|
+
|
|
124
|
+
void AddWebSocketHandler(int64_t id) noexcept override;
|
|
125
|
+
|
|
126
|
+
void RemoveWebSocketHandler(int64_t id) noexcept override;
|
|
127
|
+
|
|
128
|
+
BlobCallbacks &Callbacks() noexcept override;
|
|
129
|
+
|
|
130
|
+
#pragma endregion IBlobResource
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
} // namespace Microsoft::React::Networking
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#pragma once
|
|
5
|
+
|
|
6
|
+
#include <IBlobPersistor.h>
|
|
7
|
+
|
|
8
|
+
// React Native Windows
|
|
9
|
+
#include <JSValue.h>
|
|
10
|
+
|
|
11
|
+
// Windows API
|
|
12
|
+
#include <winrt/Windows.Foundation.h>
|
|
13
|
+
|
|
14
|
+
// Standard Library
|
|
15
|
+
#include <functional>
|
|
16
|
+
#include <memory>
|
|
17
|
+
#include <string>
|
|
18
|
+
|
|
19
|
+
namespace Microsoft::React::Networking {
|
|
20
|
+
|
|
21
|
+
struct IBlobResource {
|
|
22
|
+
struct BlobCallbacks {
|
|
23
|
+
std::function<void(std::string &&errorText)> OnError;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
struct BlobFieldNames {
|
|
27
|
+
const char *Blob;
|
|
28
|
+
const char *BlobId;
|
|
29
|
+
const char *Offset;
|
|
30
|
+
const char *Size;
|
|
31
|
+
const char *Type;
|
|
32
|
+
const char *Data;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
static std::shared_ptr<IBlobResource> Make(winrt::Windows::Foundation::IInspectable const &inspectableProperties);
|
|
36
|
+
|
|
37
|
+
static const BlobFieldNames &FieldNames() noexcept;
|
|
38
|
+
|
|
39
|
+
virtual ~IBlobResource() noexcept {}
|
|
40
|
+
|
|
41
|
+
virtual void SendOverSocket(std::string &&blobId, int64_t offset, int64_t size, int64_t socketId) noexcept = 0;
|
|
42
|
+
|
|
43
|
+
virtual void CreateFromParts(winrt::Microsoft::ReactNative::JSValueArray &&parts, std::string &&blobId) noexcept = 0;
|
|
44
|
+
|
|
45
|
+
virtual void Release(std::string &&blobId) noexcept = 0;
|
|
46
|
+
|
|
47
|
+
virtual void AddNetworkingHandler() noexcept = 0;
|
|
48
|
+
|
|
49
|
+
virtual void AddWebSocketHandler(int64_t id) noexcept = 0;
|
|
50
|
+
|
|
51
|
+
virtual void RemoveWebSocketHandler(int64_t id) noexcept = 0;
|
|
52
|
+
|
|
53
|
+
virtual BlobCallbacks &Callbacks() noexcept = 0;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
} // namespace Microsoft::React::Networking
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
#pragma once
|
|
5
5
|
|
|
6
|
-
//
|
|
7
|
-
#include <
|
|
6
|
+
// React Native Windows
|
|
7
|
+
#include <JSValue.h>
|
|
8
8
|
|
|
9
9
|
// Windows API
|
|
10
10
|
#include <winrt/Windows.Foundation.h>
|
|
@@ -20,7 +20,6 @@ namespace Microsoft::React::Networking {
|
|
|
20
20
|
struct IHttpResource {
|
|
21
21
|
typedef std::unordered_map<std::string, std::string> Headers;
|
|
22
22
|
|
|
23
|
-
// TODO: Implement Form data
|
|
24
23
|
struct BodyData {
|
|
25
24
|
enum class Type : size_t { Empty, String, Base64, Uri, Form } Type = Type::Empty;
|
|
26
25
|
std::string Data;
|
|
@@ -81,7 +80,7 @@ struct IHttpResource {
|
|
|
81
80
|
std::string &&url,
|
|
82
81
|
int64_t requestId,
|
|
83
82
|
Headers &&headers,
|
|
84
|
-
|
|
83
|
+
winrt::Microsoft::ReactNative::JSValueObject &&data,
|
|
85
84
|
std::string &&responseType,
|
|
86
85
|
bool useIncrementalUpdates,
|
|
87
86
|
int64_t timeout,
|
|
@@ -146,7 +145,9 @@ struct IHttpResource {
|
|
|
146
145
|
/// Structured response content payload (i.e. Blob data)
|
|
147
146
|
/// </param>
|
|
148
147
|
/// </param>
|
|
149
|
-
virtual void SetOnData(
|
|
148
|
+
virtual void SetOnData(
|
|
149
|
+
std::function<void(int64_t requestId, winrt::Microsoft::ReactNative::JSValueObject &&responseData)>
|
|
150
|
+
&&handler) noexcept = 0;
|
|
150
151
|
|
|
151
152
|
/// <summary>
|
|
152
153
|
/// Sets a function to be invoked when a response content increment has been received.
|
|
@@ -23,8 +23,6 @@
|
|
|
23
23
|
#include <winrt/Windows.Storage.Streams.h>
|
|
24
24
|
#include <winrt/Windows.Web.Http.Headers.h>
|
|
25
25
|
|
|
26
|
-
using folly::dynamic;
|
|
27
|
-
|
|
28
26
|
using std::function;
|
|
29
27
|
using std::scoped_lock;
|
|
30
28
|
using std::shared_ptr;
|
|
@@ -35,6 +33,7 @@ using std::weak_ptr;
|
|
|
35
33
|
using winrt::fire_and_forget;
|
|
36
34
|
using winrt::hresult_error;
|
|
37
35
|
using winrt::to_hstring;
|
|
36
|
+
using winrt::Microsoft::ReactNative::JSValueObject;
|
|
38
37
|
using winrt::Windows::Foundation::IAsyncOperation;
|
|
39
38
|
using winrt::Windows::Foundation::IInspectable;
|
|
40
39
|
using winrt::Windows::Foundation::Uri;
|
|
@@ -69,15 +68,15 @@ constexpr char responseTypeBlob[] = "blob";
|
|
|
69
68
|
namespace Microsoft::React::Networking {
|
|
70
69
|
|
|
71
70
|
// May throw winrt::hresult_error
|
|
72
|
-
void AttachMultipartHeaders(IHttpContent content, const
|
|
71
|
+
void AttachMultipartHeaders(IHttpContent content, const JSValueObject &headers) {
|
|
73
72
|
HttpMediaTypeHeaderValue contentType{nullptr};
|
|
74
73
|
|
|
75
74
|
// Headers are generally case-insensitive
|
|
76
75
|
// https://www.ietf.org/rfc/rfc2616.txt section 4.2
|
|
77
76
|
// TODO: Consolidate with PerformRequest's header parsing.
|
|
78
|
-
for (auto &header : headers
|
|
79
|
-
auto &name = header.first
|
|
80
|
-
auto
|
|
77
|
+
for (auto &header : headers) {
|
|
78
|
+
auto &name = header.first;
|
|
79
|
+
auto value = header.second.AsString();
|
|
81
80
|
|
|
82
81
|
if (boost::iequals(name.c_str(), "Content-Type")) {
|
|
83
82
|
contentType = HttpMediaTypeHeaderValue::Parse(to_hstring(value));
|
|
@@ -147,6 +146,14 @@ IAsyncOperation<HttpRequestMessage> WinRTHttpResource::CreateRequest(
|
|
|
147
146
|
}
|
|
148
147
|
co_return nullptr;
|
|
149
148
|
}
|
|
149
|
+
} else if (boost::iequals(name.c_str(), "User-Agent")) {
|
|
150
|
+
bool success = request.Headers().TryAppendWithoutValidation(to_hstring(name), to_hstring(value));
|
|
151
|
+
if (!success) {
|
|
152
|
+
if (self->m_onError) {
|
|
153
|
+
self->m_onError(reqArgs->RequestId, "Failed to append User-Agent", false);
|
|
154
|
+
}
|
|
155
|
+
co_return nullptr;
|
|
156
|
+
}
|
|
150
157
|
} else {
|
|
151
158
|
try {
|
|
152
159
|
request.Headers().Append(to_hstring(name), to_hstring(value));
|
|
@@ -162,11 +169,11 @@ IAsyncOperation<HttpRequestMessage> WinRTHttpResource::CreateRequest(
|
|
|
162
169
|
// Initialize content
|
|
163
170
|
IHttpContent content{nullptr};
|
|
164
171
|
auto &data = reqArgs->Data;
|
|
165
|
-
if (!data.
|
|
172
|
+
if (!data.empty()) {
|
|
166
173
|
auto bodyHandler = self->m_requestBodyHandler.lock();
|
|
167
174
|
if (bodyHandler && bodyHandler->Supports(data)) {
|
|
168
175
|
auto contentTypeString = contentType ? winrt::to_string(contentType.ToString()) : "";
|
|
169
|
-
|
|
176
|
+
JSValueObject blob;
|
|
170
177
|
try {
|
|
171
178
|
blob = bodyHandler->ToRequestBody(data, contentTypeString);
|
|
172
179
|
} catch (const std::invalid_argument &e) {
|
|
@@ -175,44 +182,45 @@ IAsyncOperation<HttpRequestMessage> WinRTHttpResource::CreateRequest(
|
|
|
175
182
|
}
|
|
176
183
|
co_return nullptr;
|
|
177
184
|
}
|
|
178
|
-
auto bytes = blob["bytes"];
|
|
185
|
+
auto &bytes = blob["bytes"].AsArray();
|
|
179
186
|
auto byteVector = vector<uint8_t>(bytes.size());
|
|
180
187
|
for (auto &byte : bytes) {
|
|
181
|
-
byteVector.push_back(static_cast<uint8_t>(byte.
|
|
188
|
+
byteVector.push_back(static_cast<uint8_t>(byte.AsUInt8()));
|
|
182
189
|
}
|
|
183
190
|
auto view = winrt::array_view<uint8_t const>{byteVector};
|
|
184
191
|
auto buffer = CryptographicBuffer::CreateFromByteArray(view);
|
|
185
192
|
content = HttpBufferContent{std::move(buffer)};
|
|
186
|
-
} else if (
|
|
187
|
-
content = HttpStringContent{to_hstring(data["string"].
|
|
188
|
-
} else if (
|
|
189
|
-
auto buffer = CryptographicBuffer::DecodeFromBase64String(to_hstring(data["base64"].
|
|
193
|
+
} else if (data.find("string") != data.cend()) {
|
|
194
|
+
content = HttpStringContent{to_hstring(data["string"].AsString())};
|
|
195
|
+
} else if (data.find("base64") != data.cend()) {
|
|
196
|
+
auto buffer = CryptographicBuffer::DecodeFromBase64String(to_hstring(data["base64"].AsString()));
|
|
190
197
|
content = HttpBufferContent{std::move(buffer)};
|
|
191
|
-
} else if (
|
|
192
|
-
auto file = co_await StorageFile::GetFileFromApplicationUriAsync(Uri{to_hstring(data["uri"].
|
|
198
|
+
} else if (data.find("uri") != data.cend()) {
|
|
199
|
+
auto file = co_await StorageFile::GetFileFromApplicationUriAsync(Uri{to_hstring(data["uri"].AsString())});
|
|
193
200
|
auto stream = co_await file.OpenReadAsync();
|
|
194
201
|
content = HttpStreamContent{std::move(stream)};
|
|
195
|
-
} else if (
|
|
202
|
+
} else if (data.find("formData") != data.cend()) {
|
|
196
203
|
winrt::Windows::Web::Http::HttpMultipartFormDataContent multiPartContent;
|
|
197
|
-
auto formData = data["formData"];
|
|
204
|
+
auto &formData = data["formData"].AsObject();
|
|
198
205
|
|
|
199
206
|
// #6046 - Overwriting WinRT's HttpMultipartFormDataContent implicit Content-Type clears the generated boundary
|
|
200
207
|
contentType = nullptr;
|
|
201
208
|
|
|
202
209
|
for (auto &formDataPart : formData) {
|
|
203
210
|
IHttpContent formContent{nullptr};
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
211
|
+
auto &itr = formDataPart.second["string"];
|
|
212
|
+
if (!formDataPart.second["string"].IsNull()) {
|
|
213
|
+
formContent = HttpStringContent{to_hstring(formDataPart.second["string"].AsString())};
|
|
214
|
+
} else if (!formDataPart.second["uri"].IsNull()) {
|
|
215
|
+
auto filePath = to_hstring(formDataPart.second["uri"].AsString());
|
|
208
216
|
auto file = co_await StorageFile::GetFileFromPathAsync(filePath);
|
|
209
217
|
auto stream = co_await file.OpenReadAsync();
|
|
210
218
|
formContent = HttpStreamContent{stream};
|
|
211
219
|
}
|
|
212
220
|
|
|
213
221
|
if (formContent) {
|
|
214
|
-
AttachMultipartHeaders(formContent, formDataPart["headers"]);
|
|
215
|
-
multiPartContent.Add(formContent, to_hstring(formDataPart["fieldName"].
|
|
222
|
+
AttachMultipartHeaders(formContent, formDataPart.second["headers"].AsObject());
|
|
223
|
+
multiPartContent.Add(formContent, to_hstring(formDataPart.second["fieldName"].AsString()));
|
|
216
224
|
}
|
|
217
225
|
} // foreach form data part
|
|
218
226
|
|
|
@@ -266,7 +274,7 @@ void WinRTHttpResource::SendRequest(
|
|
|
266
274
|
string &&url,
|
|
267
275
|
int64_t requestId,
|
|
268
276
|
Headers &&headers,
|
|
269
|
-
|
|
277
|
+
JSValueObject &&data,
|
|
270
278
|
string &&responseType,
|
|
271
279
|
bool useIncrementalUpdates,
|
|
272
280
|
int64_t timeout,
|
|
@@ -345,10 +353,10 @@ void WinRTHttpResource::SetOnData(function<void(int64_t requestId, string &&resp
|
|
|
345
353
|
m_onData = std::move(handler);
|
|
346
354
|
}
|
|
347
355
|
|
|
348
|
-
void WinRTHttpResource::SetOnData(function<void(int64_t requestId,
|
|
356
|
+
void WinRTHttpResource::SetOnData(function<void(int64_t requestId, JSValueObject &&responseData)> &&handler) noexcept
|
|
349
357
|
/*override*/
|
|
350
358
|
{
|
|
351
|
-
|
|
359
|
+
m_onDataObject = std::move(handler);
|
|
352
360
|
}
|
|
353
361
|
|
|
354
362
|
void WinRTHttpResource::SetOnIncrementalData(
|
|
@@ -397,7 +405,7 @@ WinRTHttpResource::PerformSendRequest(HttpMethod &&method, Uri &&rtUri, IInspect
|
|
|
397
405
|
// Ensure background thread
|
|
398
406
|
co_await winrt::resume_background();
|
|
399
407
|
|
|
400
|
-
auto props = winrt::
|
|
408
|
+
auto props = winrt::single_threaded_map<winrt::hstring, IInspectable>();
|
|
401
409
|
props.Insert(L"RequestArgs", coArgs);
|
|
402
410
|
|
|
403
411
|
auto coRequestOp = CreateRequest(std::move(coMethod), std::move(coUri), props);
|
|
@@ -418,8 +426,8 @@ WinRTHttpResource::PerformSendRequest(HttpMethod &&method, Uri &&rtUri, IInspect
|
|
|
418
426
|
try {
|
|
419
427
|
if (uriHandler->Supports(uri, reqArgs->ResponseType)) {
|
|
420
428
|
auto blob = uriHandler->Fetch(uri);
|
|
421
|
-
if (self->
|
|
422
|
-
self->
|
|
429
|
+
if (self->m_onDataObject && self->m_onRequestSuccess) {
|
|
430
|
+
self->m_onDataObject(reqArgs->RequestId, std::move(blob));
|
|
423
431
|
self->m_onRequestSuccess(reqArgs->RequestId);
|
|
424
432
|
}
|
|
425
433
|
|
|
@@ -528,8 +536,8 @@ WinRTHttpResource::PerformSendRequest(HttpMethod &&method, Uri &&rtUri, IInspect
|
|
|
528
536
|
|
|
529
537
|
auto blob = responseHandler->ToResponseData(std::move(responseData));
|
|
530
538
|
|
|
531
|
-
if (self->
|
|
532
|
-
self->
|
|
539
|
+
if (self->m_onDataObject && self->m_onRequestSuccess) {
|
|
540
|
+
self->m_onDataObject(reqArgs->RequestId, std::move(blob));
|
|
533
541
|
self->m_onRequestSuccess(reqArgs->RequestId);
|
|
534
542
|
}
|
|
535
543
|
|
|
@@ -28,7 +28,7 @@ class WinRTHttpResource : public IHttpResource,
|
|
|
28
28
|
std::function<void(int64_t requestId)> m_onRequestSuccess;
|
|
29
29
|
std::function<void(int64_t requestId, Response &&response)> m_onResponse;
|
|
30
30
|
std::function<void(int64_t requestId, std::string &&responseData)> m_onData;
|
|
31
|
-
std::function<void(int64_t requestId,
|
|
31
|
+
std::function<void(int64_t requestId, winrt::Microsoft::ReactNative::JSValueObject &&responseData)> m_onDataObject;
|
|
32
32
|
std::function<void(int64_t requestId, std::string &&errorMessage, bool isTimeout)> m_onError;
|
|
33
33
|
std::function<void(int64_t requestId, std::string &&responseData, int64_t progress, int64_t total)>
|
|
34
34
|
m_onIncrementalData;
|
|
@@ -71,7 +71,7 @@ class WinRTHttpResource : public IHttpResource,
|
|
|
71
71
|
std::string &&url,
|
|
72
72
|
int64_t requestId,
|
|
73
73
|
Headers &&headers,
|
|
74
|
-
|
|
74
|
+
winrt::Microsoft::ReactNative::JSValueObject &&data,
|
|
75
75
|
std::string &&responseType,
|
|
76
76
|
bool useIncrementalUpdates,
|
|
77
77
|
int64_t timeout,
|
|
@@ -83,7 +83,8 @@ class WinRTHttpResource : public IHttpResource,
|
|
|
83
83
|
void SetOnRequestSuccess(std::function<void(int64_t requestId)> &&handler) noexcept override;
|
|
84
84
|
void SetOnResponse(std::function<void(int64_t requestId, Response &&response)> &&handler) noexcept override;
|
|
85
85
|
void SetOnData(std::function<void(int64_t requestId, std::string &&responseData)> &&handler) noexcept override;
|
|
86
|
-
void SetOnData(std::function<void(int64_t requestId,
|
|
86
|
+
void SetOnData(std::function<void(int64_t requestId, winrt::Microsoft::ReactNative::JSValueObject &&responseData)>
|
|
87
|
+
&&handler) noexcept override;
|
|
87
88
|
void SetOnIncrementalData(
|
|
88
89
|
std::function<void(int64_t requestId, std::string &&responseData, int64_t progress, int64_t total)>
|
|
89
90
|
&&handler) noexcept override;
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
#include "IHttpResource.h"
|
|
7
7
|
|
|
8
|
-
//
|
|
9
|
-
#include <
|
|
8
|
+
// React Native Windows
|
|
9
|
+
#include <JSValue.h>
|
|
10
10
|
|
|
11
11
|
// Windows API
|
|
12
12
|
#include <winrt/Windows.Web.Http.h>
|
|
@@ -19,7 +19,7 @@ namespace Microsoft::React::Networking {
|
|
|
19
19
|
struct RequestArgs : public winrt::implements<RequestArgs, winrt::Windows::Foundation::IInspectable> {
|
|
20
20
|
int64_t RequestId;
|
|
21
21
|
IHttpResource::Headers Headers;
|
|
22
|
-
|
|
22
|
+
winrt::Microsoft::ReactNative::JSValueObject Data;
|
|
23
23
|
bool IncrementalUpdates;
|
|
24
24
|
bool WithCredentials;
|
|
25
25
|
std::string ResponseType;
|
package/Shared/Shared.vcxitems
CHANGED
|
@@ -146,6 +146,7 @@
|
|
|
146
146
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\SchedulerSettings.cpp">
|
|
147
147
|
<ExcludedFromBuild Condition="'$(UseFabric)' != 'true'">true</ExcludedFromBuild>
|
|
148
148
|
</ClCompile>
|
|
149
|
+
<ClCompile Include="$(MSBuildThisFileDirectory)BaseFileReaderResource.cpp" />
|
|
149
150
|
<ClCompile Include="$(MSBuildThisFileDirectory)BaseScriptStoreImpl.cpp" />
|
|
150
151
|
<ClCompile Include="$(MSBuildThisFileDirectory)ChakraRuntimeHolder.cpp" />
|
|
151
152
|
<ClCompile Include="$(MSBuildThisFileDirectory)CxxMessageQueue.cpp" />
|
|
@@ -179,6 +180,7 @@
|
|
|
179
180
|
<ClCompile Include="$(MSBuildThisFileDirectory)Modules\SourceCodeModule.cpp" />
|
|
180
181
|
<ClCompile Include="$(MSBuildThisFileDirectory)Modules\StatusBarManagerModule.cpp" />
|
|
181
182
|
<ClCompile Include="$(MSBuildThisFileDirectory)Modules\WebSocketModule.cpp" />
|
|
183
|
+
<ClCompile Include="$(MSBuildThisFileDirectory)Networking\DefaultBlobResource.cpp" />
|
|
182
184
|
<ClCompile Include="$(MSBuildThisFileDirectory)Networking\OriginPolicyHttpFilter.cpp" />
|
|
183
185
|
<ClCompile Include="$(MSBuildThisFileDirectory)Networking\RedirectHttpFilter.cpp" />
|
|
184
186
|
<ClCompile Include="$(MSBuildThisFileDirectory)Networking\WinRTHttpResource.cpp" />
|
|
@@ -283,8 +285,11 @@
|
|
|
283
285
|
<DependentUpon>$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\IJSValueWriter.idl</DependentUpon>
|
|
284
286
|
</ClCompile>
|
|
285
287
|
<ClInclude Include="$(MSBuildThisFileDirectory)AbiSafe.h" />
|
|
288
|
+
<ClInclude Include="$(MSBuildThisFileDirectory)BaseFileReaderResource.h" />
|
|
286
289
|
<ClInclude Include="$(MSBuildThisFileDirectory)CppRuntimeOptions.h" />
|
|
287
290
|
<ClInclude Include="$(MSBuildThisFileDirectory)HermesSamplingProfiler.h" />
|
|
291
|
+
<ClInclude Include="$(MSBuildThisFileDirectory)IBlobPersistor.h" />
|
|
292
|
+
<ClInclude Include="$(MSBuildThisFileDirectory)IFileReaderResource.h" />
|
|
288
293
|
<ClInclude Include="$(MSBuildThisFileDirectory)JSI\ByteArrayBuffer.h" />
|
|
289
294
|
<ClInclude Include="$(MSBuildThisFileDirectory)JSI\ChakraApi.h" />
|
|
290
295
|
<ClInclude Include="$(MSBuildThisFileDirectory)JSI\ChakraRuntime.h" />
|
|
@@ -296,7 +301,6 @@
|
|
|
296
301
|
<ClInclude Include="$(MSBuildThisFileDirectory)Modules\BlobModule.h" />
|
|
297
302
|
<ClInclude Include="$(MSBuildThisFileDirectory)Modules\CxxModuleUtilities.h" />
|
|
298
303
|
<ClInclude Include="$(MSBuildThisFileDirectory)Modules\FileReaderModule.h" />
|
|
299
|
-
<ClInclude Include="$(MSBuildThisFileDirectory)Modules\IBlobPersistor.h" />
|
|
300
304
|
<ClInclude Include="$(MSBuildThisFileDirectory)Modules\IHttpModuleProxy.h" />
|
|
301
305
|
<ClInclude Include="$(MSBuildThisFileDirectory)Modules\IRequestBodyHandler.h" />
|
|
302
306
|
<ClInclude Include="$(MSBuildThisFileDirectory)Modules\IResponseHandler.h" />
|
|
@@ -305,6 +309,9 @@
|
|
|
305
309
|
<ClInclude Include="$(MSBuildThisFileDirectory)Modules\IWebSocketModuleProxy.h" />
|
|
306
310
|
<ClInclude Include="$(MSBuildThisFileDirectory)Modules\HttpModule.h" />
|
|
307
311
|
<ClInclude Include="$(MSBuildThisFileDirectory)Modules\NetworkingModule.h" />
|
|
312
|
+
<ClInclude Include="$(MSBuildThisFileDirectory)Modules\WebSocketTurboModule.h" />
|
|
313
|
+
<ClInclude Include="$(MSBuildThisFileDirectory)Networking\DefaultBlobResource.h" />
|
|
314
|
+
<ClInclude Include="$(MSBuildThisFileDirectory)Networking\IBlobResource.h" />
|
|
308
315
|
<ClInclude Include="$(MSBuildThisFileDirectory)Networking\IHttpResource.h" />
|
|
309
316
|
<ClInclude Include="$(MSBuildThisFileDirectory)Networking\IRedirectEventSource.h" />
|
|
310
317
|
<ClInclude Include="$(MSBuildThisFileDirectory)Networking\IWebSocketResource.h" />
|
|
@@ -254,6 +254,9 @@
|
|
|
254
254
|
<ClCompile Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\RedBoxErrorFrameInfo.cpp" />
|
|
255
255
|
<ClCompile Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\RedBoxErrorInfo.cpp" />
|
|
256
256
|
<ClCompile Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\TurboModulesProvider.cpp" />
|
|
257
|
+
<ClCompile Include="$(MSBuildThisFileDirectory)BaseFileReaderResource.cpp">
|
|
258
|
+
<Filter>Source Files</Filter>
|
|
259
|
+
</ClCompile>
|
|
257
260
|
<ClCompile Include="$(MSBuildThisFileDirectory)HermesRuntimeHolder.cpp">
|
|
258
261
|
<Filter>Hermes</Filter>
|
|
259
262
|
</ClCompile>
|
|
@@ -263,6 +266,9 @@
|
|
|
263
266
|
<ClCompile Include="$(NodeApiJsiDir)src\ApiLoaders\HermesApi.cpp" />
|
|
264
267
|
<ClCompile Include="$(MSBuildThisFileDirectory)JSI\V8RuntimeHolder.cpp" />
|
|
265
268
|
<ClCompile Include="$(MSBuildThisFileDirectory)SafeLoadLibrary.cpp" />
|
|
269
|
+
<ClCompile Include="$(MSBuildThisFileDirectory)Networking\DefaultBlobResource.cpp">
|
|
270
|
+
<Filter>Source Files\Networking</Filter>
|
|
271
|
+
</ClCompile>
|
|
266
272
|
</ItemGroup>
|
|
267
273
|
<ItemGroup>
|
|
268
274
|
<Filter Include="Source Files">
|
|
@@ -586,9 +592,6 @@
|
|
|
586
592
|
<ClInclude Include="$(MSBuildThisFileDirectory)Modules\IResponseHandler.h">
|
|
587
593
|
<Filter>Header Files\Modules</Filter>
|
|
588
594
|
</ClInclude>
|
|
589
|
-
<ClInclude Include="$(MSBuildThisFileDirectory)Modules\IBlobPersistor.h">
|
|
590
|
-
<Filter>Header Files\Modules</Filter>
|
|
591
|
-
</ClInclude>
|
|
592
595
|
<ClInclude Include="$(MSBuildThisFileDirectory)Modules\CxxModuleUtilities.h">
|
|
593
596
|
<Filter>Header Files\Modules</Filter>
|
|
594
597
|
</ClInclude>
|
|
@@ -704,6 +707,12 @@
|
|
|
704
707
|
<ClInclude Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\AbiViewProps.h" />
|
|
705
708
|
<ClInclude Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\AbiViewComponentDescriptor.h" />
|
|
706
709
|
<ClInclude Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\UiaHelpers.h" />
|
|
710
|
+
<ClInclude Include="$(MSBuildThisFileDirectory)IFileReaderResource.h">
|
|
711
|
+
<Filter>Header Files</Filter>
|
|
712
|
+
</ClInclude>
|
|
713
|
+
<ClInclude Include="$(MSBuildThisFileDirectory)BaseFileReaderResource.h">
|
|
714
|
+
<Filter>Header Files</Filter>
|
|
715
|
+
</ClInclude>
|
|
707
716
|
<ClInclude Include="$(MSBuildThisFileDirectory)HermesRuntimeHolder.h">
|
|
708
717
|
<Filter>Hermes</Filter>
|
|
709
718
|
</ClInclude>
|
|
@@ -715,6 +724,18 @@
|
|
|
715
724
|
<ClInclude Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\JsiApi.h" />
|
|
716
725
|
<ClInclude Include="$(MSBuildThisFileDirectory)JSI\V8RuntimeHolder.h" />
|
|
717
726
|
<ClInclude Include="$(MSBuildThisFileDirectory)SafeLoadLibrary.h" />
|
|
727
|
+
<ClInclude Include="$(MSBuildThisFileDirectory)Modules\WebSocketTurboModule.h">
|
|
728
|
+
<Filter>Header Files\Modules</Filter>
|
|
729
|
+
</ClInclude>
|
|
730
|
+
<ClInclude Include="$(MSBuildThisFileDirectory)Networking\IBlobResource.h">
|
|
731
|
+
<Filter>Header Files\Networking</Filter>
|
|
732
|
+
</ClInclude>
|
|
733
|
+
<ClInclude Include="$(MSBuildThisFileDirectory)Networking\DefaultBlobResource.h">
|
|
734
|
+
<Filter>Header Files\Networking</Filter>
|
|
735
|
+
</ClInclude>
|
|
736
|
+
<ClInclude Include="$(MSBuildThisFileDirectory)IBlobPersistor.h">
|
|
737
|
+
<Filter>Header Files</Filter>
|
|
738
|
+
</ClInclude>
|
|
718
739
|
</ItemGroup>
|
|
719
740
|
<ItemGroup>
|
|
720
741
|
<None Include="$(MSBuildThisFileDirectory)tracing\rnw.wprp">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-windows",
|
|
3
|
-
"version": "0.72.
|
|
3
|
+
"version": "0.72.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,17 +23,17 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@babel/runtime": "^7.0.0",
|
|
25
25
|
"@jest/create-cache-key-function": "^29.2.1",
|
|
26
|
-
"@react-native-community/cli": "11.3.
|
|
27
|
-
"@react-native-community/cli-platform-android": "11.3.
|
|
28
|
-
"@react-native-community/cli-platform-ios": "11.3.
|
|
26
|
+
"@react-native-community/cli": "11.3.5",
|
|
27
|
+
"@react-native-community/cli-platform-android": "11.3.5",
|
|
28
|
+
"@react-native-community/cli-platform-ios": "11.3.5",
|
|
29
29
|
"@react-native-windows/cli": "0.72.0",
|
|
30
30
|
"@react-native/assets": "1.0.0",
|
|
31
31
|
"@react-native/assets-registry": "^0.72.0",
|
|
32
32
|
"@react-native/codegen": "^0.72.6",
|
|
33
|
-
"@react-native/gradle-plugin": "^0.72.
|
|
33
|
+
"@react-native/gradle-plugin": "^0.72.11",
|
|
34
34
|
"@react-native/js-polyfills": "^0.72.1",
|
|
35
35
|
"@react-native/normalize-colors": "^0.72.0",
|
|
36
|
-
"@react-native/virtualized-lists": "^0.72.
|
|
36
|
+
"@react-native/virtualized-lists": "^0.72.6",
|
|
37
37
|
"abort-controller": "^3.0.0",
|
|
38
38
|
"anser": "^1.4.9",
|
|
39
39
|
"base64-js": "^1.1.2",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"jest-environment-node": "^29.2.1",
|
|
45
45
|
"jsc-android": "^250231.0.0",
|
|
46
46
|
"memoize-one": "^5.0.0",
|
|
47
|
-
"metro-runtime": "0.76.
|
|
48
|
-
"metro-source-map": "0.76.
|
|
47
|
+
"metro-runtime": "0.76.7",
|
|
48
|
+
"metro-source-map": "0.76.7",
|
|
49
49
|
"mkdirp": "^0.5.1",
|
|
50
50
|
"nullthrows": "^1.1.1",
|
|
51
51
|
"pretty-format": "^26.5.2",
|
|
@@ -80,14 +80,14 @@
|
|
|
80
80
|
"metro-config": "0.76.4",
|
|
81
81
|
"prettier": "^2.4.1",
|
|
82
82
|
"react": "18.2.0",
|
|
83
|
-
"react-native": "0.72.
|
|
83
|
+
"react-native": "0.72.3",
|
|
84
84
|
"react-native-platform-override": "^1.9.4",
|
|
85
85
|
"react-refresh": "^0.4.0",
|
|
86
86
|
"typescript": "^4.9.5"
|
|
87
87
|
},
|
|
88
88
|
"peerDependencies": {
|
|
89
89
|
"react": "18.2.0",
|
|
90
|
-
"react-native": "^0.72.
|
|
90
|
+
"react-native": "^0.72.3"
|
|
91
91
|
},
|
|
92
92
|
"beachball": {
|
|
93
93
|
"defaultNpmTag": "latest",
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
"/Shared",
|
|
123
123
|
"/stubs",
|
|
124
124
|
"/template",
|
|
125
|
-
"/
|
|
125
|
+
"/types",
|
|
126
126
|
"/.flowconfig",
|
|
127
127
|
"/Directory.Build.props",
|
|
128
128
|
"/Directory.Build.targets",
|