Data Update
In addition to the Hooks functions provided by Global IM UIKit, Global IM UIKit also offers several data update methods to enable the business layer to promptly update the data cache in Global IM UIKit in certain scenarios.
In the following examples, the
kitApp
mentioned in the code refers to the instance of theRCKitApplication
class obtained after initializing Global IM UIKit.
Update User Profile
The updateUserProfile
method is used to update user information, such as the user's nickname and avatar.
kitApp.updateUserProfile({
userId: 'userId',
name: '', // User name
portraitUri: '', // User avatar
});
Update Group Profile
The updateGroupProfile
method is used to update group information, such as the group name and avatar, excluding group member information.
kitApp.updateGroupProfile({
groupId: 'groupId',
name: '', // Group name
portraitUri: '', // Group avatar
memberCount: 0, // Member count
});
Update User Online Status
The updateUserOnlineStatus
method is used to update the user's online status.
// true for online, false for offline
kitApp.updateUserOnlineStatus('userId', true);
Update Group Member Information
Add Members to the Group Member List
kitApp.addGroupMembers('groupId', [
{ userId: 'user-01', nickname: '' },
{ userId: 'user-02' }
])
Remove Members from the Existing Group Member List
kitApp.removeGroupMembers('groupId', ['user-01', 'user-02']);
Refresh the Group Member List
When refreshing the list, the SDK will clear the existing group member list and replace it with the new list provided by the business layer.
kitApp.updateGroupMembers('groupId', [
{ userId: 'user-01', nickname: '' },
{ userId: 'user-02' }
]);