数据更新
除了 Global IM UIKit 提供的 Hooks 函数外,Global IM UIKit 还提供了一些数据更新的方法,以便于业务层在某些场景下,能够及时更新 Global IM UIKit 中的数据缓存。
以下示例中代码提到的
kitApp
均为 Global IM UIKit 初始化后获取到的RCKitApplication
类实例。
更新用户信息
updateUserProfile
方法用于更新用户信息,如用户昵称、头像等。
kitApp.updateUserProfile({
userId: 'userId',
name: '', // 用户名称
portraitUri: '', // 用户头像
});
更新群组信息
updateGroupProfile
方法用于更新群组信息,如群组名称、头像等, 不包含群成员信息。
kitApp.updateGroupProfile({
groupId: 'groupId',
name: '', // 群组名称
portraitUri: '', // 群组头像
memberCount: 0, // 成员数量
});
更新用户在线状态
updateUserOnlineStatus
方法用于更新用户在线状 态。
// true 为在线,false 为离线
kitApp.updateUserOnlineStatus('userId', true);