Other chat features

Report User/Group Messages#

This feature is used to do report the user/group messages by selecting the message or user/group profile. If the user/group is reported by person to admin, the user's last 5 conversations or by selecting along with the selected message and previous 4 messages will be sent to the admin panel based on that chats availability. By using the below method person can achieve the User/Group report messages.

Mirrorfly.reportUserOrMessages(jid, type, messageId).
then((bool? value) {
//report success
}).catchError((onError) {
//report failed
});

Note : In this method messageId is optional argument. If person selected a message to report use this param other wise ignore the param.

ArgumentTypeDescription
jidstringReport User Jid who needs to be reported
typestringUser chat type either chat or groupchat
messageIdstringSelected Message ID

Handling Banned User/Group#

This feature is used to get the users/groups admin blocked status. So that you can check the user/group available status and communicate with them. If user/group blocked by admin then you will get notify the alert message.

Get Own user Admin Block Status#

This method is used to get the live status of own user profile blocked/unblocked by Admin status, so that you will be navigated to show stopper screen if profile blocked by admin.

Mirrorfly.onAdminBlockedUser.listen(result) {
var data = json.decode(result.toString());
var jid = data["jid"];
var status = data["status"];
}

Get Other user/group Admin Block Status#

This method is used to get the live status of other user/group profile blocked/unblocked by Admin status, so that you will be notified the profile status.

Mirrorfly.onAdminBlockedOtherUser.listen(result) {
var data = json.decode(result.toString());
var jid = data["jid"];
var type = data["type"];
var status = data["status"];
}

Send typing status#

You can able to send the typing/gone status to the users, so that they can aware of whether user is typing the message or not. if you want send the typing status for a user, you can utilise the below method.

ArgumentTypeDescription
toJidStringjid of the chat user
chatTypeStringchat type either chat or groupchat

While user starts typing the message in the input box of the chat window, call the below method to send the composing status, so that they can show a typing message in the header/recent chat.

Mirrorfly.sendTypingStatus(toJid, chatType);

Once user stopped/finished typing the message in the input box of the chat window, call the below method to send the gone status, so that they can hide a typing message in the header/recent chat.

Mirrorfly.sendTypingGoneStatus(toJid, chatType);

Observe the typing status#

To observe the typing status changes, you can use the below method to setup listener for the typing events.

ArgumentType
singleOrgroupJidString
userJidString
statusString
Mirrorfly.setTypingStatus.listen(result) {
var data = json.decode(event.toString());
var singleOrgroupJid = data["singleOrgroupJid"];
var userJid = data["userJid"];
var typingStatus = data["status"];
}
note

composing means user is typing the message. Gone means user stopped the typing

Mute user/Group#

If you want to mute the notifications for the chat of a user or a group, you can utilise the below method.

Mirrorfly.updateChatMuteStatus(jid, muteStatus);
ArgumentTypeDescription
jidStringjid of the chat user/ group
muteStatusbooleantrue, if you want to mute notifications for the chat

Get Last seen time of a user#

if you want to get the last seen time for the chat user, you can utilise the below method.

Mirrorfly.getUserLastSeenTime(jid).then((String? value) {
});
ArgumentTypeDescription
JIDStringjid of the chat user

Check hide last seen status#

To check whether last seen status is available to friends or not, call the below method.

Mirrorfly.isHideLastSeenEnabled().then((bool? value) {
});

Get User/Group profile details#

if you want to get the profile details for the chat user, you can utilise the below method.

Mirrorfly.getProfileDetails(jid, fetchFromServer).then((value) {
var data = Profile.fromJson(json.decode(value.toString()));
});
ArgumentTypeDescription
jidStringjid of the user
fetchFromServerboolif true fetches data from the server else fetches data from local database

Get Recent Chat#

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

var value = await Mirrorfly.getRecentChatOf(jid);
var data = RecentChatData.fromJson(json.decode(value));

Refer this doc to know more about RecentChat Class

ArgumentsTypeDescription
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().then((value) {
var data = recentChatFromJson(value);
}).catchError((error) {
// Error handling
});

Get Recent Chat list of user by Pagination#

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

Mirrorfly.getRecentChatListHistory(firstSet: true, limit: 20).then((value){
if(value != null){
var data = recentChatFromJson(value.toString());
}
});
ArgumentsTypeDescription
firstSetboolset true to get initial recent chat list otherwise get next set of data
limitintThe maximum number of chat items to retrieve is specified by limit with a default value of 15 if not provided.

Get Recent Chat list with archived chats#

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

Mirrorfly.getRecentChatListIncludingArchived().then((value) {
var js = json.decode(value);
var recentChatListWithArchived = List<RecentChatData>.from(js.map((x) => RecentChatData.fromJson(x)));
});

Delete a Recent Chat#

To delete a recent chat of a user or a group call the method.

Mirrorfly.deleteRecentChat(jid);

We can delete a archived recent chat using this method too.

ArgumentsTypeDescription
jidStringjid of the user/group
caution

Deleting a recent chat will delete the all the conversation for that user/group including favorite messages.

Pin a Recent Chat#

To pin a recent chat which makes a particular recent chat to appear at the top of the recent chat list.

Mirrorfly.updateRecentChatPinStatus(jid, pinStatus);
ArgumentsTypeDescription
jidStringjid of the user/group
pinStatusbooleanif true chat will be pinned else the chat will be unpinned

Recent Chat Pinned Count#

To get the pinned count on recent chat list call the below method.

Mirrorfly.recentChatPinnedCount().then((int? value) {
});

Clear chat messages#

Clear chat messages is a feature which allows users to delete the chat messages to reduce the storage usage. if you want to clear the messages for the entire chat, or multiple chats then you can utilise the below methods. it will also delete the downloaded media files from your local storage.

Clear chat#

You can clear the messages for any chat by using the below method. The messages will not be deleted to the receipient.

ArgumentTypeDescription
jidStringjid of the chat user
chatTypeStringchat for single chat, groupchat for group chat
clearExceptStarredboolif true, delete all the messages except the favourite messages
Mirrorfly.clearChat(jid, chatType, clearExceptStarred).then((value) {
});

Delete mulitple conversation#

You can delete the messages of multiple chats including group,brodcast by using the below method.

ArgumentTypeDescription
jidlistList<String>List of chat jid whose conversations to be deleted
Mirrorfly.deleteRecentChats(jidlist).then((bool? value) {
});

Delete all conversation#

You can delete the messages of all chats including group,brodcast by using the below method.

Mirrorfly.clearAllConversation().then((bool? value) {
});

Mark a conversation as read#

By marking a converstaion as read the unread count will be reset and it is considered the message inside the conversation were read by you.

Mirrorfly.markConversationAsRead(jidlist);
ArgumentsTypeDescription
jidlistList<String>List of user/group jid

Mark a conversation as unread#

By marking a converstaion as unread it is considered the message inside the conversation were in unread state.

Mirrorfly.markConversationAsUnread(jidlist);
ArgumentsTypeDescription
jidlistList<String>List of user/group jid
info

The read/unread flag is available as a property in the name of isConversationUnRead in the RecentChat for a user.

Archive/Unarchive Settings#

Archive Chats Permanent status can set by enabling/disabling the option.

Mirrorfly.enableDisableArchivedSettings(enable).then((bool? value) {
});
ArgumentTypeDescription
enableBooleantrue to archive the recent chat false to unarchive the recent chat

Archive Settings Status#

Get Archive Settings Status to keep the archived chats permanent.

Mirrorfly.isArchivedSettingsEnabled().then((bool? value) {
});
info

The archived settings status will be returned either True or False

Archive/Unarchive a recent chat conversation#

Archive:#

Archiving a chat conversation makes the chat not appear in recent chat list, mostly used on chats which are inactive for a long time.

UnArchive:#

Unarchiving a archived recent chat conversation makes the chat conversation appear in recent chat list again.

Mirrorfly.updateArchiveUnArchiveChat(jid, isArchived).then((bool? value) {
});
ArgumentDescriptionType
jidStringjid of the user/group to Archive/UnArchive
isArchivedBooleantrue to archive the recent chat false to unarchive the recent chat

Get List of archived recent chat conversation#

An archived chat won't be listed in recent chat list. To get the list of archived chats call the below method.

Mirrorfly.getArchivedChatList().then((value) {
var data = recentChatFromJson(value);
});

Search Chat Conversation#

To find a message or similar messages that matches a search term within a chat conversation between two or in a group or among all conversations call the method below.

await Mirrorfly.searchConversation(searchKey).then((value) {
var result = chatMessageModelFromJson(value);
});
ArgumentTypeDescriptionType
searchKeyStringtext characters for which search has to happen
jidForSearchStringUnique identifier of a contact/Group (can be null for global search)
globalSearchboolif true then search won't be restricted by jid and search operation executes on every conversation (default value true)

Forward Messages#

Forwarding feature helps the app users to share the single/multiple messages to one or more users.

Forward messages to multiple users#

if you want to forward the messages to the multiple users, you can utilise the below method.

ArgumentTypeDescription
messageIdsList<String>list of message id's
userListList<String>jid list of the chat users
Mirrorfly.forwardMessagesToMultipleUsers(messageIds, userList).then((value) {
});

Save unsent message#

To save a message which is not sent yet but typed can be saved for each user/group can be done by calling the below method.

Mirrorfly.saveUnsentMessage(jid,message);
ArgumentTypeDescription
jidStringJid of the user/group
messageStringText message content

Get unsent message of a user/group#

To get the saved unsent message of a user/group call the below method.

Mirrorfly.getUnsentMessageOfAJid(jid).then((String? value) {
});
ArgumentTypeDescription
jidStringJid of the user/group

Export chat conversation#

To export a chat conversation of a user, or a group call the below method.

Mirrorfly.exportChatConversationToEmail(JID).then((value) {
});
ArgumentTypeDescription
JIDStringjid of the user/group

Send Feedback/Contact Us Info#

To send feedback information from the user, you can call the below method.

Mirrorfly.sendContactUsInfo(title, description)).then((bool? value){
});
ArgumentTypeDescription
titleStringtitle for the feedback
descriptionStringdetailed info about the feedback

Delete Account#

To delete the chat account call the below method.

Mirrorfly.deleteAccount(reason, FEEDBACK).then((value) {
}).catchError((error) {
// Error handling
});
ArgumentTypeDescription
reasonStringreason for the account deletion
feedbackStringdetailed feedback about the account deletion
info

Deleting chat account will remove all informations(messages, groups and contacts) related to this chat account

Logout of Chat SDK#

To logout of the chat SDK call the below method.

Mirrorfly.logoutOfChatSDK().then((value) {
}).catchError((er){
});
caution

Once you are logged out you cannot establish a connection with chat server unless you login again.

info

Logout function will not clear messages and groups data in Chat database.

info

Sdk is having a built-in functions to prepare the JID, Group JID.