Group chat module
#
PrerequisitesIn order to send messages using the chat sdk , at first you need to establish the connection to the server. sdk provides methods for initializing the connection configuration as well as methods for making connection.
Note: Even if you don't have internet connection, you are still allowed to send messages which will be kept in offline database.Once the user connected to the internet, the messages will be sent automatically when user opens the app.
#
Preparing Group chat jidSDK provieds the below utility method to preparing group JID. FlyUtils.getGroupJid(groupId : String)
Note: The below characters is not allowed in uniqueId: U+0022 (") U+0026 (&) U+0027 (') U+002F (/) U+003A (:) U+003C (<) U+003E (>) U+0040 (@).
Argument | Type | Description |
---|---|---|
groupId | String | unique groupId for preparing group JID |
- Swift
- Objective-C
#
Create a GroupTo create a group, call the below method.
- Swift
- Objective-C
Argument | Type | Description |
---|---|---|
groupName | String | Name of the group (cannot be null or empty) |
participantJidList | [String] | Array of jids of the member (size cannot be less than 2 excluding group creator) |
groupImageFileUrl | String | local file url of the image (can be empty) |
completionHandler | FlyCompletionHandler | implemented as closure expression |
#
Get Group ProfileTo get a group profile from server or local, call below method.
- Swift
- Objective-C
Argument | Type | Description |
---|---|---|
groupJid | String | groupJid of a group |
fetchFromServer | Bool | if fetchFromServer is true, prfoile details will be fetched from server or else (false) from local |
completionHandler | FlyCompletionHandler | callback to get success or failure response. implemented as closure expression |
#
Get ParticipantsTo get group members from the server, call below method
- Swift
- Objective-C
Argument | Type | Description |
---|---|---|
groupJID | String | groupJid of a group |
info
if getParticipants(groupJID: groupId) is success, didReceiveParticipantForGroupId(groupJid: String) method will be called, which is defined in GroupEventsDelegate.
#
Add Participants to a groupTo add participants to a group, call below method
- Swift
- Objective-C
Argument | Type | Description |
---|---|---|
groupId | String | jid of a group |
newUserJidList | [String] | array of jid list to be added in group (jid list should not contain jid, which is already exiting in same group) |
completionHandler | FlyCompletionHandler | callback to get success or failure response. implemented as closure expression |
info
if addParticipantToGroup is success, func didAddParticipantSuccessMessage(addParticipantmessage: String) method will be called, which is defined in GroupEventsDelegate.
#
Remove a Participant from a groupTo remove a participant from a group, call below method
- Swift
- Objective-C
Argument | Type | Description |
---|---|---|
groupId | String | jid of a group |
removeGroupMemberJid | String | jid of participant to be removed from group, who is member of this group) |
completionHandler | FlyCompletionHandler | callback to get success or failure response. implemented as closure expression |
info
if removeParticipantFromGroup is success, func didAdminRemoveParticipant(message:String) method will be called, which is defined in GroupEventsDelegate.
#
Get GroupsTo get groups from local or server, call below method
- Swift
- Objective-C
Argument | Type | Description |
---|---|---|
fetchFromServer | Bool | if fetchFromServer is true, groups will be feteched from server or else from local |
completionHandler | FlyCompletionHandler | callback to get success or failure response. implemented as closure expression |
info
func didGetGroups(groups : [ProfileDetails], message : String) method will be called, which is defined in GroupEventsDelegate.
#
Add or Update Group ImageToo add or update group image, call below method
- Swift
- Objective-C
Argument | Type | Description |
---|---|---|
groupJid | String | jid of the group |
groupProfileImageUrl | String | local file url (image path) of the image |
completionHandler | FlyCompletionHandler | implemented as closure expression |
info
func didGroupProfileUpdated(message: String) method will be called, which is defined in GroupEventsDelegate.
#
Remove Group ImageTo remove group image, call below method
- Swift
- Objective-C
Argument | Type | Description |
---|---|---|
groupJid | String | jid of the group |
completionHandler | FlyCompletionHandler | implemented as closure expression |
info
func didGroupProfileUpdated(message: String) method will be called, which is defined in GroupEventsDelegate.
#
Update a Group NameTo update a group name, call below method
- Swift
- Objective-C
Argument | Type | Description |
---|---|---|
groupJid | String | jid of the group |
groupName | String | group name (should not be null or empty) |
completionHandler | FlyCompletionHandler | implemented as closure expression |
info
func didGroupProfileUpdated(message: String) method will be called, which is defined in GroupEventsDelegate.
#
Make a participant as AdminTo make a participant as admin, call below method. Admin only can make a participant as admin.
- Swift
- Objective-C
Argument | Type | Description |
---|---|---|
groupJid | String | jid of the group |
userJid | String | jid of the participant, to make as admin |
completionHandler | FlyCompletionHandler | implemented as closure expression |
info
func didMakeAdmin(message: String) and func didGroupInfoUpdatedWithId(groupJid: String) method will be called, these are defined in GroupEventsDelegate.
#
Exit from a GroupTo exit from a group, call below method
- Swift
- Objective-C
Argument | Type | Description |
---|---|---|
groupJid | String | jid of the group |
userJid | String | jid of the participant, to exit from the group |
completionHandler | FlyCompletionHandler | implemented as closure expression |
info
func didExitFromGroup(message: String) method will be called, these are defined in GroupEventsDelegate.
#
Delete a GroupTo delete a group, call below method Before delete a group, participant should be left the group
- Swift
- Objective-C
Argument | Type | Description |
---|---|---|
groupJid | String | jid of the group to be deleted |
completionHandler | FlyCompletionHandler | implemented as closure expression |
info
didDeleteFromGroup(message: String) method will be called, which is defined in GroupEventsDelegate.
#
Get Group CountTo get group count from local DB, call below method
- Swift
- Objective-C
Return Type | Description |
---|---|
Int | returns the count of group from local DB |
#
Check admin userTo check a member is admin, call below method
- Swift
- Objective-C
Argument | Type | Description |
---|---|---|
groupJid | String | jid of the group |
participantJid | String | participantJid to check admin user |
Returns | Type | Description |
---|---|---|
(isAdmin : Bool,message :String) | Tuple (Bool,String) | isAdmin is true, if participantJid is admin. message : response message |
#
Participant Existance in a GroupTo check a participant existance in a group, call below method
- Swift
- Objective-C
Argument | Type | Description |
---|---|---|
groupJid | String | jid of the group |
participantJid | String | participantJid to check existance in the group |
Returns | Type | Description |
---|---|---|
(doesExist : Bool, message : String) | Tuple (Bool,String) | doesExist is true, if participantJid is existing in the group. message : response message |
#
Get Group Members from LocalTo get group member from local DB, call below method.
- Swift
- Objective-C
Argument | Type | Description |
---|---|---|
groupJid | String | jid of the group |
Returns | Type | Description |
---|---|---|
(participantDetailArray : [GroupParticipantDetail] , message : String) | Tuple ([GroupParticipantDetail] ,String) | [GroupParticipantDetail] array of participant detail. message : response message |
#
Send Typing StatusTo send typing status, while a member composing a message in group, call below method.
- Swift
- Objective-C
Argument | Type | Description |
---|---|---|
groupJid | String | jid of the group |
completionHandler | FlyCompletionHandler | callback : implemented as closure expression |
#
Send Typing Gone StatusTo send Gone status, when a member stops composing a message in group, call below method.
- Swift
- Objective-C
Argument | Type | Description |
---|---|---|
groupJid | String | jid of the group |
completionHandler | FlyCompletionHandler | callback : implemented as closure expression |