User profile pic not displaying in the recent chat list screen

@amitysupport In my recent chat list screen ,the user profile pic is not displaying .After analyse the code in recent chat list screen we are using "AmityChannel "model to display the list of recent chats but in AmityChannel the avatar is always null even-though the user having profile pic its getting null . Avatar attribute is not updating in AmityChannel.Could you please confirm the same.

Hi @IMKalpataru for user profile, please get the avatar from user’s avatar instead of channel’s avatar. Please see code example in this user section User - Amity Docs

Hi @amitysupport ,here is the code for getting user right
fun getUser(userRepository: AmityUserRepository) {
userRepository.getUser(userId = “brian3291”)
.doOnNext { user: AmityUser →
val displayname = user.getDisplayName()
}
.subscribe()
}

Yes, that’s correct.

Hi @amitysupport in the above code, we need to pass userId to get userdetails but in AmityChannel we doesn’t have userId attribute . Instead of userId AmityChannel having displayname . Can we proceed with searchUserByDisplayName(“displayname”) function

Hello, to get users in a channel, please use follow this sample:

channel.membership().getMembers().build().query().subscribe {}

Hi @amitysupport i have tried below query to get channel user’s using channel Id in chat screen. here
I am not getting any response list .Can you please guide us is that proper way to get members list.

@OptIn(ExperimentalPagingApi::class)
fun getMembers(onResult: (list: PagedList) → Unit): Completable {
val channelRepository: AmityChannelRepository = AmityChatClient.newChannelRepository()
return channelRepository.membership(channelId).getMembers()
.build()
.query()
.throttleLatest(1, TimeUnit.SECONDS, true)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.doOnNext {
onResult.invoke(it)
}
.ignoreElements()
}
}

Hi @Sangeetha can you try the code like this and let see anything response to you.

val channelRepository: AmityChannelRepository = AmityChatClient.newChannelRepository()
channelRepository.membership(“ChannelId”)
.getMembers()
.build()
.query()
.throttleLatest(1, TimeUnit.SECONDS, true)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.doOnNext {
Log.e(“pagedlist”, it.toString())
}
.ignoreElements()
.subscribe()

Hi @naphat still i am getting empty list in doOnNext . here i have to get list of user for single channel does above function will return as list .Could you please guide us

Hi @Sangeetha sorry for my late reply. I just tried different scenario and one thing I found is if the channel ID is not exist it will always return so
can you check the error log is there anything like this ?

 E/com.ekoapp.ekosdk.internal.util.RxEko: LOG_ERROR_CONSUMER: message: The exception was not handled due to missing onError handler in the subscribe() method call. Further reading: https://github.com/ReactiveX/RxJava/wiki/Error-Handling | com.amity.socialcloud.sdk.core.error.AmityException: ChannelId Not Found

Hi @naphat I am taking channelId from AmityChannel and passing that same channelId to getmembers() , so I am not getting any AmityException . Actually when I try with 5.23.0 version I can able to get list of AmityChannelMember but after upgrade the version to 5.27.1 and 5.28 I am getting empty list . Please guide us.
This is the function to get AmityChannelMember:

fun getMembers(channelID : String):Flowable<PagedList> {
return AmityChatClient.newChannelRepository().
membership(channelID).getMembers().build().query()
}
Below are the screenshots for both versions :

Hello @IMKalpataru Naphat is one of our team members, we cannot reproduce this on our end. Would you mind sending us your apikey and channelId to our support email please? support.asc@amity.co and we will do further check from there.

hi @amitysupport we have shared the apikey and channelID over mail. Please check.

1 Like