Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/sdks/api/message/createFaceMessage.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ OIMMessageInfo *message = [OIMMessageInfo createFaceMessageWithIndex:0 data:@""]
```ts showLineNumbers
IMSDK.createFaceMessage({
index: number;
dataStr: string;
data: string;
}, operationID?: string): Promise<WsResponse<MessageItem>>
```

Expand All @@ -149,7 +149,7 @@ IMSDK.createFaceMessage({
| 参数名称 | 参数类型 | 是否必填 | 描述 |
| -------- | -------- | -------- | ---- |
| index | number | 是 | 索引 |
| dataStr | string | 是 | 内容 |
| data | string | 是 | 内容 |

### 返回结果

Expand All @@ -174,7 +174,7 @@ const IMSDK = getSDK();

IMSDK.createFaceMessage({
index: 0,
dataStr: 'https://xxx/xxx/xx.png',
data: 'https://xxx/xxx/xx.png',
})
.then(({ data }) => {
// 调用成功
Expand Down Expand Up @@ -240,7 +240,7 @@ IMSDK.asyncApi('createFaceMessage', IMSDK.uuid(), {
```ts showLineNumbers
OpenIMSDK.createFaceMessage({
index: number;
dataStr: string;
data: string;
}, operationID?: string): Promise<MessageItem>
```

Expand All @@ -249,7 +249,7 @@ OpenIMSDK.createFaceMessage({
| 参数名称 | 参数类型 | 是否必填 | 描述 |
| ----------- | -------- | -------- | ------------------------------------------------------- |
| index | number | 是 | 索引 |
| dataStr | string | 是 | 内容 |
| data | string | 是 | 内容 |
| operationID | string | 否 | 操作 ID,用于定位问题,保持唯一,建议用当前时间和随机数 |

### 返回结果
Expand All @@ -267,7 +267,7 @@ import OpenIMSDK from "@openim/rn-client-sdk";

OpenIMSDK.createFaceMessage({
index: 0,
dataStr: 'https://xxx/xxx/xx.png',
data: 'https://xxx/xxx/xx.png',
})
.then((data) => {
// 调用成功
Expand Down
14 changes: 7 additions & 7 deletions docs/sdks/api/message/getAdvancedHistoryMessageList.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,10 @@ IMSDK.asyncApi('getAdvancedHistoryMessageList', IMSDK.uuid(), {

```ts showLineNumbers
OpenIMSDK.getAdvancedHistoryMessageList({
lastMinSeq: number;
count: number;
startClientMsgID: string;
conversationID: string;
startClientMsgID: string;
count: number;
viewType: ViewType
}, operationID?: string): Promise<AdvancedGetMessageResult>
```

Expand All @@ -302,13 +302,13 @@ OpenIMSDK.getAdvancedHistoryMessageList({
### 代码示例

```js showLineNumbers
import OpenIMSDK from "@openim/rn-client-sdk";
import OpenIMSDK, { ViewType } from "@openim/rn-client-sdk";

OpenIMSDK.getAdvancedHistoryMessageList({
lastMinSeq: 0,
count: 20,
startClientMsgID: '',
conversationID: 'conversationID',
startClientMsgID: '',
count: 20,
viewType: ViewType.History,
})
.then((data) => {
// 调用成功
Expand Down
30 changes: 28 additions & 2 deletions docs/sdks/quickstart/reactNative.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ sidebar_position: 4

## 注意事项 ❗️

- **Android 16KB 页大小支持:** 从 `v3.8.3-patch.12` 开始,Android 核心依赖升级为 `io.openim:core-sdk:3.8.3-patch12+1`,新增了对使用 16KB 内存页大小设备的兼容性。

- **Expo 支持:** 从 `v3.8.3-patch.10.3` 及之后版本开始支持 Expo 的 development build(custom dev client)。

- 从 `v3.8.3-patch.10` 版本开始,包名从 `open-im-sdk-rn` 改为 `@openim/rn-client-sdk`。

- 从 `v3.8.3-patch.10.2` 版本开始,`operationID` 参数是可选的(如果未提供,SDK 将自动生成一个),在之前的版本,这个参数是必填的,必须显式传递。(operationID 用于后端日志查询)
Expand All @@ -21,8 +25,31 @@ sidebar_position: 4

### 1. 添加依赖

#### 在 React Native CLI 项目中安装

```sh
yarn add @openim/rn-client-sdk
# 安装 openim sdk
npm install @openim/rn-client-sdk

# 安装 iOS 依赖
cd ios && pod install && cd ..
```

#### 在 Expo 项目中安装

`v3.8.3-patch.10.3` 及之后版本支持 Expo。由于该包桥接了原生模块,因此需要使用 development build(custom dev client),不支持 Expo Go。

```sh
# 安装 openim sdk
npm install @openim/rn-client-sdk

# 生成原生工程并运行
npx expo prebuild
npx expo run:android
npx expo run:ios

# 可选:安装 Expo 开发客户端
npx expo install expo-dev-client
```

### 2. 初始化 SDK
Expand All @@ -34,7 +61,6 @@ import RNFS from 'react-native-fs';
RNFS.mkdir(RNFS.DocumentDirectoryPath + '/tmp');

OpenIMSDK.initSDK({
platformID: 2, // 1: ios, 2: android
apiAddr: 'http://your-server-ip:10002',
wsAddr: 'ws://your-server-ip:10001',
dataDir: RNFS.DocumentDirectoryPath + '/tmp',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ OIMMessageInfo *message = [OIMMessageInfo createFaceMessageWithIndex:0 data:@""]
```ts showLineNumbers
IMSDK.createFaceMessage({
index: number;
dataStr: string;
data: string;
}, operationID?: string): Promise<WsResponse<MessageItem>>
```

Expand All @@ -149,7 +149,7 @@ IMSDK.createFaceMessage({
| Parameter Name | Parameter Type | Required | Description |
| -------- | -------- | -------- | ---- |
| index | number | Yes | Index |
| dataStr | string | Yes | Content |
| data | string | Yes | Content |

### Return Result

Expand All @@ -174,7 +174,7 @@ const IMSDK = getSDK();

IMSDK.createFaceMessage({
index: 0,
dataStr: 'https://xxx/xxx/xx.png',
data: 'https://xxx/xxx/xx.png',
})
.then(({ data }) => {
// Call successful
Expand Down Expand Up @@ -240,7 +240,7 @@ IMSDK.asyncApi('createFaceMessage', IMSDK.uuid(), {
```ts showLineNumbers
OpenIMSDK.createFaceMessage({
index: number;
dataStr: string;
data: string;
}, operationID?: string): Promise<MessageItem>
```

Expand All @@ -249,7 +249,7 @@ OpenIMSDK.createFaceMessage({
| Parameter Name | Parameter Type | Required | Description |
| ----------- | -------- | -------- | ------------------------------------------------------- |
| index | number | Yes | Index |
| dataStr | string | Yes | Content |
| data | string | Yes | Content |
| operationID | string | No | Operation ID, used to pinpoint issues, keep unique, prefer time+random |

### Return Result
Expand All @@ -267,7 +267,7 @@ import OpenIMSDK from "@openim/rn-client-sdk";

OpenIMSDK.createFaceMessage({
index: 0,
dataStr: 'https://xxx/xxx/xx.png',
data: 'https://xxx/xxx/xx.png',
})
.then((data) => {
// Call successful
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,10 @@ IMSDK.asyncApi('getAdvancedHistoryMessageList', IMSDK.uuid(), {

```ts showLineNumbers
OpenIMSDK.getAdvancedHistoryMessageList({
lastMinSeq: number;
count: number;
startClientMsgID: string;
conversationID: string;
startClientMsgID: string;
count: number;
viewType: ViewType
}, operationID?: string): Promise<AdvancedGetMessageResult>
```

Expand All @@ -302,13 +302,13 @@ OpenIMSDK.getAdvancedHistoryMessageList({
### Code Example

```js showLineNumbers
import OpenIMSDK from "@openim/rn-client-sdk";
import OpenIMSDK, { ViewType } from "@openim/rn-client-sdk";

OpenIMSDK.getAdvancedHistoryMessageList({
lastMinSeq: 0,
count: 20,
startClientMsgID: '',
conversationID: 'conversationID',
startClientMsgID: '',
count: 20,
viewType: ViewType.History,
})
.then((data) => {
// Call successful
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ We strongly recommend running our framework-specific [DEMO](https://github.com/o

## Important Notes ❗️

- **Android 16KB page-size support:** Starting from `v3.8.3-patch.12`, the Android core dependency is upgraded to `io.openim:core-sdk:3.8.3-patch12+1`, adding compatibility for devices using 16KB memory page size.

- **Expo support:** Expo development build (custom dev client) is supported from `v3.8.3-patch.10.3` and later.

- Starting from version `v3.8.3-patch.10`, the package name changed from `open-im-sdk-rn` to `@openim/rn-client-sdk`.

- Starting from version `v3.8.3-patch.10.2`, the `operationID` parameter is optional (if not provided, the SDK will auto-generate one). In earlier versions, this parameter was required and had to be passed explicitly. (operationID is used for backend log queries)
Expand All @@ -21,8 +25,31 @@ We strongly recommend running our framework-specific [DEMO](https://github.com/o

### 1. Add Dependency

#### Install with React Native CLI

```sh
yarn add @openim/rn-client-sdk
# install the SDK
npm install @openim/rn-client-sdk

# iOS native dependencies
cd ios && pod install && cd ..
```

#### Install with Expo

`v3.8.3-patch.10.3` and later support Expo. Because this package bridges native modules, you must use a development build (custom dev client); Expo Go is not supported.

```sh
# install the SDK
npm install @openim/rn-client-sdk

# generate native projects and run
npx expo prebuild
npx expo run:android
npx expo run:ios

# optional: Expo Go–like dev client experience
npx expo install expo-dev-client
```

### 2. Initialize SDK
Expand All @@ -34,7 +61,6 @@ import RNFS from 'react-native-fs';
RNFS.mkdir(RNFS.DocumentDirectoryPath + '/tmp');

OpenIMSDK.initSDK({
platformID: 2, // 1: iOS, 2: Android
apiAddr: 'http://your-server-ip:10002',
wsAddr: 'ws://your-server-ip:10001',
dataDir: RNFS.DocumentDirectoryPath + '/tmp',
Expand Down
Loading