User Module
User feature module.
Provides user related Feature, including Subscription event management, Online Status Query, User profile management, Friend management and Friend application etc.. This class Singleton, Via com.nexconn.chat.NCEngine.userModule Get unique Instance. pair external Not expose any internal dependency.
Usage Example:
// Subscribe User online status Event
val params = SubscribeEventParams(SubscribeType.ONLINE_STATUS, listOf("userId1", "userId2")).apply {
expiry = 7 * 24 * 60 * 60 // 7days validity period
}
NCEngine.user.subscribeEvent(params) { failedUserIds, error ->
if (error == null) {
// Subscribed successfully
} else {
// Subscription failed, failedUserIds Contains failed usersIDList
}
}
// Update user profile
val profileParams = UpdateUserProfileParams().apply {
name = "New Nickname"
gender = Gender.MALE
}
NCEngine.user.updateMyUserProfile(profileParams) { errorKeys, error ->
if (error == null) {
// Updated successfully
} else {
// Update failed, errorKeys Contains failed fields Key List
}
}
// Add friend
val addParams = AddFriendParams("userId").apply {
extra = "Hello, please add me friend"
}
NCEngine.user.addFriend(addParams) { resultCode, error ->
// ...
}
// Query friend List
NCEngine.user.getFriends(FriendDirection.BOTH) { friends, error ->
if (error == null && friends != null) {
friends.forEach { friend ->
println("${friend.userId}: ${friend.name}")
}
}
}Functions
accept Friend application.
Add friend.
Add user to block list.
Check if specified user is in block list.
Check friend relationship.
Create Friend application pagination query object.
Create Subscription event pagination query object.
Batch Delete friend.
Get current user's block list.
Get Friend add permission.
Get friend List.
Batch Get Friend info.
Get Current user profile.
Get Current user profile Visibility.
Query current subscription event status.
Batch Query Already Subscribe user Online Status.
Batch Get user profile.
reject Friend application.
Remove user from block list.
by Name Search Friend info.
Set Friend add permission.
Set friend info.
Subscribe to user status events.
Unsubscribe from user status events.
Update Current user profile.
Update Current user profile Visibility.