@onekeyfe/react-native-network-throttle 3.0.157-alpha.275 → 3.0.157-alpha.276

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 (2) hide show
  1. package/README.md +38 -0
  2. package/package.json +5 -4
package/README.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # @onekeyfe/react-native-network-throttle
2
2
 
3
+ Native network throttling configuration for OneKey diagnostics on iOS and
4
+ Android. The wrapper exposes the current configuration and partial updates,
5
+ including latency, bandwidth and the host list used by native throttling.
6
+
7
+ ## Installation and usage
8
+
9
+ ```sh
10
+ yarn add @onekeyfe/react-native-network-throttle
11
+ ```
12
+
13
+ Install the application's iOS pods and rebuild the native application so
14
+ `OneKeyNetworkThrottle` is linked.
15
+
16
+ ```ts
17
+ import { NetworkThrottle } from '@onekeyfe/react-native-network-throttle';
18
+
19
+ const config = await NetworkThrottle.getConfig();
20
+ // Integrate changes through the application's existing diagnostic controls.
21
+ ```
22
+
23
+ ## Configuration API
24
+
25
+ `getConfig()` returns `enabled`, `profile`, `latencyMs`, `downloadBps`,
26
+ `uploadBps` and `throttleUrlHosts`. The public profile type currently contains
27
+ `slow4g`. Exported constants provide its latency and bandwidth presets.
28
+
29
+ `setConfig(partialConfig)` reads the current native configuration, merges
30
+ omitted fields and returns the applied configuration. Bandwidth fields use
31
+ bytes per second. An omitted host list from native is normalized to an empty
32
+ array. The interface does not expose individual request progress or completion.
33
+
34
+ The application owns enabling/disabling diagnostic throttling and should
35
+ validate effects on the actual native request path it uses. A returned config
36
+ is not a measurement of achieved throughput. See [src/index.tsx](src/index.tsx)
37
+ for the public types, constants and native-linking failure behavior.
38
+
39
+ ## Upstream attribution
40
+
3
41
  React Native native network throttle for OneKey iOS and Android development settings.
4
42
 
5
43
  Current scope is RN HTTP(S) latency and upload/download throughput. It does not
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-network-throttle",
3
- "version": "3.0.157-alpha.275",
3
+ "version": "3.0.157-alpha.276",
4
4
  "description": "react-native-network-throttle",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -47,14 +47,15 @@
47
47
  ],
48
48
  "repository": {
49
49
  "type": "git",
50
- "url": "git+https://github.com/OneKeyHQ/app-modules/react-native-network-throttle.git"
50
+ "url": "git+https://github.com/OneKeyHQ/app-modules.git",
51
+ "directory": "native-modules/react-native-network-throttle"
51
52
  },
52
53
  "author": "@onekeyhq <huanming@onekey.so> (https://github.com/OneKeyHQ/app-modules)",
53
54
  "license": "MIT",
54
55
  "bugs": {
55
- "url": "https://github.com/OneKeyHQ/app-modules/react-native-network-throttle/issues"
56
+ "url": "https://github.com/OneKeyHQ/app-modules/issues"
56
57
  },
57
- "homepage": "https://github.com/OneKeyHQ/app-modules/react-native-network-throttle#readme",
58
+ "homepage": "https://github.com/OneKeyHQ/app-modules/tree/main/native-modules/react-native-network-throttle#readme",
58
59
  "publishConfig": {
59
60
  "registry": "https://registry.npmjs.org/"
60
61
  },