react-native-windows 0.69.7 → 0.69.9

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.
Files changed (41) hide show
  1. package/Libraries/Network/RCTNetworking.windows.js +117 -1
  2. package/Microsoft.ReactNative/Base/CoreNativeModules.cpp +25 -0
  3. package/Microsoft.ReactNative/Pch/pch.h +0 -1
  4. package/Microsoft.ReactNative.Managed/Microsoft.ReactNative.Managed.csproj +1 -3
  5. package/Microsoft.ReactNative.Managed/packages.lock.json +27 -2
  6. package/PropertySheets/External/Microsoft.ReactNative.Common.props +0 -9
  7. package/PropertySheets/External/Microsoft.ReactNative.Uwp.CSharpApp.props +1 -0
  8. package/PropertySheets/External/Microsoft.ReactNative.Uwp.CSharpLib.props +1 -0
  9. package/PropertySheets/External/Microsoft.ReactNative.Uwp.CppApp.props +1 -0
  10. package/PropertySheets/External/Microsoft.ReactNative.Uwp.CppLib.props +1 -0
  11. package/PropertySheets/External/Microsoft.ReactNative.WinAppSDK.CSharpApp.props +1 -0
  12. package/PropertySheets/Generated/PackageVersion.g.props +2 -2
  13. package/PropertySheets/NuGet.CSharp.props +15 -0
  14. package/PropertySheets/NuGet.Cpp.props +31 -0
  15. package/PropertySheets/React.Cpp.props +1 -15
  16. package/Scripts/OfficeReact.Win32.nuspec +1 -0
  17. package/Shared/Modules/BlobModule.cpp +4 -4
  18. package/Shared/Modules/BlobModule.h +1 -1
  19. package/Shared/Modules/FileReaderModule.cpp +2 -2
  20. package/Shared/Modules/HttpModule.cpp +4 -2
  21. package/Shared/Modules/HttpModule.h +1 -1
  22. package/Shared/Modules/IBlobPersistor.h +1 -1
  23. package/Shared/Networking/IHttpResource.h +2 -1
  24. package/Shared/Networking/IRedirectEventSource.h +18 -0
  25. package/Shared/Networking/IWinRTHttpRequestFactory.h +22 -0
  26. package/Shared/Networking/OriginPolicy.h +1 -1
  27. package/Shared/Networking/OriginPolicyHttpFilter.cpp +47 -15
  28. package/Shared/Networking/OriginPolicyHttpFilter.h +16 -3
  29. package/Shared/Networking/RedirectHttpFilter.cpp +283 -0
  30. package/Shared/Networking/RedirectHttpFilter.h +97 -0
  31. package/Shared/Networking/WinRTHttpResource.cpp +225 -140
  32. package/Shared/Networking/WinRTHttpResource.h +17 -4
  33. package/Shared/OInstance.cpp +10 -2
  34. package/Shared/Shared.vcxitems +4 -0
  35. package/Shared/Shared.vcxitems.filters +12 -0
  36. package/package.json +1 -1
  37. package/template/cpp-app/proj/MyApp.vcxproj +0 -3
  38. package/template/cpp-lib/proj/MyLib.vcxproj +0 -3
  39. package/template/cs-app/proj/MyApp.csproj +0 -3
  40. package/template/cs-lib/proj/MyLib.csproj +0 -3
  41. package/Libraries/Network/RCTNetworkingWinShared.js +0 -117
@@ -1 +1,117 @@
1
- module.exports = require('./RCTNetworkingWinShared');
1
+ /**
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
4
+ *
5
+ * @flow strict-local
6
+ * @format
7
+ */
8
+
9
+ 'use strict';
10
+
11
+ import RCTDeviceEventEmitter from '../EventEmitter/RCTDeviceEventEmitter';
12
+ const RCTNetworkingNative =
13
+ require('../BatchedBridge/NativeModules').Networking; // [Windows]
14
+ import {type NativeResponseType} from './XMLHttpRequest';
15
+ import convertRequestBody, {type RequestBody} from './convertRequestBody';
16
+ import {type EventSubscription} from '../vendor/emitter/EventEmitter';
17
+
18
+ type RCTNetworkingEventDefinitions = $ReadOnly<{
19
+ didSendNetworkData: [
20
+ [
21
+ number, // requestId
22
+ number, // progress
23
+ number, // total
24
+ ],
25
+ ],
26
+ didReceiveNetworkResponse: [
27
+ [
28
+ number, // requestId
29
+ number, // status
30
+ ?{[string]: string}, // responseHeaders
31
+ ?string, // responseURL
32
+ ],
33
+ ],
34
+ didReceiveNetworkData: [
35
+ [
36
+ number, // requestId
37
+ string, // response
38
+ ],
39
+ ],
40
+ didReceiveNetworkIncrementalData: [
41
+ [
42
+ number, // requestId
43
+ string, // responseText
44
+ number, // progress
45
+ number, // total
46
+ ],
47
+ ],
48
+ didReceiveNetworkDataProgress: [
49
+ [
50
+ number, // requestId
51
+ number, // loaded
52
+ number, // total
53
+ ],
54
+ ],
55
+ didCompleteNetworkResponse: [
56
+ [
57
+ number, // requestId
58
+ string, // error
59
+ boolean, // timeOutError
60
+ ],
61
+ ],
62
+ }>;
63
+
64
+ let _requestId = 1;
65
+ function generateRequestId(): number {
66
+ return _requestId++;
67
+ }
68
+
69
+ const RCTNetworking = {
70
+ addListener<K: $Keys<RCTNetworkingEventDefinitions>>(
71
+ eventType: K,
72
+ listener: (...$ElementType<RCTNetworkingEventDefinitions, K>) => mixed,
73
+ context?: mixed,
74
+ ): EventSubscription {
75
+ return RCTDeviceEventEmitter.addListener(eventType, listener, context);
76
+ },
77
+
78
+ sendRequest(
79
+ method: string,
80
+ trackingName: string,
81
+ url: string,
82
+ headers: {...},
83
+ data: RequestBody,
84
+ responseType: NativeResponseType,
85
+ incrementalUpdates: boolean,
86
+ timeout: number,
87
+ callback: (requestId: number) => void,
88
+ withCredentials: boolean,
89
+ ) {
90
+ const requestId = generateRequestId();
91
+ const body = convertRequestBody(data);
92
+ RCTNetworkingNative.sendRequest(
93
+ {
94
+ method,
95
+ url,
96
+ requestId,
97
+ data: {...body, trackingName},
98
+ headers,
99
+ responseType,
100
+ incrementalUpdates,
101
+ timeout,
102
+ withCredentials,
103
+ },
104
+ callback,
105
+ );
106
+ },
107
+
108
+ abortRequest(requestId: number) {
109
+ RCTNetworkingNative.abortRequest(requestId);
110
+ },
111
+
112
+ clearCookies(callback: (result: boolean) => void) {
113
+ RCTNetworkingNative.clearCookies(callback);
114
+ },
115
+ };
116
+
117
+ module.exports = RCTNetworking;
@@ -19,8 +19,12 @@
19
19
 
20
20
  namespace Microsoft::ReactNative {
21
21
 
22
+ using winrt::Microsoft::ReactNative::ReactPropertyBag;
23
+
22
24
  namespace {
23
25
 
26
+ using winrt::Microsoft::ReactNative::ReactPropertyId;
27
+
24
28
  bool HasPackageIdentity() noexcept {
25
29
  static const bool hasPackageIdentity = []() noexcept {
26
30
  auto packageStatics = winrt::get_activation_factory<winrt::Windows::ApplicationModel::IPackageStatics>(
@@ -35,6 +39,13 @@ bool HasPackageIdentity() noexcept {
35
39
  return hasPackageIdentity;
36
40
  }
37
41
 
42
+ ReactPropertyId<bool> HttpUseMonolithicModuleProperty() noexcept {
43
+ static ReactPropertyId<bool> propId{
44
+ L"ReactNative.Http"
45
+ L"UseMonolithicModule"};
46
+ return propId;
47
+ }
48
+
38
49
  } // namespace
39
50
 
40
51
  std::vector<facebook::react::NativeModuleDescription> GetCoreModules(
@@ -50,11 +61,25 @@ std::vector<facebook::react::NativeModuleDescription> GetCoreModules(
50
61
  [props = context->Properties()]() { return Microsoft::React::CreateHttpModule(props); },
51
62
  jsMessageQueue);
52
63
 
64
+ if (!ReactPropertyBag(context->Properties()).Get(HttpUseMonolithicModuleProperty())) {
65
+ modules.emplace_back(
66
+ Microsoft::React::GetBlobModuleName(),
67
+ [props = context->Properties()]() { return Microsoft::React::CreateBlobModule(props); },
68
+ batchingUIMessageQueue);
69
+
70
+ modules.emplace_back(
71
+ Microsoft::React::GetFileReaderModuleName(),
72
+ [props = context->Properties()]() { return Microsoft::React::CreateFileReaderModule(props); },
73
+ batchingUIMessageQueue);
74
+ }
75
+
53
76
  modules.emplace_back(
54
77
  "Timing",
55
78
  [batchingUIMessageQueue]() { return facebook::react::CreateTimingModule(batchingUIMessageQueue); },
56
79
  batchingUIMessageQueue);
57
80
 
81
+ // Note: `context` is moved to remove the reference from the current scope.
82
+ // This should either be the last usage of `context`, or the std::move call should happen later in this method.
58
83
  modules.emplace_back(
59
84
  NativeAnimatedModule::name,
60
85
  [context = std::move(context)]() mutable { return std::make_unique<NativeAnimatedModule>(std::move(context)); },
@@ -43,7 +43,6 @@
43
43
  #include <winrt/Windows.Storage.Streams.h>
44
44
  #include <winrt/Windows.UI.ViewManagement.Core.h>
45
45
  #include <winrt/Windows.UI.ViewManagement.h>
46
- #include <winrt/Windows.Web.Http.Filters.h>
47
46
  #include <winrt/Windows.Web.Http.Headers.h>
48
47
 
49
48
  #include "Base/CxxReactIncludes.h"
@@ -25,9 +25,6 @@
25
25
  <NoWarn>$(NoWarn);1591</NoWarn>
26
26
  <!-- Missing XML comment for publicly visible type or member -->
27
27
  </PropertyGroup>
28
- <PropertyGroup Label="NuGet">
29
- <AssetTargetFallback>$(AssetTargetFallback);native</AssetTargetFallback>
30
- </PropertyGroup>
31
28
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
32
29
  <PlatformTarget>x86</PlatformTarget>
33
30
  <DebugSymbols>true</DebugSymbols>
@@ -80,6 +77,7 @@
80
77
  <RestoreProjectStyle>PackageReference</RestoreProjectStyle>
81
78
  <RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
82
79
  </PropertyGroup>
80
+ <Import Project="..\PropertySheets\NuGet.CSharp.props" />
83
81
  <Import Project="..\PropertySheets\WinUI.props" />
84
82
  <ItemGroup>
85
83
  <Compile Include="AttributedViewManager.cs" />
@@ -24,6 +24,11 @@
24
24
  "Microsoft.SourceLink.Common": "1.0.0"
25
25
  }
26
26
  },
27
+ "boost": {
28
+ "type": "Transitive",
29
+ "resolved": "1.76.0",
30
+ "contentHash": "p+w3YvNdXL8Cu9Fzrmexssu0tZbWxuf6ywsQqHjDlKFE5ojXHof1HIyMC3zDLfLnh80dIeFcEUAuR2Asg/XHRA=="
31
+ },
27
32
  "Microsoft.Build.Tasks.Git": {
28
33
  "type": "Transitive",
29
34
  "resolved": "1.0.0",
@@ -60,14 +65,34 @@
60
65
  "resolved": "1.0.0",
61
66
  "contentHash": "G8DuQY8/DK5NN+3jm5wcMcd9QYD90UV7MiLmdljSJixi3U/vNaeBKmmXUqI4DJCOeWizIUEh4ALhSt58mR+5eg=="
62
67
  },
68
+ "Microsoft.UI.Xaml": {
69
+ "type": "Transitive",
70
+ "resolved": "2.7.0",
71
+ "contentHash": "dB4im13tfmMgL/V3Ei+3kD2rUF+/lTxAmR4gjJ45l577eljHfdo/KUrxpq/3I1Vp6e5GCDG1evDaEGuDxypLMg=="
72
+ },
73
+ "Microsoft.Windows.CppWinRT": {
74
+ "type": "Transitive",
75
+ "resolved": "2.0.211028.7",
76
+ "contentHash": "JBGI0c3WLoU6aYJRy9Qo0MLDQfObEp+d4nrhR95iyzf7+HOgjRunHDp/6eGFREd7xq3OI1mll9ecJrMfzBvlyg=="
77
+ },
78
+ "Microsoft.Windows.SDK.BuildTools": {
79
+ "type": "Transitive",
80
+ "resolved": "10.0.22000.194",
81
+ "contentHash": "4L0P3zqut466SIqT3VBeLTNUQTxCBDOrTRymRuROCRJKazcK7ibLz9yAO1nKWRt50ttCj39oAa2Iuz9ZTDmLlg=="
82
+ },
63
83
  "NETStandard.Library": {
64
84
  "type": "Transitive",
65
85
  "resolved": "2.0.3",
66
- "contentHash": "st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==",
86
+ "contentHash": "548M6mnBSJWxsIlkQHfbzoYxpiYFXZZSL00p4GHYv8PkiqFBnnT68mW5mGEsA/ch9fDO9GkPgkFQpWiXZN7mAQ==",
67
87
  "dependencies": {
68
88
  "Microsoft.NETCore.Platforms": "1.1.0"
69
89
  }
70
90
  },
91
+ "ReactNative.Hermes.Windows": {
92
+ "type": "Transitive",
93
+ "resolved": "0.11.0-ms.6",
94
+ "contentHash": "WAVLsSZBV4p/3hNC3W67su7xu3f/ZMSKxu0ON7g2GaKRbkJmH0Qyif1IlzcJwtvR48kuOdfgPu7Bgtz3AY+gqg=="
95
+ },
71
96
  "runtime.win10-arm.Microsoft.Net.Native.Compiler": {
72
97
  "type": "Transitive",
73
98
  "resolved": "2.2.7-rel-27913-00",
@@ -303,4 +328,4 @@
303
328
  }
304
329
  }
305
330
  }
306
- }
331
+ }
@@ -37,14 +37,5 @@
37
37
  <HermesNoDLLCopy Condition="'$(UseHermes)' != 'true'">true</HermesNoDLLCopy>
38
38
  </PropertyGroup>
39
39
 
40
- <!-- Should match entry in $(ReactNativeWindowsDir)vnext\Directory.Build.props -->
41
- <PropertyGroup Label="NuGet" Condition="'$(MSBuildProjectExtension)' == '.vcxproj'">
42
- <!--See https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets#restore-target-->
43
- <RestoreUseStaticGraphEvaluation Condition="'$(BuildingInsideVisualStudio)' == 'true'">true</RestoreUseStaticGraphEvaluation>
44
-
45
- <!-- Ensure PackageReference compatibility for any consuming projects/apps -->
46
- <ResolveNuGetPackages>false</ResolveNuGetPackages>
47
- </PropertyGroup>
48
-
49
40
  <Import Project="$(ReactNativeWindowsDir)\PropertySheets\Generated\PackageVersion.g.props" />
50
41
  </Project>
@@ -20,5 +20,6 @@
20
20
  <Import Project="$(MSBuildThisFileDirectory)Microsoft.ReactNative.Uwp.Common.props" />
21
21
  <Import Project="$(ReactNativeWindowsDir)\PropertySheets\Appx.props" />
22
22
  <Import Project="$(ReactNativeWindowsDir)\PropertySheets\Autolink.props" />
23
+ <Import Project="$(ReactNativeWindowsDir)\PropertySheets\NuGet.CSharp.props" />
23
24
  <Import Project="$(ReactNativeWindowsDir)\PropertySheets\WinUI.props" />
24
25
  </Project>
@@ -13,4 +13,5 @@
13
13
  </PropertyGroup>
14
14
 
15
15
  <Import Project="$(MSBuildThisFileDirectory)Microsoft.ReactNative.Uwp.Common.props" />
16
+ <Import Project="$(ReactNativeWindowsDir)\PropertySheets\NuGet.CSharp.props" />
16
17
  </Project>
@@ -16,6 +16,7 @@
16
16
  <Import Project="$(MSBuildThisFileDirectory)Microsoft.ReactNative.Uwp.Common.props" />
17
17
  <Import Project="$(ReactNativeWindowsDir)\PropertySheets\Appx.props" />
18
18
  <Import Project="$(ReactNativeWindowsDir)\PropertySheets\Autolink.props" />
19
+ <Import Project="$(ReactNativeWindowsDir)\PropertySheets\NuGet.Cpp.props" />
19
20
  <Import Project="$(ReactNativeWindowsDir)\PropertySheets\WinUI.props" />
20
21
  <Import Project="$(ReactNativeWindowsDir)\PropertySheets\CppAppConsumeCSharpModule.props" />
21
22
  <Import Project="$(ReactNativeWindowsDir)\PropertySheets\PackageVersionDefinitions.props" />
@@ -17,6 +17,7 @@
17
17
  <GenerateLibraryLayout>false</GenerateLibraryLayout>
18
18
  </PropertyGroup>
19
19
  <Import Project="$(MSBuildThisFileDirectory)Microsoft.ReactNative.Uwp.Common.props" />
20
+ <Import Project="$(ReactNativeWindowsDir)\PropertySheets\NuGet.Cpp.props" />
20
21
  <Import Project="$(ReactNativeWindowsDir)\PropertySheets\WinUI.props" />
21
22
  <Import Project="$(ReactNativeWindowsDir)\PropertySheets\PackageVersionDefinitions.props" />
22
23
  </Project>
@@ -22,5 +22,6 @@
22
22
  <Import Project="$(MSBuildThisFileDirectory)Microsoft.ReactNative.WinAppSDK.Common.props" />
23
23
  <Import Project="$(ReactNativeWindowsDir)\PropertySheets\Appx.props" />
24
24
  <Import Project="$(ReactNativeWindowsDir)\PropertySheets\Autolink.props" />
25
+ <Import Project="$(ReactNativeWindowsDir)\PropertySheets\NuGet.CSharp.props" />
25
26
  <Import Project="$(ReactNativeWindowsDir)\PropertySheets\WinUI.props" />
26
27
  </Project>
@@ -10,10 +10,10 @@
10
10
  -->
11
11
  <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
12
12
  <PropertyGroup>
13
- <ReactNativeWindowsVersion>0.69.7</ReactNativeWindowsVersion>
13
+ <ReactNativeWindowsVersion>0.69.9</ReactNativeWindowsVersion>
14
14
  <ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
15
15
  <ReactNativeWindowsMinor>69</ReactNativeWindowsMinor>
16
- <ReactNativeWindowsPatch>7</ReactNativeWindowsPatch>
16
+ <ReactNativeWindowsPatch>9</ReactNativeWindowsPatch>
17
17
  <ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
18
18
  </PropertyGroup>
19
19
  </Project>
@@ -0,0 +1,15 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!--
3
+ Copyright (c) Microsoft Corporation. All rights reserved.
4
+ Licensed under the MIT License.
5
+
6
+ Defines NuGet-related properties for C# projects using PackageReference.
7
+ -->
8
+ <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
9
+
10
+ <PropertyGroup Label="NuGet">
11
+ <!-- https://github.com/NuGet/Home/issues/10511#issuecomment-778400668 -->
12
+ <AssetTargetFallback>$(AssetTargetFallback);native</AssetTargetFallback>
13
+ </PropertyGroup>
14
+
15
+ </Project>
@@ -0,0 +1,31 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!--
3
+ Copyright (c) Microsoft Corporation. All rights reserved.
4
+ Licensed under the MIT License.
5
+
6
+ Defines NuGet-related properties for C++ projects using PackageReference.
7
+ -->
8
+ <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
9
+
10
+ <PropertyGroup Label="NuGet">
11
+ <!-- Should match entry in $(ReactNativeWindowsDir)vnext\Directory.Build.props -->
12
+ <!--See https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets#restore-target-->
13
+ <RestoreUseStaticGraphEvaluation Condition="'$(BuildingInsideVisualStudio)' == 'true'">true</RestoreUseStaticGraphEvaluation>
14
+
15
+ <!-- Ensure PackageReference compatibility for any consuming projects/apps -->
16
+ <ResolveNuGetPackages>false</ResolveNuGetPackages>
17
+
18
+ <!-- https://github.com/NuGet/Home/issues/10511#issuecomment-778400668 -->
19
+ <AssetTargetFallback>$(AssetTargetFallback);uap10.0.16299</AssetTargetFallback>
20
+
21
+ <!--
22
+ Avoid Visual Studio error message:
23
+ "The project '$(MSBuildProjectName)' ran into a problem during the last operation: The value of the
24
+ 'TargetFrameworkMoniker' and 'NuGetTargetMoniker' properties in the '$(Configuration)|$(Platform)' configuration are both
25
+ empty. This configuration will not contribute to NuGet restore, which may result in restore and build errors. You may
26
+ need to reload the solution after fixing the problem."
27
+ -->
28
+ <TargetFrameworkMoniker>native,Version=v0.0</TargetFrameworkMoniker>
29
+ </PropertyGroup>
30
+
31
+ </Project>
@@ -17,21 +17,7 @@
17
17
  <EnableWinRtLeanAndMean Condition="'$(EnableWinRtLeanAndMean)' == ''">true</EnableWinRtLeanAndMean>
18
18
  </PropertyGroup>
19
19
 
20
- <PropertyGroup Label="NuGet">
21
- <ResolveNuGetPackages>false</ResolveNuGetPackages>
22
-
23
- <!-- https://github.com/NuGet/Home/issues/10511#issuecomment-778400668 -->
24
- <AssetTargetFallback>$(AssetTargetFallback);native</AssetTargetFallback>
25
-
26
- <!--
27
- Avoid Visual Studio error message:
28
- "The project '$(MSBuildProjectName)' ran into a problem during the last operation: The value of the
29
- 'TargetFrameworkMoniker' and 'NuGetTargetMoniker' properties in the '$(Configuration)|$(Platform)' configuration are both
30
- empty. This configuration will not contribute to NuGet restore, which may result in restore and build errors. You may
31
- need to reload the solution after fixing the problem."
32
- -->
33
- <TargetFrameworkMoniker>native,Version=v0.0</TargetFrameworkMoniker>
34
- </PropertyGroup>
20
+ <Import Project="$(MSBuildThisFileDirectory)NuGet.Cpp.props" />
35
21
 
36
22
  <PropertyGroup Label="Desktop">
37
23
  <!-- See https://docs.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt -->
@@ -56,6 +56,7 @@
56
56
  <file src="$nugetroot$\inc\Shared\Modules\I18nModule.h" target="inc"/>
57
57
  <file src="$nugetroot$\inc\Shared\NativeModuleProvider.h" target="inc"/>
58
58
  <file src="$nugetroot$\inc\Shared\Networking\IWebSocketResource.h" target="inc"/>
59
+ <file src="$nugetroot$\inc\Shared\Networking\OriginPolicy.h" target="inc"/>
59
60
  <file src="$nugetroot$\inc\Shared\RuntimeOptions.h" target="inc"/>
60
61
  <file src="$nugetroot$\inc\Shared\Tracing.h" target="inc"/>
61
62
 
@@ -139,7 +139,7 @@ vector<module::CxxModule::Method> BlobModule::getMethods() {
139
139
  auto size = blob[sizeKey].getInt();
140
140
  auto socketID = jsArgAsInt(args, 1);
141
141
 
142
- winrt::array_view<uint8_t> data;
142
+ winrt::array_view<uint8_t const> data;
143
143
  try {
144
144
  data = persistor->ResolveMessage(std::move(blobId), offset, size);
145
145
  } catch (const std::exception &e) {
@@ -169,7 +169,7 @@ vector<module::CxxModule::Method> BlobModule::getMethods() {
169
169
  auto type = part[typeKey].asString();
170
170
  if (blobKey == type) {
171
171
  auto blob = part[dataKey];
172
- winrt::array_view<uint8_t> bufferPart;
172
+ winrt::array_view<uint8_t const> bufferPart;
173
173
  try {
174
174
  bufferPart = persistor->ResolveMessage(
175
175
  blob[blobIdKey].asString(), blob[offsetKey].asInt(), blob[sizeKey].asInt());
@@ -216,7 +216,7 @@ vector<module::CxxModule::Method> BlobModule::getMethods() {
216
216
 
217
217
  #pragma region IBlobPersistor
218
218
 
219
- winrt::array_view<uint8_t> MemoryBlobPersistor::ResolveMessage(string &&blobId, int64_t offset, int64_t size) {
219
+ winrt::array_view<uint8_t const> MemoryBlobPersistor::ResolveMessage(string &&blobId, int64_t offset, int64_t size) {
220
220
  if (size < 1)
221
221
  return {};
222
222
 
@@ -233,7 +233,7 @@ winrt::array_view<uint8_t> MemoryBlobPersistor::ResolveMessage(string &&blobId,
233
233
  if (endBound > bytes.size() || offset >= static_cast<int64_t>(bytes.size()) || offset < 0)
234
234
  throw std::out_of_range("Offset or size out of range");
235
235
 
236
- return winrt::array_view<uint8_t>(bytes.data() + offset, bytes.data() + endBound);
236
+ return winrt::array_view<uint8_t const>(bytes.data() + offset, bytes.data() + endBound);
237
237
  }
238
238
 
239
239
  void MemoryBlobPersistor::RemoveMessage(string &&blobId) noexcept {
@@ -30,7 +30,7 @@ class MemoryBlobPersistor final : public IBlobPersistor {
30
30
  public:
31
31
  #pragma region IBlobPersistor
32
32
 
33
- winrt::array_view<uint8_t> ResolveMessage(std::string &&blobId, int64_t offset, int64_t size) override;
33
+ winrt::array_view<uint8_t const> ResolveMessage(std::string &&blobId, int64_t offset, int64_t size) override;
34
34
 
35
35
  void RemoveMessage(std::string &&blobId) noexcept override;
36
36
 
@@ -71,7 +71,7 @@ std::vector<module::CxxModule::Method> FileReaderModule::getMethods() {
71
71
  auto offset = blob["offset"].asInt();
72
72
  auto size = blob["size"].asInt();
73
73
 
74
- winrt::array_view<uint8_t> bytes;
74
+ winrt::array_view<uint8_t const> bytes;
75
75
  try {
76
76
  bytes = blobPersistor->ResolveMessage(std::move(blobId), offset, size);
77
77
  } catch (const std::exception &e) {
@@ -116,7 +116,7 @@ std::vector<module::CxxModule::Method> FileReaderModule::getMethods() {
116
116
  auto offset = blob["offset"].asInt();
117
117
  auto size = blob["size"].asInt();
118
118
 
119
- winrt::array_view<uint8_t> bytes;
119
+ winrt::array_view<uint8_t const> bytes;
120
120
  try {
121
121
  bytes = blobPersistor->ResolveMessage(std::move(blobId), offset, size);
122
122
  } catch (const std::exception &e) {
@@ -72,9 +72,11 @@ static void SetUpHttpResource(
72
72
  };
73
73
  resource->SetOnData(std::move(onDataDynamic));
74
74
 
75
- resource->SetOnError([weakReactInstance](int64_t requestId, string &&message) {
75
+ resource->SetOnError([weakReactInstance](int64_t requestId, string &&message, bool isTimeout) {
76
76
  dynamic args = dynamic::array(requestId, std::move(message));
77
- // TODO: isTimeout errorArgs.push_back(true);
77
+ if (isTimeout) {
78
+ args.push_back(true);
79
+ }
78
80
 
79
81
  SendEvent(weakReactInstance, completedResponse, std::move(args));
80
82
  });
@@ -15,7 +15,7 @@ namespace Microsoft::React {
15
15
 
16
16
  ///
17
17
  /// Realizes <c>NativeModules</c> projection.
18
- /// <remarks>See src\Libraries\Network\RCTNetworkingWinShared.js</remarks>
18
+ /// <remarks>See src\Libraries\Network\RCTNetworking.windows.js</remarks>
19
19
  ///
20
20
  class HttpModule : public facebook::xplat::module::CxxModule {
21
21
  public:
@@ -18,7 +18,7 @@ struct IBlobPersistor {
18
18
  /// When an entry for blobId cannot be found.
19
19
  /// </exception>
20
20
  ///
21
- virtual winrt::array_view<uint8_t> ResolveMessage(std::string &&blobId, int64_t offset, int64_t size) = 0;
21
+ virtual winrt::array_view<uint8_t const> ResolveMessage(std::string &&blobId, int64_t offset, int64_t size) = 0;
22
22
 
23
23
  virtual void RemoveMessage(std::string &&blobId) noexcept = 0;
24
24
 
@@ -71,6 +71,7 @@ struct IHttpResource {
71
71
  /// </param>
72
72
  /// <param name="timeout">
73
73
  /// Request timeout in miliseconds.
74
+ /// Note: A value of 0 means no timeout. The resource will await the response indefinitely.
74
75
  /// </param>
75
76
  /// <param name="withCredentials">
76
77
  /// Allow including credentials in request.
@@ -95,7 +96,7 @@ struct IHttpResource {
95
96
  virtual void SetOnData(std::function<void(int64_t requestId, std::string &&responseData)> &&handler) noexcept = 0;
96
97
  virtual void SetOnData(std::function<void(int64_t requestId, folly::dynamic &&responseData)> &&handler) noexcept = 0;
97
98
  virtual void SetOnError(
98
- std::function<void(int64_t requestId, std::string &&errorMessage /*, bool isTimeout*/)> &&handler) noexcept = 0;
99
+ std::function<void(int64_t requestId, std::string &&errorMessage, bool isTimeout)> &&handler) noexcept = 0;
99
100
  };
100
101
 
101
102
  } // namespace Microsoft::React::Networking
@@ -0,0 +1,18 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ #pragma once
5
+
6
+ #include <winrt/Windows.Foundation.h>
7
+ #include <winrt/Windows.Web.Http.h>
8
+ #include <winrt/base.h>
9
+
10
+ namespace Microsoft::React::Networking {
11
+
12
+ struct IRedirectEventSource : winrt::implements<IRedirectEventSource, winrt::Windows::Foundation::IInspectable> {
13
+ virtual bool OnRedirecting(
14
+ winrt::Windows::Web::Http::HttpRequestMessage const &request,
15
+ winrt::Windows::Web::Http::HttpResponseMessage const &response) noexcept = 0;
16
+ };
17
+
18
+ } // namespace Microsoft::React::Networking
@@ -0,0 +1,22 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ #pragma once
5
+
6
+ #include <winrt/Windows.Foundation.Collections.h>
7
+ #include <winrt/Windows.Foundation.h>
8
+ #include <winrt/Windows.Web.Http.h>
9
+
10
+ namespace Microsoft::React::Networking {
11
+
12
+ struct IWinRTHttpRequestFactory {
13
+ virtual ~IWinRTHttpRequestFactory() noexcept {}
14
+
15
+ virtual winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Web::Http::HttpRequestMessage> CreateRequest(
16
+ winrt::Windows::Web::Http::HttpMethod &&method,
17
+ winrt::Windows::Foundation::Uri &&uri,
18
+ winrt::Windows::Foundation::Collections::IMap<winrt::hstring, winrt::Windows::Foundation::IInspectable>
19
+ props) noexcept = 0;
20
+ };
21
+
22
+ } // namespace Microsoft::React::Networking
@@ -9,7 +9,7 @@ enum class OriginPolicy : size_t {
9
9
  None = 0,
10
10
  SameOrigin = 1,
11
11
  SimpleCrossOriginResourceSharing = 2,
12
- CrossOriginResourceSharing = 3, // TODO: Rename as FullCrossOriginResourceSharing?
12
+ CrossOriginResourceSharing = 3,
13
13
  };
14
14
 
15
15
  } // namespace Microsoft::React::Networking