Skip to content

Instantly share code, notes, and snippets.

@wajahatkarim3
Created January 31, 2021 19:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wajahatkarim3/db51a8588a6e9f089c2794e5009ec1ae to your computer and use it in GitHub Desktop.
Save wajahatkarim3/db51a8588a6e9f089c2794e5009ec1ae to your computer and use it in GitHub Desktop.
Loading conversations list
fun setLoggedInUI() {
if (CometChat.getLoggedInUser() != null) {
var conversationsRequest = ConversationsRequest.ConversationsRequestBuilder()
.setLimit(50)
.setConversationType(CometChatConstants.CONVERSATION_TYPE_USER)
.build()
conversationsRequest.fetchNext(object :
CometChat.CallbackListener<List<Conversation>>() {
override fun onSuccess(conversations: List<Conversation>?) {
bi.cometchatConversationList.setConversationList(conversations)
}
override fun onError(ex: CometChatException?) {
Snackbar.make(
bi.root,
ex?.localizedMessage ?: "Couldn't load conversations list",
Snackbar.LENGTH_SHORT
).show()
}
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment