[0.71] Have RCTNetworking.win32 fork RCTNetworking.ios (#12203)

* Have RCTNetworking.win32 fork RCTNetworking.ios (#12199)

* Have RCTNetworking.win32 fork RCTNetworking.ios

* Copy contents from windows to win32

* Change files

* Drop overrides newline setting to parent

* Make RCTNetworking.win32 a copy of iOS variant

* Correct iOS variant location

* Change files
This commit is contained in:
Julio César Rocha 2023-10-02 19:21:49 -07:00 коммит произвёл GitHub
Родитель ad265346bd
Коммит 2dabf59f4f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 33 добавлений и 25 удалений

Просмотреть файл

@ -40,3 +40,9 @@ end_of_line = crlf
# Shell scripts
[*.{cmd,bat,ps1}]
end_of_line = crlf
[overrides.json]
insert_final_newline = false
[package.json]
insert_final_newline = false

Просмотреть файл

@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Have RCTNetworking.win32 fork RCTNetworking.ios (#12199)",
"packageName": "@office-iss/react-native-win32",
"email": "julio.rocha@microsoft.com",
"dependentChangeType": "patch"
}

Просмотреть файл

@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Have RCTNetworking.win32 fork RCTNetworking.ios (#12199)",
"packageName": "react-native-windows",
"email": "julio.rocha@microsoft.com",
"dependentChangeType": "patch"
}

Просмотреть файл

@ -319,10 +319,10 @@
"baseHash": "a14d9698dc312aaba608b2877349d4c54600b56c"
},
{
"type": "derived",
"type": "copy",
"file": "src/Libraries/Network/RCTNetworking.win32.js",
"baseFile": "Libraries/Network/RCTNetworking.android.js",
"baseHash": "391a7efd0d2529eb536c1c7cf852f5ee538ff0b6",
"baseFile": "Libraries/Network/RCTNetworking.ios.js",
"baseHash": "b9d169d83ea1ccd04321190896b5e5e02809f940",
"issue": 4318
},
{

Просмотреть файл

@ -1,6 +1,8 @@
/**
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
@ -9,11 +11,10 @@
'use strict';
import RCTDeviceEventEmitter from '../EventEmitter/RCTDeviceEventEmitter';
const RCTNetworkingNative =
require('../BatchedBridge/NativeModules').Networking; // [Windows]
import {type NativeResponseType} from './XMLHttpRequest';
import convertRequestBody, {type RequestBody} from './convertRequestBody';
import {type EventSubscription} from '../vendor/emitter/EventEmitter';
import convertRequestBody, {type RequestBody} from './convertRequestBody';
import NativeNetworkingIOS from './NativeNetworkingIOS';
import {type NativeResponseType} from './XMLHttpRequest';
type RCTNetworkingEventDefinitions = $ReadOnly<{
didSendNetworkData: [
@ -61,11 +62,6 @@ type RCTNetworkingEventDefinitions = $ReadOnly<{
],
}>;
let _requestId = 1;
function generateRequestId(): number {
return _requestId++;
}
const RCTNetworking = {
addListener<K: $Keys<RCTNetworkingEventDefinitions>>(
eventType: K,
@ -88,13 +84,11 @@ const RCTNetworking = {
callback: (requestId: number) => void,
withCredentials: boolean,
) {
const requestId = generateRequestId();
const body = convertRequestBody(data);
RCTNetworkingNative.sendRequest(
NativeNetworkingIOS.sendRequest(
{
method,
url,
requestId,
data: {...body, trackingName},
headers,
responseType,
@ -107,11 +101,11 @@ const RCTNetworking = {
},
abortRequest(requestId: number) {
RCTNetworkingNative.abortRequest(requestId);
NativeNetworkingIOS.abortRequest(requestId);
},
clearCookies(callback: (result: boolean) => void) {
RCTNetworkingNative.clearCookies(callback);
NativeNetworkingIOS.clearCookies(callback);
},
};

Просмотреть файл

@ -27,9 +27,3 @@ csharp_prefer_simple_default_expression = false:none
[*.ps1]
indent_style = tab
indent_size = 4
[overrides.json]
insert_final_newline = false
[package.json]
insert_final_newline = false