Home Feed
The Home Feed is a vital component of many applications, providing users with a centralized hub to discover and engage with various content, including chatrooms, discussions, and other interactive features. In the context of the React Native SDK, the Home Feed serves as a customizable and dynamic feed that can be tailored to suit your application's needs.
This guide provide step-by-step instructions, code snippets, and best practices for integrating the Home Feed and fetching community chatrooms in your React Native app.
Let's dive into the world of Home Feed integration with the React Native SDK and unlock the potential for vibrant chatroom communities within your application.
Steps to fetch explore tab counts
- To fetch home feed in Group Chat, use the method
getExploreTabCount()
provided by the client you initialised. - Process the response as per your requirement.
const response = await lmChatClient?.getExploreTabCount();
if (response.success) {
// your function to process the response data
processResponse(response);
} else {
// your function to process the response data
processResponse(response);
}
Steps to fetch Group Chats
- Create a
SyncChatroomRequest
object usingSyncChatroomRequest.builder
class by passing all the required parameters. - Call
syncChatroom()
function using the instance oflmChatClient
. - Process the response
LMResponse<SyncChatroomResponse>
as per your requirement.
const syncChatroomRequest = SyncChatroomRequest.builder()
.setPage(1)
.setPageSize(50)
.setChatroomTypes([0, 7])
.setMaxTimestamp(Date.now())
.setMinTimestamp(0)
.build();
const response = await lmChatClient?.syncChatroom(syncChatroomRequest);
if (response.success) {
// your function to process the response data
processResponse(response);
} else {
// your function to process error message
processError(response);
}
Sync Chatroom Request
Variable | Type | Description | Optional |
---|---|---|---|
page | number | Page number | |
pageSize | number | Page size for paginated response | |
chatroomTypes | number[] | Chatroom types 0 and 7 for for normcal chatrooms and announcement room | |
maxTimestamp | number | Maximum timestamp | |
minTimestamp | number | Minimum timestamp |
Sync Chatroom Response
Variable | Type | Description | Optional |
---|---|---|---|
userMeta | Member | User data | |
conversationMeta | Conversation | Conversation data | |
communityMeta | Community | Community data | |
chatroomsData | Chatroom[] | List of chatrooms | |
convAttachmentsMeta | Attachment[] | List of attachments | |
convPollsMeta | Poll[] | List of Polls |