Retrieve Recent Chat

Get Recent Chat#

To get the recent chat of a user or a group.

var value = await Mirrorfly.getRecentChatOf(jid: JID);
var data = recentChatDataFromJson(value.toString());

Refer this doc to know more about RecentChat Class

ArgumentTypeDescription
JIDStringjid of the user/group
caution

Will return a null object if a user never made a conversation with that user/group.

Get Recent Chat list#

To get the recent chat list call the below method.

Mirrorfly.getRecentChatList(flyCallBack: (FlyResponse response) {
if (response.isSuccess && response.hasData) {
var recentChatList = recentChatFromJson(response.data);
//update the UI
} else {
//Fetching recent chat list failed print throwable to find the exception details.
}
});
ArgumentDescriptionType
flyCallbackFlyResponsecallback to observe the action status

Get Recent Chat list of user by Pagination#

To get the recent chat list as pagination by providing the limit.

Load Recent Chat List#

To fetch initial and next set of recent chat list of user, call the below method.

Mirrorfly.getRecentChatListHistory(firstSet: LOAD_INITIAL_DATA, limit: LIMIT, flyCallback: (FlyResponse response) {
if (response.isSuccess) {
var recentChatList = recentChatFromJson(response.data);
} else {
// Fetch Recent Chat List failed print throwable to find the exception details.
}
});
ArgumentTypeDescription
LOAD_INITIAL_DATAboolset true to load initial data ,false to load next set of Data
LIMITintNo of Recent chats will be fetched for each request default value 15
flyCallbackFlyResponsecallback to observe the action status

Get Recent Chats By TopicId#

To get all the list of TopicId related chats, send a request to the server as described below.

Load Initial Topic Based Chat List#

To fetch initial and next set of Topic based recent chat list, call the below method.

Mirrorfly.getRecentChatListHistoryByTopic(firstSet: LOAD_INITIAL_DATA, limit: LIMIT,topicId: TOPIC_ID, flyCallback: (FlyResponse response) {
if (response.isSuccess) {
var recentChatList = recentChatFromJson(response.data);
} else {
// Fetch Recent Chat List failed print throwable to find the exception details.
}
});
ArgumentTypeDescription
LOAD_INITIAL_DATAboolset true to get initial recent chat list otherwise get next set of data
TOPIC_IDStringtopic id to be used to get recent chats
LIMITintNo of Recent chats will be fetched for each request default value 15
flyCallbackFlyResponsecallback to observe the action status

Get Recent Chat list with archived chats#

To get the recent chat list including the archived chat conversation call the below method.

var value = await Mirrorfly.getRecentChatListIncludingArchived();
var recentChatListWithArchived = recentChatDataListFromJson(value.toString());

Unread count#

if you want to get the unread count of chat messages, you can utilise the below method.

int? unreadMessageCount = await Mirrorfly.getUnreadMessagesCount();