Skip to content

Commit 10143e1

Browse files
authored
feat: adapt to harmonyOS Next (#2)
1 parent a6c2c70 commit 10143e1

File tree

75 files changed

+701
-7636
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+701
-7636
lines changed

LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
The MIT License (MIT)
2+
Copyright © 2024 <copyright holders>
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy
5+
of this software and associated documentation files (the “Software”), to deal
6+
in the Software without restriction, including without limitation the rights
7+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
copies of the Software, and to permit persons to whom the Software is
9+
furnished to do so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in all
12+
copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
SOFTWARE.

README.md

Lines changed: 9 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,20 @@
1-
# react-native-http-bridge
1+
# @react-native-oh-tpl/react-native-haptic-feedback
22

3-
Simple HTTP server for [React Native](https://github.com/facebook/react-native).
4-
Created for [Status.im](https://github.com/status-im/status-react).
3+
本项目基于 [react-native-http-bridge](https://github.com/alwx/react-native-http-bridge)
54

6-
Since 0.5.0 supports and handles GET, POST, PUT and DELETE requests.
7-
The library can be useful for handling requests with `application/json` content type
8-
(and this is the only content type we support at the current stage) and returning different responses.
5+
## 文档地址 / Documentation URL
96

10-
Since 0.6.0 can handle millions of requests at the same time and also includes some very basic support for [React Native QT](https://github.com/status-im/react-native-desktop).
7+
[中文 / Chinese](https://gitee.com/react-native-oh-library/usage-docs/blob/master/zh-cn/react-native-haptic-feedback.md)
118

12-
## Install
9+
[英文 / English](https://gitee.com/react-native-oh-library/usage-docs/blob/master/zh-en/react-native-haptic-feedback.md)
1310

14-
```shell
15-
npm install --save react-native-http-bridge
16-
```
11+
## Codegen
1712

18-
## Automatically link
13+
该库已接入 codegen,具体请查阅文档。
1914

20-
#### With React Native 0.27+
2115

22-
```shell
23-
react-native link react-native-http-bridge
24-
```
16+
## 请悉知 / Acknowledgements
2517

26-
## Example
18+
本项目基于 [The MIT License (MIT)](https://www.mit-license.org/) ,请自由地享受和参与开源。
2719

28-
First import/require react-native-http-server:
2920

30-
```js
31-
32-
var httpBridge = require('react-native-http-bridge');
33-
34-
```
35-
36-
37-
Initalize the server in the `componentWillMount` lifecycle method. You need to provide a `port` and a callback.
38-
39-
```js
40-
41-
componentWillMount() {
42-
// initalize the server (now accessible via localhost:1234)
43-
httpBridge.start(5561, 'http_service' request => {
44-
45-
// you can use request.url, request.type and request.postData here
46-
if (request.type === "GET" && request.url.split("/")[1] === "users") {
47-
httpBridge.respond(request.requestId, 200, "application/json", "{\"message\": \"OK\"}");
48-
} else {
49-
httpBridge.respond(request.requestId, 400, "application/json", "{\"message\": \"Bad Request\"}");
50-
}
51-
52-
});
53-
}
54-
55-
```
56-
57-
Finally, ensure that you disable the server when your component is being unmounted.
58-
59-
```js
60-
61-
componentWillUnmount() {
62-
httpBridge.stop();
63-
}
64-
65-
```

android/build.gradle

Lines changed: 0 additions & 40 deletions
This file was deleted.

android/src/main/AndroidManifest.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

android/src/main/java/me/alwx/HttpServer/HttpServerModule.java

Lines changed: 0 additions & 92 deletions
This file was deleted.

android/src/main/java/me/alwx/HttpServer/HttpServerReactPackage.java

Lines changed: 0 additions & 30 deletions
This file was deleted.

android/src/main/java/me/alwx/HttpServer/Server.java

Lines changed: 0 additions & 88 deletions
This file was deleted.

harmony/http_bridge.har

92.9 KB
Binary file not shown.

harmony/http_bridge/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/node_modules
2+
/oh_modules
3+
/.preview
4+
/build
5+
/.cxx
6+
/.test

harmony/http_bridge/BuildProfile.ets

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* Use these variables when you tailor your ArkTS code. They must be of the const type.
3+
*/
4+
export const HAR_VERSION = '0.6.1-0.0.1';
5+
export const BUILD_MODE_NAME = 'debug';
6+
export const DEBUG = true;
7+
export const TARGET_NAME = 'default';
8+
9+
/**
10+
* BuildProfile Class is used only for compatibility purposes.
11+
*/
12+
export default class BuildProfile {
13+
static readonly HAR_VERSION = HAR_VERSION;
14+
static readonly BUILD_MODE_NAME = BUILD_MODE_NAME;
15+
static readonly DEBUG = DEBUG;
16+
static readonly TARGET_NAME = TARGET_NAME;
17+
}

0 commit comments

Comments
 (0)