Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

群主创建一个群,群成员接收到信息后,拉取groupInfo,群信息不对,群名称为群聊,没有ownerID #184

Closed
dengxueru opened this issue Mar 29, 2022 · 3 comments

Comments

@dengxueru
Copy link

No description provided.

@imndx
Copy link
Contributor

imndx commented Mar 29, 2022

由于涉及到网络交互,wfc.getGroupInfo等接口是异步返回,会先返回本地的群信息,如果本地不存在该群信息的时候,会返回一个只包含groupIdNullGroupInfo对象,并从服务端去拉取该群的群信息,拉取成功之后,会通过EventType.GroupInfosUpdate进行通知,上层监听到EventType.GroupInfosUpdate之后,再次获取群信息即可。

此外,获取群信息还有另外一个方法:wfc.getGroupInfoEx。该方法通过回调返回群信息,当本地不存在该群信息的时候,会从服务端拉取,然后通过回调返回群信息。

@imndx imndx changed the title 群主创建一个群,群成员接收到信息后,拉取groupProfile,群信息不对,群名称为群聊,没有ownerID 群主创建一个群,群成员接收到信息后,拉取groupInfo,群信息不对,群名称为群聊,没有ownerID Mar 29, 2022
@imndx imndx pinned this issue Mar 29, 2022
@imndx imndx closed this as completed Apr 13, 2022
@imndx
Copy link
Contributor

imndx commented Sep 22, 2023

补充一下,针对用户信息,也有一个类似的方法:getUserInfoEx

@imndx
Copy link
Contributor

imndx commented Dec 9, 2023

一些参考代码:

// 在合适的地方添加事件监听,比如组件创建的时候
wfc.eventEmitter.on(EventType.UserInfosUpdate, this.onUserInfosUpdate);

// ....

onUserInfosUpdate(userInfos){
// 业务代码,比如更新 UI 等
}

// 组件销毁的时候,记得删除监听,否则会造成内存泄漏
wfc.eventEmitter.removeListener(EventType.UserInfosUpdate, this.onUserInfosUpdate);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants