diff --git a/docs/sdks/api/message/createFaceMessage.md b/docs/sdks/api/message/createFaceMessage.md index b2ad646c4e..f94126d320 100644 --- a/docs/sdks/api/message/createFaceMessage.md +++ b/docs/sdks/api/message/createFaceMessage.md @@ -140,7 +140,7 @@ OIMMessageInfo *message = [OIMMessageInfo createFaceMessageWithIndex:0 data:@""] ```ts showLineNumbers IMSDK.createFaceMessage({ index: number; - dataStr: string; + data: string; }, operationID?: string): Promise> ``` @@ -149,7 +149,7 @@ IMSDK.createFaceMessage({ | 参数名称 | 参数类型 | 是否必填 | 描述 | | -------- | -------- | -------- | ---- | | index | number | 是 | 索引 | -| dataStr | string | 是 | 内容 | +| data | string | 是 | 内容 | ### 返回结果 @@ -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 }) => { // 调用成功 @@ -240,7 +240,7 @@ IMSDK.asyncApi('createFaceMessage', IMSDK.uuid(), { ```ts showLineNumbers OpenIMSDK.createFaceMessage({ index: number; - dataStr: string; + data: string; }, operationID?: string): Promise ``` @@ -249,7 +249,7 @@ OpenIMSDK.createFaceMessage({ | 参数名称 | 参数类型 | 是否必填 | 描述 | | ----------- | -------- | -------- | ------------------------------------------------------- | | index | number | 是 | 索引 | -| dataStr | string | 是 | 内容 | +| data | string | 是 | 内容 | | operationID | string | 否 | 操作 ID,用于定位问题,保持唯一,建议用当前时间和随机数 | ### 返回结果 @@ -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) => { // 调用成功 diff --git a/docs/sdks/api/message/getAdvancedHistoryMessageList.md b/docs/sdks/api/message/getAdvancedHistoryMessageList.md index 375f259e23..4494bf8c1e 100644 --- a/docs/sdks/api/message/getAdvancedHistoryMessageList.md +++ b/docs/sdks/api/message/getAdvancedHistoryMessageList.md @@ -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 ``` @@ -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) => { // 调用成功 diff --git a/docs/sdks/quickstart/reactNative.md b/docs/sdks/quickstart/reactNative.md index b42b152ff3..2a8c39e56e 100644 --- a/docs/sdks/quickstart/reactNative.md +++ b/docs/sdks/quickstart/reactNative.md @@ -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 用于后端日志查询) @@ -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 @@ -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', diff --git a/i18n/en/docusaurus-plugin-content-docs-sdks/current/api/message/createFaceMessage.md b/i18n/en/docusaurus-plugin-content-docs-sdks/current/api/message/createFaceMessage.md index c1f0493520..e79492a8f0 100644 --- a/i18n/en/docusaurus-plugin-content-docs-sdks/current/api/message/createFaceMessage.md +++ b/i18n/en/docusaurus-plugin-content-docs-sdks/current/api/message/createFaceMessage.md @@ -140,7 +140,7 @@ OIMMessageInfo *message = [OIMMessageInfo createFaceMessageWithIndex:0 data:@""] ```ts showLineNumbers IMSDK.createFaceMessage({ index: number; - dataStr: string; + data: string; }, operationID?: string): Promise> ``` @@ -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 @@ -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 @@ -240,7 +240,7 @@ IMSDK.asyncApi('createFaceMessage', IMSDK.uuid(), { ```ts showLineNumbers OpenIMSDK.createFaceMessage({ index: number; - dataStr: string; + data: string; }, operationID?: string): Promise ``` @@ -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 @@ -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 diff --git a/i18n/en/docusaurus-plugin-content-docs-sdks/current/api/message/getAdvancedHistoryMessageList.md b/i18n/en/docusaurus-plugin-content-docs-sdks/current/api/message/getAdvancedHistoryMessageList.md index af462c0150..80f70d21e1 100644 --- a/i18n/en/docusaurus-plugin-content-docs-sdks/current/api/message/getAdvancedHistoryMessageList.md +++ b/i18n/en/docusaurus-plugin-content-docs-sdks/current/api/message/getAdvancedHistoryMessageList.md @@ -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 ``` @@ -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 diff --git a/i18n/en/docusaurus-plugin-content-docs-sdks/current/quickstart/reactNative.md b/i18n/en/docusaurus-plugin-content-docs-sdks/current/quickstart/reactNative.md index 5553cae0c8..605c5ce99b 100644 --- a/i18n/en/docusaurus-plugin-content-docs-sdks/current/quickstart/reactNative.md +++ b/i18n/en/docusaurus-plugin-content-docs-sdks/current/quickstart/reactNative.md @@ -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) @@ -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 @@ -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',