Other chat features

Get messages by pagination#

Initialization#

Create a FetchMessageListParams instance. Here, you can set the message filter to determine the message order and the starting point of the message list in the chat view.

let messageListParams = FetchMessageListParams()
messageListParams.chatId = "CHAT_ID"
messageListParams.messageId = "MESSAGE_ID"
messageListParams.messageTime = "MESSAGE_TIME"
messageListParams.exclude = "EXCLUDE"
messageListParams.limit = "LIMIT"
messageListParams.ascendingOrder = "ASCENDING_ORDER"
ArgumentTypeDescription
CHAT_IDStringJid of the user/group
MESSAGE_IDStringMessage id of the starting point optional
MESSAGE_TIMEDoubleMessage time of the starting point optional
EXCLUDEBoolIf true starting point message will be excluded in message list default true
ASCENDING_ORDERBoolIf true message list will be returned ascendingOrder by message time default false
LIMITIntNo of messages will be fetched for each request default 50

Secondly, create a FetchMessageListQuery instance.

let messageListQuery = FetchMessageListQuery(MESSAGE_LIST_PARAM)
ArgumentTypeDescription
MESSAGE_LIST_PARAMFetchMessageListParamsInsatance of 'FetchMessageListParams'

Load Initial Messages#

To fetch initial conversations between you and a single chat user or group, call the below method.

messageListQuery.loadMessages { isSuccess, flyError, flyData in
var data = flyData
if (isSuccess) {
let messageList = data.getData() as? [ChatMessage]
} else {
// Fetch messages failed print error to know more about the exception
}
}
ArgumentTypeDescription
CALLBACKFlyCompletionHandlerFlyCompletionHandler implemented as closures

Load Previous Messages#

To fetch previous conversations between you and a single chat user or group, call the below method.

messageListQuery.loadPreviousMessages { isSuccess, flyError, flyData in
var data = flyData
if (isSuccess) {
let messageList = data.getData() as? [ChatMessage]
} else {
// Fetch messages failed print error to know more about the exception
}
}
ArgumentTypeDescription
CALLBACKFlyCompletionHandlerFlyCompletionHandler implemented as closures

Load Next Messages#

To fetch next conversations between you and a single chat user or group, call the below method.

messageListQuery.loadNextMessages { isSuccess, flyError, flyData in
var data = flyData
if (isSuccess) {
let messageList = data.getData() as? [ChatMessage]
} else {
// Fetch messages failed print error to know more about the exception
}
}
ArgumentTypeDescription
CALLBACKFlyCompletionHandlerFlyCompletionHandler implemented as closures

Check Previous Set of Messages availability#

To check previous set of conversations available or not, call the below method.

let hasPreviousMessages: Bool = messageListQuery.hasPreviousMessages()

Check Next Set of Messages availability#

To check next set of conversations available or not, call the below method.

let hasNextMessages: Bool = messageListQuery.hasNextMessages()

Check Message Fetching InProgress#

To check conversations fetching in progress or not, call the below method.

let fetchingInProgress: Bool = messageListQuery.isFetchingInProgress()

Get RecentChat by pagination#

Create a RecentChatListParams instance. Here, you can set the recentchat filter options .

let recentChatListParams = RecentChatListParams()
recentChatListParams.limit = "LIMIT"
ArgumentTypeDescription
LIMITIntNo of recent chats will be fetched for each request default 40

Secondly, create a RecentChatListBuilder instance.

let recentChatListBuilder = RecentChatListBuilder(RECENT_LIST_PARAM)
ArgumentTypeDescription
RECENT_LIST_PARAMRecentChatListParamsInsatance of 'RecentChatListParams'

Load Initial RecentChats#

To fetch initial set of recentChat data, call the below method.

recentChatBuilder.loadRecentChatList { isSuccess, flyError, flyData in
var data = flyData
if (isSuccess) {
let recentChatArray = data.getData() as? [RecentChat]
} else {
// Fetch recentchat failed print error to know more about the exception
}
}
ArgumentTypeDescription
CALLBACKFlyCompletionHandlerFlyCompletionHandler implemented as closures

Load Next RecentChats#

To fetch next set of recentChats, call the below method.

recentChatBuilder.nextSetOfData { { isSuccess, flyError, flyData in
var data = flyData
if (isSuccess) {
let recentChatArray = data.getData() as? [RecentChat]
} else {
// Fetch recentchat failed print error to know more about the exception
}
}
ArgumentTypeDescription
CALLBACKFlyCompletionHandlerFlyCompletionHandler implemented as closures

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.

ChatManager.updateChatMuteStatus(jid: jid, muteStatus: muteStatus)
ArgumentTypeDescription
JIDStringjid of the chat user/ group
MUTE_STATUSBooltrue, if you want to mute notifications for the chat

Get Recent Chat#

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

let recentChat: RecentChat = ChatManager.getRecentChatOf(jid:jid)

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 of a user or a group.

Get Recent Chat list with archived chats#

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

let recentChatList: [RecentChat] = ChatManager.getRecentChatListIncludingArchived()

Check a user is UnArchived#

To check whether the given jid was archived or not

let isUnArchived: Bool = ChatManager.shared.isUserUnArchived(JID)
ArgumentTypeDescription
JIDStringjid of the user/group

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.

ChatManager.getArchivedChatList { (isSuccess, flyError, resultDict) in
if isSuccess {
var flydata = resultDict
print(flydata.getData())
}else{
//Getting users blocked me list failed
}
}
ArgumentTypeDescription
CALLBACKFlyCompletionHandlerFlyCompletionHandler used as completion Handler

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.

ChatManager.markConversationAsRead(JID_LIST)
ArgumentsTypeDescription
JID_LISTList<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.

ChatManager.markConversationAsUnread(JID_LIST)
ArgumentsTypeDescription
JID_LISTList<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.

ChatManager.enableDisableArchivedSettings(_ status : Bool) { (isSuccess, flyError, resultDict) in
if isSuccess {
var flydata = resultDict
print(flydata.getData())
}else{
//archive enable/disable failed
}
}
ArgumentTypeDescription
STATUSBooltrue to enable archive chat false to disable archive chat
CALLBACKFlyCompletionHandlerFlyCompletionHandler used as completion Handler

Archive Settings Status#

Get Archive Settings Status to keep the archived chats permanent.

let isEnabled:Bool = ChatManager.isArchivedSettingsEnabled()
ChatManager.getArchivedSettingsStatusFromServer()
info

While user Logging the app, archived settings status will be synced from server by calling the method ChatManager.shared.getArchivedSettingsStatusFromServer() and status will be updated to ChatManager.shared.isArchivedSettingsEnabled()

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.

ChatManager.updateArchiveUnArchiveChat(_ jids : [String], _ status : Bool) { (isSuccess, flyError, resultDict) in
if isSuccess {
var flydata = resultDict
print(flydata.getData())
}else{
//archive/unarchive chat failed
}
}
ArgumentTypeDescription
JIDS[String]jids of the user/group to Archive/UnArchive
STATUSBooltrue to archive the recent chat false to unarchive the recent chat
CALLBACKFlyCompletionHandlerFlyCompletionHandler used as completion Handler

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.

ChatManager.getArchivedChatsFromServer() { (isSuccess, flyError, resultDict) in
if isSuccess {
var flydata = resultDict
print(flydata.getData())
}else{
//Get archived chats failed
}
}
ArgumentTypeDescription
CALLBACKFlyCompletionHandlerFlyCompletionHandler used as completion Handler
info

While user Logging the app, if any chats archived then list will be synced by fetching this method ChatManager.getArchivedChatsFromServer() the list of Archived JIDs will update into ChatManager.getArchivedChatList().

Search Message in Recent Chat#

To find a message or similar messages that matches a search term among all conversations call the method below.

var searchedMessages : [SearchMessage] = ChatManager.shared.searchMessage(text: searchText)
ArgumentTypeDescription
textStringtext characters for which search has to happen
[SearchMessage]List of SearchMessageReturns list of SearchMessage (refer SearchMessage in Class documentation)

Delete a Recent Chat#

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

ChatManager.deleteRecentChats(jids: JIDS) { (isSuccess, flyerror, resultDict) in
}

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

ArgumentsTypeDescription
JIDS[String]jid of the user/group
CALLBACKFlyCompletionHandlerFlyCompletionHandler used as completion Handler
caution

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

If delete chat feature unavailable for your plan then below methods will throw 403 exception.

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.

ChatManager.updateRecentChatPinStatus(jid: jid, pinRecentChat: pinRecentChat)
ArgumentsTypeDescription
JIDStringjid of the user/group
PIN_RECENT_CHATbooleanif 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.

let recentPinCount: Int = ChatManager.recentChatPinnedCount()

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.

FlyMessenger.saveUnsentMessage(ID,MESSAGE,MENTIONEDUSERS,MENTIONSEARCH,MENTIONLOCATION,MENTIONLENGHT)
ArgumentTypeDescription
IDStringJid of the user/group
MESSAGEStringText message content
MENTIONEDUSERS[String]Users id of mentioned
MENTIONSEARCH[String]Search words of mention
MENTIONLOCATION[Int]Search words locations
MENTIONLENGHT[Int]Search words length

Note : MENTIONEDUSERS, MENTIONSEARCH, MENTIONLOCATION, MENTIONLENGHT for group mention values, otherwise it will be empty

Get unsent message of a user/group#

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

let unsentMessage : UnsentMessage = FlyMessenger.getUnsentMessageOf(ID)
ArgumentTypeDescription
IDStringJid of the user/group
UnsentMessageUnsentMessageUnsent message content

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.

ChatManager.clearChat(toJID: toJid, chatType: chatType, clearChatExceptStarred: clearChatExceptStarred) { (isSuccess, flyerror, resultDict) in
}
caution

If clear chat feature unavailable for your plan then below methods will throw 403 exception.

ArgumentTypeDescription
TO_JIDStringjid of the chat user
CHAT_TYPEChatTypeEnumChatTypeEnum.chat for single chat, ChatTypeEnum.groupchat for group chat, ChatTypeEnum.broadcast for broadcast
CLEAR_EXCEPT_STARREDbooleanif true, delete all the messages except the favourite messages
CALLBACKFlyCompletionHandlerFlyCompletionHandler used as completion Handler

Handling Banned User/Group#

Banning a user or group is a feature. A user or group can be blocked or unblocked from console. This is applicable to logged in user, contacts of logged in user and groups

Note: Xmpp must be connected

Current / Logged in user#

To get blocking/unblocking event of current/logged in user, confirm viewcontroller or Appdelegate to below protocol.

AdminBlockCurrentUserDelegate

FlyDefaults.isBlockedByAdmin
// This will return true or false to check current user is blocked or unblocked.
// It can be used, while coming from background or opening the app or wherever
let adminEmail = "mirroflyadminsupport@gmail.com"
// support email is defined in StringConstants File.

In Appdelegate#

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
ChatManager.shared.adminBlockCurrentUserDelegate = self
retrun true
}
extension AppDelegate : AdminBlockCurrentUserDelegate {
func didBlockOrUnblockCurrentUser(userJid: String, isBlocked: Bool) {
if isBlocked {
// if logged in user is being blocked this coditon will execute
// do your UI stuffs here
} else {
// if logged in user is unblocked this coditon will execute
// do your UI stuffs here
}
}
func didBlockOrUnblockGroup(groupJid : String, isBlocked : Bool) {
}
func didBlockOrUnblockContact(userJid : String, isBlocked : Bool) {
}
}

In ViewController#

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
ChatManager.shared.adminBlockCurrentUserDelegate = self
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
ChatManager.shared.adminBlockCurrentUserDelegate = nil
}
extension <View Controller Name> : AdminBlockCurrentUserDelegate {
func didBlockOrUnblockCurrentUser(userJid: String, isBlocked: Bool) {
if isBlocked {
// if logged in user is being blocked this coditon will execute
// do your UI stuff here
} else {
// if logged in user is unblocked this coditon will execute
// do your UI stuff here
}
}
func didBlockOrUnblockGroup(groupJid : String, isBlocked : Bool) {
}
func didBlockOrUnblockContact(userJid : String, isBlocked : Bool) {
}
}
ArgumentTypeDescription
userJidStringjid of the current user
isBlockedBooltrue, if current user is being blocked. false, if current user is unblocked

Contacts of current user and group#

To get blocking/unblocking event of Contacts of current user and group, confirm viewcontroller to below protocol.

AdminBlockDelegate

In ViewController#

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
ChatManager.shared.adminBlockDelegate = self
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
ChatManager.shared.adminBlockDelegate = nil
}
extension <ViewController Name> : AdminBlockDelegate {
func didBlockOrUnblockContact(userJid: String, isBlocked: Bool) {
// If a contact is blocked/unblocked, this function will be triggered
// do your UI stuff here
}
func didBlockOrUnblockSelf(userJid: String, isBlocked: Bool) {
// If a current user is blocked/unblocked, this function will be triggered
// do your UI stuff here
}
func didBlockOrUnblockGroup(groupJid: String, isBlocked: Bool) {
// If a group is blocked/unblocked, this function will be triggered
// do your UI stuff here
}
}
ArgumentTypeDescription
userJidStringjid of the user
isBlockedBooltrue, if user is being blocked. false, if user is unblocked
groupJidStringjid of the group

Report a user or group or message#

Reporting is a feature which allows users to report a user or group or message.

Getting Messgages To report by user Jid#

let reportMessage : ReportMessage? = ChatManager.getMessagesForReporting(chatUserJid: chatUserJid, messagesCount: 5)
caution

If report message feature unavailable for your plan then below methods will throw 403 exception.

ArgumentTypeDescription
chatUserJidStringjid of a user or groupJid
messagesCountIntcount of messages to be reported
RetrunTypeDescription
ReportMessageReportMessage structReportMessage is a model to be passed while reporting messages

Getting Messgages To report from selected message#

let reportMessage : ReportMessage? = ChatManager.getMessagesForReporting(message: message, messagesCount: 5)
caution

If report message feature unavailable for your plan then below methods will throw 403 exception.

ArgumentTypeDescription
messageChatMessageselected ChatMessage
messagesCountIntcount of messages to be reported from selected message
RetrunTypeDescription
ReportMessageReportMessage structReportMessage is a model to be passed while reporting messages

Reporting#

To report call below method.

ChatManager.reportMessage(reportMessage: reportMessage) { isSent in
completionHandler(isSent)
}
caution

If report message feature unavailable for your plan then below methods will throw 403 exception.

ArgumentTypeDescription
reportMessageReportMessageReportMessage modle to be passed to report
resultTypeDescription
isSentBooltrue if success. false if failure

Media File Encryption#

Media files can be encrypted before uploading them to the server by calling the below method.By default media file encryption is disabled.

ChatManager.setMediaEncryption(isEnable: "ENABLE")
ArgumentTypeDescription
ENABLEBoolif true media files will be encrypted

Hide Notification Content#

To be in Compliance with Hipaa and other Security guidelines, sdk provides method to hide the title and content of the push notifations. By calling the below method we can hide the notification content.

ChatManager.hideNotificationContent(hide: HIDE)
ArgumentTypeDescription
HIDEBoolif true content will be hidden and shown as New Message

Recent Chat Pinning#

To set the maximum number of recent chat that can be pinned at the top of the recent chat list call the below method.

ChatManager.setMaximumPinningForRecentChat(maxPinChat: MAX_PIN_COUNT)
ArgumentTypeDescription
MAX_PIN_COUNTIntMaximum amount of a recent chat that can be pinned

Delete local media file#

To enable/disable the deletion of the associated media file in the app's document folder when we delete a media message call the below method.

ChatManager.deleteMediaFromDevice(delete: DELETE_MEDIA)
ArgumentTypeDescription
DELETE_MEDIABoolMaximum amount of a recent chat that can be pinned

Delete SDK data#

To delete/clear sdk's local data like database and user defaults call the below method.

ChatManager.shared.resetSDKData()
caution

Calling this method will clear all the table in sdk's database and the preference maintained in sdk using user defaults which can't be restored once deleted.

Get Image metadata from a PHAsset file#

To get the image metadata and thumbnail of an image or a video from an PHAsset file object call the below method.

if let (FILENAME, DATA, FILESIZE, IMAGE, THUMBIMAGE,IS_VIDEO) = MediaUtils.getAssetsImageInfo(PHASSET){}
ArgumentTypeDescription
PHASSETPHAssetPHAASSET file object
Tuple VariableTypeDescription
FILENAMEStringName of the file
DATADataData of the image file(if asset is video data of the image for the video)
FILESIZEDoubleSize of the image file in bytes
IMAGEUIImageUIImage of the image (if asset is video image for the video)
THUMBIMAGEUIImageThumbnail UIImage of the image (if asset is video thumb image for the video)
IS_VIDEOBooleanif true the asset is video else false

Note : This method will also accept file URL.

Process Video#

Slow motion videos captured by iOS devices has to be processed before sending a video message to support cross-platform messaging. For normal video nothing will be processed and it's URL will be returned in completion handler. Call the below method to process a video.

MediaUtils.processVideo(PHASSET) { PHASSET, STATUS, PROCESSED_VIDEO_URL, IS_SLOMO_VIDEO in
switch STATUS {
case.processing:
case.success:
case.failed:
}
}
ArgumentTypeDescription
PHASSETPHAssetPHAsset file object
VariableTypeDescription
PHASSETPHAssetPHAsset file object to be processed
STATUSMediaStatusan enum type to reflect status of the processing
PROCESSED_VIDEO_URLURLURL of the video
IS_SLOMO_VIDEOBooleantrue if it's a slomo video

Compress Image#

To compress and get the metadata of an image call the below method.

if let (DATA, FILENAME ,URL, FILEKEY, FILESIZE) = MediaUtils.compressImage(imageData : DATA, MEDIA_QUALITY){}
ArgumentTypeDescription
DATADataData of the uncompressed image to be compressed
MEDIA_QUALITYMediaQualityOutput quality of the compressed image
VariableTypeDescription
DATADataData of the compressed image
FILENAMEStringname of the compressed image
URLURLURL of the compressed image
FILEKEYBooleankey of the compressed ecnrypted image if encryption is enabled
FILESIZEDoubleSize of the compressed image in bytes

Note : Default media quality for Image compression is medium.

Compress Video#

To compress and get the metadata of a video call the below method.

MediaUtils.compressVideo(PROCESSED_VIDEO_URL,MEDIA_QUALITY) {IS_SUCCESS, URL, FILENAME, FILEKEY, FILESIZE , DURATION in }
ArgumentTypeDescription
PROCESSED_VIDEO_URLDataURL of the video to be compressed
MEDIA_QUALITYMediaQualityOutput quality of the compressed video
COMPLETION_HANDLER(Bool, URL?, String, String, Double, Double)tuple completion handler
VariableTypeDescription
IS_SUCCESSBooleantrue if compression is success else false
URLURLURL of the compressed video
FILENAMEStringName of the compressed video file
FILEKEYStringkey of the compressed ecnrypted video if encryption is enabled
FILESIZEDoubleSize of the compressed video in bytes
DURATIONDoubleDuration of the compressed video

Note : Default media quality for video compression is medium.

Process Audio#

To process and get the metadata of an audio file call the below method.

MediaUtils.processAudio(AUDIO_URL,MAX_SIZE) {IS_SUCCESS, FILENAME, SAVED_FILE_URL, FILESIZE , DURATION, FILEKEY in }
ArgumentTypeDescription
AUDIO_URLURLURL of the audio asset file to be processed
MAX_SIZEDoublevalidation size for maximum audio file size(default 30MB)
COMPLETION_HANDLER(Bool, String,URL?, Double, Double, String)tuple completion handler
VariableTypeDescription
IS_SUCCESSBooleantrue if processing is success else false
FILENAMEStringName of the processed audio file
SAVED_FILE_URLURLURL of the processed and saved audio file
FILESIZEDoubleSize of the processed audio in bytes
DURATIONDoubleDuration of the processed audio
FILEKEYStringKey of the processed ecnrypted audio if encryption is enabled

Process Document#

To process and get the metadata of a document file call the below method.

MediaUtils.processDocument(DOCUMENT_URL,MAX_SIZE) {IS_SUCCESS, SAVED_FILE_URL, FILESIZE , FILENAME, FILEKEY in }
ArgumentTypeDescription
DOCUMENT_URLURLURL of the document file to be processed
MAX_SIZEDoublevalidation size for maximum Document file size(default 20MB)
COMPLETION_HANDLER(Bool, URL?,Double,String,String)tuple completion handler
VariableTypeDescription
IS_SUCCESSBooleantrue if processing is success else false
SAVED_FILE_URLURLURL of the processed and saved document file
FILESIZEDoubleSize of the processed document in bytes
FILENAMEStringName of the processed document file
FILEKEYStringKey of the processed ecnrypted document if encryption is enabled

Forward Messages#

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

ChatManager.forwardMessages(MESSAGEIDLIST, TOJIDLIST){ isSuccess, flyError, flyData in
if isSuccess {
} else{
print(flyError!.localizedDescription)
}
}
ArgumentTypeDescription
MESSAGEIDLIST[String]array of messageIds to forward
TOJIDLIST[String]array of jids to forwards messages
CALLBACKFlyCompletionHandlerFlyCompletionHandler used as completion Handler

Email Chat Conversation#

To export a chat conversation of a user, or a group to a list of email recipients call the below method.

ChatManager.shared.exportChatConversationToEmail(jid) { chatDataModel in
}
ArgumentTypeDescription
jidStringjid of the user/group
chatDataModelChatDataModel"Class" which has chat data to share in email

Note : To know more about ChatDataModel, refer class documentation.

Send Typing Status#

To send typing status, while a member composing a message in group, call below method.

ChatManager.sendTypingStatus(to: jid, chatType: CHAT_TYPE)
ArgumentTypeDescription
toStringjid of the user/group
CHAT_TYPEChatTypeEnumChatTypeEnum.chat for single chat, ChatTypeEnum.groupchat for group chat, ChatTypeEnum.broadcast for broadcast

Send Typing Gone Status#

To send Gone status, when a member stops composing a message in group, call below method.

ChatManager.sendTypingGoneStatus(to: jid, chatType: CHAT_TYPE)
ArgumentTypeDescription
toStringjid of the user/group
CHAT_TYPEChatTypeEnumChatTypeEnum.chat for single chat, ChatTypeEnum.groupchat for group chat, ChatTypeEnum.broadcast for broadcast

Chat Tags#

Chat Tags is a feature which allows users to filter the recent chat. if you want to filter your chats by seprate titles then you can utilise the below methods.

Create or Update Chat Tag#

You can create or update a chat tag by using the below method.

ChatManager.createOrUpdateChatTagdata(chatTag: chatTagModel) { isSuccess, error, data in
}
ArgumentTypeDescription
chatTagchatTagModel"Class" which has chat tag data

Note : To know more about chatTagModel, refer class documentation.

Get List of Created Chat Tags#

To get a list of created chat tags by using the below method.

ChatManager.getChatTagdata(completionHandler: { isSuccess, error, data in
})

Re-order Chat Tags#

To re-order a chat tags list use the below method.

ChatManager.reorderChatTags(chatTags: chatTags) { isSuccess, error, data in
}
ArgumentTypeDescription
chatTags[chatTagModel]Array of chatTagModel class

Delete Chat Tag#

To delete a chat tags use the below method.

ChatManager.deleteChatTag(chatTag: chatTag) { isSuccess, error, data in
}
ArgumentTypeDescription
chatTagchatTagModel"Class" which has chat tag data

Get MetaData of user#

To get MetaData value of user call the below method.

ChatManager.getMetaData { (isSuccess, flyError, resultDict) in
if isSuccess {
var flydata = resultDict
print(flydata.getData())
}else{
//Getting metaData failed
}
}
ArgumentTypeDescription
CALLBACKFlyCompletionHandlerFlyCompletionHandler used as completion Handler

Update MetaData of user#

To Update MetaData value of user call the below method.

ChatManager.updateMetaData([MetaData]) { (isSuccess, flyError, resultDict) in
if isSuccess {
var flydata = resultDict
print(flydata.getData())
}else{
//Updating metaData failed
}
}
ArgumentTypeDescription
META_DATA[MetaData]list of key - value pair of metadata object. Maximum size is 3 (optional)
CALLBACKFlyCompletionHandlerFlyCompletionHandler used as completion Handler

Backup and Restore#

Backup and Restore is a feature which allows users to backup the chats and able to restore chats.

Backup your chat#

Whenever you need to backup your chat messages, you can use the below method to start backup. The method will backup all the chats and writes to a file. Once backup completed you can get the backup file path from the backupDidFinish callback delegate.

BackupManager.shared.startBackup()
ArgumentTypeDescription
CallbackBackupEventDelegateBackup progress and completeion
info

The backup progress and completion callback BackupEventDelegate.

Note : To check if message is available use this method BackupManager.shared.checkIfMessageAvailable().

Restore from a backup file#

Whenever you need to restore the chat messages from the backup file, you can use the below method.

BackupManager.shared.restoreMessages(URL)
ArgumentTypeDescription
URLURLBackup file local path url
CallbackRestoreEventDelegateRestore progress and completeion
info

The backup progress and completion callback RestoreEventDelegate.