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.
- Swift
| Argument | Type | Description |
|---|---|---|
| CHAT_ID | String | Jid of the user/group |
| MESSAGE_ID | String | Message id of the starting point optional |
| MESSAGE_TIME | Double | Message time of the starting point optional |
| EXCLUDE | Bool | If true starting point message will be excluded in message list default true |
| ASCENDING_ORDER | Bool | If true message list will be returned ascendingOrder by message time default false |
| LIMIT | Int | No of messages will be fetched for each request default 50 |
Secondly, create a FetchMessageListQuery instance.
- Swift
| Argument | Type | Description |
|---|---|---|
| MESSAGE_LIST_PARAM | FetchMessageListParams | Insatance of 'FetchMessageListParams' |
Load Initial Messages#
To fetch initial conversations between you and a single chat user or group, call the below method.
- Swift
| Argument | Type | Description |
|---|---|---|
| CALLBACK | FlyCompletionHandler | FlyCompletionHandler implemented as closures |
Load Previous Messages#
To fetch previous conversations between you and a single chat user or group, call the below method.
- Swift
| Argument | Type | Description |
|---|---|---|
| CALLBACK | FlyCompletionHandler | FlyCompletionHandler implemented as closures |
Load Next Messages#
To fetch next conversations between you and a single chat user or group, call the below method.
- Swift
| Argument | Type | Description |
|---|---|---|
| CALLBACK | FlyCompletionHandler | FlyCompletionHandler implemented as closures |
Check Previous Set of Messages availability#
To check previous set of conversations available or not, call the below method.
- Swift
Check Next Set of Messages availability#
To check next set of conversations available or not, call the below method.
- Swift
Check Message Fetching InProgress#
To check conversations fetching in progress or not, call the below method.
- Swift
Get RecentChat by pagination#
Create a RecentChatListParams instance. Here, you can set the recentchat filter options .
- Swift
| Argument | Type | Description |
|---|---|---|
| LIMIT | Int | No of recent chats will be fetched for each request default 40 |
Secondly, create a RecentChatListBuilder instance.
- Swift
| Argument | Type | Description |
|---|---|---|
| RECENT_LIST_PARAM | RecentChatListParams | Insatance of 'RecentChatListParams' |
Load Initial RecentChats#
To fetch initial set of recentChat data, call the below method.
- Swift
| Argument | Type | Description |
|---|---|---|
| CALLBACK | FlyCompletionHandler | FlyCompletionHandler implemented as closures |
Load Next RecentChats#
To fetch next set of recentChats, call the below method.
- Swift
| Argument | Type | Description |
|---|---|---|
| CALLBACK | FlyCompletionHandler | FlyCompletionHandler 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.
- Swift
- Objective-C
| Argument | Type | Description |
|---|---|---|
| JID | String | jid of the chat user/ group |
| MUTE_STATUS | Bool | true, if you want to mute notifications for the chat |
Get Recent Chat#
To get the recent chat of a user or a group.
- Swift
- Objective-C
Refer this doc to know more about RecentChat Class
| Arguments | Type | Description |
|---|---|---|
| JID | String | jid 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.
- Swift
- Objective-C
Archive a recent chat conversation#
Archiving a chat conversation makes the chat not appear in recent chat list, mostly used on chats which are inactive for a long time.
- Swift
- Objective-C
| Argument | Type | Description |
|---|---|---|
| JIDS_TO_ARCHIVE | [String] | jids of the user/group |
Unarchive a archived recent chat conversation#
Unarchiving a archived recent chat conversation makes the chat conversation appear in recent chat list again.
- Swift
- Objective-C
| Argument | Type | Description |
|---|---|---|
| JIDS_TO_UNARCHIVE | [String] | jids of the user/group |
Note : Archiving and Unarchiving a chat conversation persist in local only not across login or reinstalls.
Check a user is UnArchived#
To check whether the given jid was archived or not
- Swift
- Objective-C
| Argument | Type | Description |
|---|---|---|
| JID | String | jid 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.
- Swift
- Objective-C
| Argument | Type | Description |
|---|---|---|
| CALLBACK | FlyCompletionHandler | FlyCompletionHandler 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.
- Swift
- Objective-C
| Arguments | Type | Description |
|---|---|---|
| JID_LIST | List<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.
- Swift
- Objective-C
| Arguments | Type | Description |
|---|---|---|
| JID_LIST | List<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.
- Swift
- Objective-C
| Argument | Type | Description |
|---|---|---|
| STATUS | Bool | true to enable archive chat false to disable archive chat |
| CALLBACK | FlyCompletionHandler | FlyCompletionHandler used as completion Handler |
Archive Settings Status#
Get Archive Settings Status to keep the archived chats permanent.
- Swift
- Objective-C
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.
- Swift
- Objective-C
| Argument | Type | Description |
|---|---|---|
| JIDS | [String] | jids of the user/group to Archive/UnArchive |
| STATUS | Bool | true to archive the recent chat false to unarchive the recent chat |
| CALLBACK | FlyCompletionHandler | FlyCompletionHandler 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.
- Swift
- Objective-C
| Argument | Type | Description |
|---|---|---|
| CALLBACK | FlyCompletionHandler | FlyCompletionHandler used as completion Handler |
info
While user Logging the app, if any chats archived then list will be synced by fetching this method ChatManager.shared.getArchivedChatsFromServer() the list of Archived JIDs will update into ChatManager.shared.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.
- Swift
- Objective-C
| Argument | Type | Description |
|---|---|---|
| text | String | text characters for which search has to happen |
| [SearchMessage] | List of SearchMessage | Returns 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.
- Swift
- Objective-C
We can delete a archived recent chat using this method too.
| Arguments | Type | Description |
|---|---|---|
| JIDS | [String] | jid of the user/group |
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.
- Swift
- Objective-C
| Arguments | Type | Description |
|---|---|---|
| JID | String | jid of the user/group |
| PIN_RECENT_CHAT | boolean | if 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.
- Swift
- Objective-C
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.
- Swift
- Objective-C
| Argument | Type | Description |
|---|---|---|
| ID | String | Jid of the user/group |
| MESSAGE | String | Text message content |
Get unsent message of a user/group#
To get the saved unsent message of a user/group call the below method.
- Swift
- Objective-C
| Argument | Type | Description |
|---|---|---|
| ID | String | Jid of the user/group |
| TEXT_MESSAGE | String | Text 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.
- Swift
- Objective-C
caution
If clear chat feature unavailable for your plan then below methods will throw 403 exception.
| Argument | Type | Description |
|---|---|---|
| TO_JID | String | jid of the chat user |
| CHAT_TYPE | ChatTypeEnum | ChatTypeEnum.chat for single chat, ChatTypeEnum.groupchat for group chat, ChatTypeEnum.broadcast for broadcast |
| CLEAR_EXCEPT_STARRED | boolean | if true, delete all the messages except the favourite messages |
| CALLBACK | FlyCompletionHandler | FlyCompletionHandler 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
In Appdelegate#
- Swift
- Objective-C
In ViewController#
- Swift
- Objective-C
| Argument | Type | Description |
|---|---|---|
| userJid | String | jid of the current user |
| isBlocked | Bool | true, 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#
- Swift
- Objective-C
| Argument | Type | Description |
|---|---|---|
| userJid | String | jid of the user |
| isBlocked | Bool | true, if user is being blocked. false, if user is unblocked |
| groupJid | String | jid of the group |
Repor 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#
- Swift
- Objective-C
caution
If report message feature unavailable for your plan then below methods will throw 403 exception.
| Argument | Type | Description |
|---|---|---|
| chatUserJid | String | jid of a user or groupJid |
| messagesCount | Int | count of messages to be reported |
| Retrun | Type | Description |
|---|---|---|
| ReportMessage | ReportMessage struct | ReportMessage is a model to be passed while reporting messages |
Getting Messgages To report from selected message#
- Swift
- Objective-C
caution
If report message feature unavailable for your plan then below methods will throw 403 exception.
| Argument | Type | Description |
|---|---|---|
| message | ChatMessage | selected ChatMessage |
| messagesCount | Int | count of messages to be reported from selected message |
| Retrun | Type | Description |
|---|---|---|
| ReportMessage | ReportMessage struct | ReportMessage is a model to be passed while reporting messages |
Reporting#
To report call below method.
- Swift
- Objective-C
caution
If report message feature unavailable for your plan then below methods will throw 403 exception.
| Argument | Type | Description |
|---|---|---|
| reportMessage | ReportMessage | ReportMessage modle to be passed to report |
| result | Type | Description |
|---|---|---|
| isSent | Bool | true 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.
- Swift
- Objective-C
| Argument | Type | Description |
|---|---|---|
| ENABLE | Bool | if 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.
- Swift
- Objective-C
| Argument | Type | Description |
|---|---|---|
| HIDE | Bool | if 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.
- Swift
- Objective-C
| Argument | Type | Description |
|---|---|---|
| MAX_PIN_COUNT | Int | Maximum 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.
- Swift
- Objective-C
| Argument | Type | Description |
|---|---|---|
| DELETE_MEDIA | Bool | Maximum 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.
- Swift
- Objective-C
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.
| Argument | Type | Description |
|---|---|---|
| PHASSET | PHAsset | PHAASSET file object |
| Tuple Variable | Type | Description |
|---|---|---|
| FILENAME | String | Name of the file |
| DATA | Data | Data of the image file(if asset is video data of the image for the video) |
| FILESIZE | Double | Size of the image file in bytes |
| IMAGE | UIImage | UIImage of the image (if asset is video image for the video) |
| THUMBIMAGE | UIImage | Thumbnail UIImage of the image (if asset is video thumb image for the video) |
| IS_VIDEO | Boolean | if 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.
| Argument | Type | Description |
|---|---|---|
| PHASSET | PHAsset | PHAsset file object |
| Variable | Type | Description |
|---|---|---|
| PHASSET | PHAsset | PHAsset file object to be processed |
| STATUS | MediaStatus | an enum type to reflect status of the processing |
| PROCESSED_VIDEO_URL | URL | URL of the video |
| IS_SLOMO_VIDEO | Boolean | true if it's a slomo video |
Compress Image#
To compress and get the metadata of an image call the below method.
| Argument | Type | Description |
|---|---|---|
| DATA | Data | Data of the uncompressed image to be compressed |
| MEDIA_QUALITY | MediaQuality | Output quality of the compressed image |
| Variable | Type | Description |
|---|---|---|
| DATA | Data | Data of the compressed image |
| FILENAME | String | name of the compressed image |
| URL | URL | URL of the compressed image |
| FILEKEY | Boolean | key of the compressed ecnrypted image if encryption is enabled |
| FILESIZE | Double | Size 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.
| Argument | Type | Description |
|---|---|---|
| PROCESSED_VIDEO_URL | Data | URL of the video to be compressed |
| MEDIA_QUALITY | MediaQuality | Output quality of the compressed video |
| COMPLETION_HANDLER | (Bool, URL?, String, String, Double, Double) | tuple completion handler |
| Variable | Type | Description |
|---|---|---|
| IS_SUCCESS | Boolean | true if compression is success else false |
| URL | URL | URL of the compressed video |
| FILENAME | String | Name of the compressed video file |
| FILEKEY | String | key of the compressed ecnrypted video if encryption is enabled |
| FILESIZE | Double | Size of the compressed video in bytes |
| DURATION | Double | Duration 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.
| Argument | Type | Description |
|---|---|---|
| AUDIO_URL | URL | URL of the audio asset file to be processed |
| MAX_SIZE | Double | validation size for maximum audio file size(default 30MB) |
| COMPLETION_HANDLER | (Bool, String,URL?, Double, Double, String) | tuple completion handler |
| Variable | Type | Description |
|---|---|---|
| IS_SUCCESS | Boolean | true if processing is success else false |
| FILENAME | String | Name of the processed audio file |
| SAVED_FILE_URL | URL | URL of the processed and saved audio file |
| FILESIZE | Double | Size of the processed audio in bytes |
| DURATION | Double | Duration of the processed audio |
| FILEKEY | String | Key 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.
| Argument | Type | Description |
|---|---|---|
| DOCUMENT_URL | URL | URL of the document file to be processed |
| MAX_SIZE | Double | validation size for maximum Document file size(default 20MB) |
| COMPLETION_HANDLER | (Bool, URL?,Double,String,String) | tuple completion handler |
| Variable | Type | Description |
|---|---|---|
| IS_SUCCESS | Boolean | true if processing is success else false |
| SAVED_FILE_URL | URL | URL of the processed and saved document file |
| FILESIZE | Double | Size of the processed document in bytes |
| FILENAME | String | Name of the processed document file |
| FILEKEY | String | Key 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.
- Swift
- Objective-C
| Argument | Type | Description |
|---|---|---|
| MESSAGEIDLIST | [String] | array of messageIds to forward |
| TOJIDLIST | [String] | array of jids to forwards messages |
| CALLBACK | FlyCompletionHandler | FlyCompletionHandler 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.
- Swift
- Objective-C
| Argument | Type | Description |
|---|---|---|
| jid | String | jid of the user/group |
| chatDataModel | ChatDataModel | "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.
- Swift
- Objective-C
| Argument | Type | Description |
|---|---|---|
| to | String | jid of the user/group |
| CHAT_TYPE | ChatTypeEnum | ChatTypeEnum.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.
- Swift
- Objective-C
| Argument | Type | Description |
|---|---|---|
| to | String | jid of the user/group |
| CHAT_TYPE | ChatTypeEnum | ChatTypeEnum.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.
- Swift
- Objective-C
| Argument | Type | Description |
|---|---|---|
| chatTag | chatTagModel | "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.
- Swift
- Objective-C
Re-order Chat Tags#
To re-order a chat tags list use the below method.
- Swift
- Objective-C
| Argument | Type | Description |
|---|---|---|
| chatTags | [chatTagModel] | Array of chatTagModel class |
Delete Chat Tag#
To delete a chat tags use the below method.
- Swift
- Objective-C
| Argument | Type | Description |
|---|---|---|
| chatTag | chatTagModel | "Class" which has chat tag data |
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.
- Swift
- Objective-C
| Argument | Type | Description |
|---|---|---|
| Callback | BackupEventDelegate | Backup 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.
- Swift
- Objective-C
| Argument | Type | Description |
|---|---|---|
| URL | URL | Backup file local path url |
| Callback | RestoreEventDelegate | Restore progress and completeion |
info
The backup progress and completion callback RestoreEventDelegate.