react-native-windows 0.73.5 → 0.73.7

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.
@@ -0,0 +1,46 @@
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
+ // @generated by enums.py
9
+ // clang-format off
10
+ #pragma once
11
+
12
+ #include <cstdint>
13
+ #include <yoga/YGEnums.h>
14
+ #include <yoga/enums/YogaEnums.h>
15
+
16
+ namespace facebook::yoga {
17
+
18
+ enum class ExperimentalFeature : uint8_t {
19
+ WebFlexBasis = YGExperimentalFeatureWebFlexBasis,
20
+ AbsolutePercentageAgainstPaddingEdge = YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge,
21
+ CallMeasureCallbackOnAllNodes = YGExperimentalFeatureCallMeasureCallbackOnAllNodes, // Used just for NetUI - Keep at end of list
22
+ };
23
+
24
+ template <>
25
+ constexpr inline int32_t ordinalCount<ExperimentalFeature>() {
26
+ return 3; // This should be +1 from core due to CallMeasureCallbackOnAllNodes
27
+ }
28
+
29
+ template <>
30
+ constexpr inline int32_t bitCount<ExperimentalFeature>() {
31
+ return 2; // Depending on the number of ExperimentalFeature's this will either match core, or be core+1
32
+ }
33
+
34
+ constexpr inline ExperimentalFeature scopedEnum(YGExperimentalFeature unscoped) {
35
+ return static_cast<ExperimentalFeature>(unscoped);
36
+ }
37
+
38
+ constexpr inline YGExperimentalFeature unscopedEnum(ExperimentalFeature scoped) {
39
+ return static_cast<YGExperimentalFeature>(scoped);
40
+ }
41
+
42
+ inline const char* toString(ExperimentalFeature e) {
43
+ return YGExperimentalFeatureToString(unscopedEnum(e));
44
+ }
45
+
46
+ } // namespace facebook::yoga
@@ -3,10 +3,7 @@
3
3
 
4
4
  #include "BaseFileReaderResource.h"
5
5
 
6
- // Boost Library
7
- #include <boost/archive/iterators/base64_from_binary.hpp>
8
- #include <boost/archive/iterators/ostream_iterator.hpp>
9
- #include <boost/archive/iterators/transform_width.hpp>
6
+ #include <utilities.h>
10
7
 
11
8
  // Windows API
12
9
  #include <winrt/base.h>
@@ -73,18 +70,9 @@ void BaseFileReaderResource::ReadAsDataUrl(
73
70
  result += type;
74
71
  result += ";base64,";
75
72
 
76
- // https://www.boost.org/doc/libs/1_76_0/libs/serialization/doc/dataflow.html
77
- using namespace boost::archive::iterators;
78
- typedef base64_from_binary<transform_width<const char *, 6, 8>> encode_base64;
79
- std::ostringstream oss;
80
- std::copy(encode_base64(bytes.cbegin()), encode_base64(bytes.cend()), ostream_iterator<char>(oss));
81
- result += oss.str();
82
-
83
- // https://unix.stackexchange.com/questions/631501
84
- auto padLength = 4 - (oss.tellp() % 4);
85
- for (auto i = 0; i < padLength; ++i) {
86
- result += '=';
87
- }
73
+ auto chars = reinterpret_cast<const char *>(bytes.data());
74
+ auto view = std::string_view(chars, bytes.size());
75
+ result += Utilities::EncodeBase64(view);
88
76
 
89
77
  resolver(std::move(result));
90
78
  }
@@ -5,12 +5,6 @@
5
5
 
6
6
  #include <CreateModules.h>
7
7
  #include <ReactPropertyBag.h>
8
- #include <sstream>
9
-
10
- // Boost Library
11
- #include <boost/archive/iterators/base64_from_binary.hpp>
12
- #include <boost/archive/iterators/ostream_iterator.hpp>
13
- #include <boost/archive/iterators/transform_width.hpp>
14
8
 
15
9
  // React Native
16
10
  #include <cxxreact/JsArgumentHelpers.h>
@@ -5,6 +5,7 @@
5
5
 
6
6
  #include <Modules/IHttpModuleProxy.h>
7
7
  #include <Modules/IWebSocketModuleProxy.h>
8
+ #include <utilities.h>
8
9
 
9
10
  // Boost Libraries
10
11
  #include <boost/uuid/uuid_io.hpp>
@@ -95,11 +96,9 @@ void DefaultBlobResource::SendOverSocket(string &&blobId, int64_t offset, int64_
95
96
  return m_callbacks.OnError(e.what());
96
97
  }
97
98
 
98
- auto buffer = CryptographicBuffer::CreateFromByteArray(data);
99
- auto base64Hstring = CryptographicBuffer::EncodeToBase64String(std::move(buffer));
100
- auto base64String = winrt::to_string(base64Hstring);
101
-
102
- wsProxy->SendBinary(std::move(base64String), socketId);
99
+ auto chars = reinterpret_cast<const char *>(data.data());
100
+ auto view = std::string_view(chars, data.size());
101
+ wsProxy->SendBinary(Utilities::EncodeBase64(view), socketId);
103
102
  }
104
103
 
105
104
  void DefaultBlobResource::CreateFromParts(msrn::JSValueArray &&parts, string &&blobId) noexcept /*override*/ {
@@ -7,6 +7,9 @@
7
7
  #include <Utils/CppWinrtLessExceptions.h>
8
8
  #include <Utils/WinRTConversions.h>
9
9
 
10
+ // Boost Libraries
11
+ #include <boost/algorithm/string.hpp>
12
+
10
13
  // MSO
11
14
  #include <dispatchQueue/dispatchQueue.h>
12
15
 
@@ -16,9 +19,6 @@
16
19
  #include <winrt/Windows.Foundation.Collections.h>
17
20
  #include <winrt/Windows.Security.Cryptography.h>
18
21
 
19
- // Standard Library
20
- #include <sstream>
21
-
22
22
  using Microsoft::Common::Utilities::CheckedReinterpretCast;
23
23
 
24
24
  using std::function;
@@ -352,8 +352,12 @@ void WinRTWebSocketResource::Connect(string &&url, const Protocols &protocols, c
352
352
 
353
353
  m_readyState = ReadyState::Connecting;
354
354
 
355
+ bool hasOriginHeader = false;
355
356
  for (const auto &header : options) {
356
357
  m_socket.SetRequestHeader(header.first, winrt::to_hstring(header.second));
358
+ if (boost::iequals(header.first, L"Origin")) {
359
+ hasOriginHeader = true;
360
+ }
357
361
  }
358
362
 
359
363
  winrt::Windows::Foundation::Collections::IVector<winrt::hstring> supportedProtocols =
@@ -362,11 +366,26 @@ void WinRTWebSocketResource::Connect(string &&url, const Protocols &protocols, c
362
366
  supportedProtocols.Append(winrt::to_hstring(protocol));
363
367
  }
364
368
 
365
- m_connectRequested = true;
366
-
367
369
  Uri uri{nullptr};
368
370
  try {
369
371
  uri = Uri{winrt::to_hstring(url)};
372
+
373
+ // #12626 - If Origin header is not provided, set to connect endpoint.
374
+ if (!hasOriginHeader) {
375
+ auto scheme = uri.SchemeName();
376
+ auto host = uri.Host();
377
+ auto port = uri.Port();
378
+
379
+ if (scheme == L"ws") {
380
+ scheme = L"http";
381
+ } else if (scheme == L"wss") {
382
+ scheme = L"https";
383
+ }
384
+
385
+ auto origin = winrt::hstring{scheme + L"://" + host + L":" + winrt::to_hstring(port)};
386
+ m_socket.SetRequestHeader(L"Origin", std::move(origin));
387
+ }
388
+
370
389
  } catch (hresult_error const &e) {
371
390
  if (m_errorHandler) {
372
391
  m_errorHandler({Utilities::HResultToString(e), ErrorType::Connection});
@@ -380,6 +399,8 @@ void WinRTWebSocketResource::Connect(string &&url, const Protocols &protocols, c
380
399
  return;
381
400
  }
382
401
 
402
+ m_connectRequested = true;
403
+
383
404
  PerformConnect(std::move(uri));
384
405
  }
385
406
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-windows",
3
- "version": "0.73.5",
3
+ "version": "0.73.7",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",