-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
1,898 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,328 @@ | ||
--- | ||
sidebar_position: 3 | ||
toc_min_heading_level: 2 | ||
toc_max_heading_level: 2 | ||
--- | ||
|
||
# setSelfInfoEx | ||
|
||
## 功能介绍 | ||
|
||
:::info 说明 | ||
|
||
修改当前登录用户的个人信息。(已弃用,推荐使用setSelfInfoEx) | ||
|
||
::: | ||
|
||
:::caution 注意 | ||
|
||
|
||
|
||
|
||
**相关回调**: | ||
[onSelfInfoUpdated](docs/sdks/callback/onSelfUserInfoUpdate.mdx) | ||
|
||
|
||
::: | ||
|
||
<Tabs | ||
groupId="sdks-language" | ||
values={[ | ||
{ label: 'iOS', value: 'iOS', }, | ||
{ label: 'Android', value: 'Android', }, | ||
{ label: 'Flutter', value: 'Flutter', }, | ||
{ label: 'uni-app', value: 'uni-app', }, | ||
{ label: 'Browser/Electron/MiniProgram', value: 'Web', }, | ||
{ label: 'React-Native', value: 'React-Native', }, | ||
{ label: 'Unity', value: 'Unity', }, | ||
] | ||
}> | ||
|
||
<TabItem value="Flutter"> | ||
|
||
### 函数原型 | ||
|
||
```dart showLineNumbers | ||
Future<String?> setSelfInfo({ | ||
String? nickname, | ||
String? faceURL, | ||
int? appMangerLevel, | ||
String? ex, | ||
String? operationID, | ||
}) | ||
``` | ||
|
||
### 输入参数 | ||
|
||
| 参数名称 | 参数类型 | 是否必填 | 描述 | | ||
| -------------- | -------- | -------- | -------------- | | ||
| nickname | String? | 否 | 用户昵称 | | ||
| faceURL | String? | 否 | 用户头像 | | ||
| appMangerLevel | int? | 否 | 内部字段,可忽略 | | ||
| ex | String? | 否 | 扩展信息 | | ||
|
||
### 返回结果 | ||
|
||
| 参数名称 | 参数类型 | 描述 | | ||
| -------- | -------- | -------------------- | | ||
| ~ | ~ | 无异常抛出则修改成功 | | ||
|
||
### 代码示例 | ||
|
||
```dart showLineNumbers | ||
await OpenIM.iMManager.userManager.setSelfInfo( | ||
nickname: 'lucy', | ||
); | ||
// todo | ||
``` | ||
|
||
</TabItem> | ||
|
||
<TabItem value="iOS"> | ||
|
||
### 函数原型 | ||
|
||
```swift showLineNumbers | ||
|
||
- (void)setSelfInfo:(OIMUserInfo *)userInfo | ||
onSuccess:(OIMSuccessCallback)onSuccess | ||
onFailure:(OIMFailureCallback)onFailure; | ||
|
||
``` | ||
|
||
### 输入参数 | ||
|
||
| 参数名称 | 参数类型 | 是否必填 | 描述 | | ||
| -------- | ------------------------------------------------ | -------- | ------------ | | ||
| userInfo | [OIMUserInfo](docs/sdks/class/user/userInfo.mdx) | 是 | 用户相关信息 | | ||
|
||
### 返回结果 | ||
|
||
| 参数名称 | 参数类型 | 描述 | | ||
| --------- | ------------------------------------------------------ | -------- | | ||
| onSuccess | OIMSuccessCallback | 成功返回 | | ||
| onFailure | OIMFailureCallback | 失败返回 | | ||
|
||
### 代码示例 | ||
|
||
```swift showLineNumbers | ||
|
||
OIMUserInfo *info = [OIMUserInfo new]; | ||
info.nickname = @""; | ||
info.faceURL = @""; | ||
|
||
[OIMManager.manager setSelfInfo:info | ||
onSuccess:^(NSString * _Nullable data) { | ||
} onFailure:^(NSInteger code, NSString * _Nullable msg) { | ||
}]; | ||
|
||
``` | ||
|
||
</TabItem> | ||
|
||
<TabItem value="Android"> | ||
|
||
### 函数原型 | ||
|
||
```java showLineNumbers | ||
|
||
public void setSelfInfo(OnBase<String> callBack, String nickname, String faceURL, int appMangerLevel, String ex) | ||
|
||
``` | ||
|
||
### 输入参数 | ||
|
||
| 参数名称 | 参数类型 | 是否必填 | 描述 | | ||
| -------------- | --------------------------------------- | -------- | ------------------------------ | | ||
| callBack | [OnBase](docs/sdks/callback/onBase.mdx) | 是 | 回调接口 | | ||
| nickname | String | 是 | 名字 | | ||
| faceURL | String | 是 | 头像 | | ||
| gender | int | 是 | 性别 1:男 2:女 | | ||
| appMangerLevel | int | 是 | 内部字段,可忽略 | | ||
| ex | String | 否 | 扩展字段 | | ||
|
||
### 返回结果 | ||
|
||
### 代码示例 | ||
|
||
```java showLineNumbers | ||
|
||
OpenIMClient.getInstance().userInfoManager.setSelfInfo(new OnBase<String>(){…},...); | ||
|
||
``` | ||
|
||
</TabItem> | ||
|
||
<TabItem value="Web"> | ||
|
||
### 函数原型 | ||
|
||
```ts showLineNumbers | ||
IMSDK.setSelfInfo(userInfo: Partial<Omit<SelfUserInfo, 'userID'>>, operationID?: string): Promise<WsResponse> | ||
``` | ||
|
||
### 输入参数 | ||
|
||
| 参数名称 | 参数类型 | 是否必填 | 描述 | | ||
| -------- | -------------------------------------------------------------------------- | -------- | -------- | | ||
| userInfo | Partial<Omit<[SelfUserInfo](docs/sdks/class/user/userInfo.mdx), 'userID'>> | 是 | 个人信息 | | ||
|
||
### 返回结果 | ||
|
||
| 参数名称 | 参数类型 | 描述 | | ||
| --------------- | ---------------------------------------------------- | ------------ | | ||
| Promise.then() | Promise<[WsResponse](docs/sdks/class/response.mdx)\> | 调用成功回调 | | ||
| Promise.catch() | Promise<[WsResponse](docs/sdks/class/response.mdx)\> | 调用失败回调 | | ||
|
||
### 代码示例 | ||
|
||
```js showLineNumbers | ||
import { getSDK } from 'open-im-sdk-wasm'; | ||
const IMSDK = getSDK(); | ||
|
||
// use in electron with ffi | ||
// import { getWithRenderProcess } from '@openim/electron-client-sdk/lib/render'; | ||
// const { instance: IMSDK } = getWithRenderProcess(); | ||
|
||
// use in mini program | ||
// import { OpenIMSDK } from 'open-im-sdk'; | ||
// const IMSDK = new OpenIMSDK(); | ||
|
||
const userInfo = { | ||
nickname: '', // 要修改的昵称,选填 | ||
faceURL: '', // 要修改的头像,选填 | ||
ex: '', // 要修改的扩展字段内容,选填 | ||
}; | ||
IMSDK.setSelfInfo(userInfo) | ||
.then(() => { | ||
// 调用成功 | ||
}) | ||
.catch(({ errCode, errMsg }) => { | ||
// 调用失败 | ||
}); | ||
``` | ||
|
||
</TabItem> | ||
|
||
<TabItem value="uni-app"> | ||
|
||
### 函数原型 | ||
|
||
```ts showLineNumbers | ||
IMSDK.asyncApi('setSelfInfo', operationID: string, userInfo: Partial<Omit<SelfUserInfo, 'userID'>>): Promise<void> | ||
``` | ||
|
||
### 输入参数 | ||
|
||
| 参数名称 | 参数类型 | 是否必填 | 描述 | | ||
| ----------- | -------------------------------------------------------------------------- | -------- | ------------------------------------------------------- | | ||
| operationID | string | 是 | 操作 ID,用于定位问题,保持唯一,建议用当前时间和随机数 | | ||
| userInfo | Partial<Omit<[SelfUserInfo](docs/sdks/class/user/userInfo.mdx), 'userID'>> | 是 | 个人信息 | | ||
|
||
### 返回结果 | ||
|
||
> 通过`openim-uniapp-polyfill`包将函数 Promise 化,调用时需要使用`then`和`catch`判断并处理成功和失败回调。 | ||
| 参数名称 | 参数类型 | 描述 | | ||
| --------------- | ------------------------------------------------------- | ------------ | | ||
| Promise.then() | Promise<void\> | 调用成功回调 | | ||
| Promise.catch() | Promise<[CatchResponse](docs/sdks/class/response.mdx)\> | 调用失败回调 | | ||
|
||
### 代码示例 | ||
|
||
```js showLineNumbers | ||
import IMSDK from 'openim-uniapp-polyfill'; | ||
|
||
const userInfo = { | ||
nickname: '', // 要修改的昵称,选填 | ||
faceURL: '', // 要修改的头像,选填 | ||
ex: '', // 要修改的扩展字段内容,选填 | ||
}; | ||
IMSDK.asyncApi('setSelfInfo', IMSDK.uuid(), userInfo) | ||
.then(() => { | ||
// 调用成功 | ||
}) | ||
.catch(({ errCode, errMsg }) => { | ||
// 调用失败 | ||
}); | ||
``` | ||
|
||
</TabItem> | ||
<TabItem value="React-Native"> | ||
|
||
### 函数原型 | ||
|
||
```ts showLineNumbers | ||
OpenIMSDKRN.setSelfInfo( | ||
userInfo: Partial<Omit<SelfUserInfo, 'userID'>>, | ||
operationID: string | ||
): Promise<void> | ||
``` | ||
|
||
### 输入参数 | ||
|
||
| 参数名称 | 参数类型 | 是否必填 | 描述 | | ||
| ----------- | -------------------------------------------------------------------------- | -------- | ------------------------------------------------------- | | ||
| userInfo | Partial<Omit<[SelfUserInfo](docs/sdks/class/user/userInfo.mdx), 'userID'>> | 是 | 个人信息 | | ||
| operationID | string | 是 | 操作 ID,用于定位问题,保持唯一,建议用当前时间和随机数 | | ||
|
||
### 返回结果 | ||
|
||
| 参数名称 | 参数类型 | 描述 | | ||
| --------------- | ------------------------------------------------------- | ------------ | | ||
| Promise.then() | Promise<void\> | 调用成功回调 | | ||
| Promise.catch() | Promise<[CatchResponse](docs/sdks/class/response.mdx)\> | 调用失败回调 | | ||
|
||
### 代码示例 | ||
|
||
```js showLineNumbers | ||
import OpenIMSDKRN from "open-im-sdk-rn"; | ||
|
||
const userInfo = { | ||
nickname: '', // 要修改的昵称,选填 | ||
faceURL: '', // 要修改的头像,选填 | ||
ex: '', // 要修改的扩展字段内容,选填 | ||
}; | ||
|
||
OpenIMSDKRN.setSelfInfo(userInfo, 'operationID'); | ||
.then(() => { | ||
// 调用成功 | ||
}) | ||
.catch(({ errCode, errMsg }) => { | ||
// 调用失败 | ||
}); | ||
``` | ||
|
||
</TabItem> | ||
|
||
<TabItem value="Unity"> | ||
|
||
### 函数原型 | ||
|
||
```C# showLineNumbers | ||
|
||
public static void SetSelfInfo(OnSucOrError cb, UserInfo userInfo); | ||
|
||
``` | ||
|
||
### 输入参数 | ||
|
||
| 参数名称 | 参数类型 | 是否必填 | 描述 | | ||
| -------------- | --------------------------------------- | -------- | ------------------------------ | | ||
| cb | [OnSucOrError](docs/sdks/callback/OnSucOrError.mdx) | 是 | 回调接口 | | ||
| userInfo | [UserInfo](docs/sdks/class/user/userInfo.mdx) | 是 | 名字 | | ||
|
||
### 返回结果 | ||
|
||
### 代码示例 | ||
|
||
```C# showLineNumbers | ||
|
||
IMSDK.SetSelfInfo((suc,errCode,errMsg)=>{ | ||
|
||
},userInfo); | ||
|
||
``` | ||
|
||
</TabItem> | ||
</Tabs> |
Oops, something went wrong.