Group chat modules
Groups is the simplest way to chat with multiple user at any given time.
#
Create GroupTo create a group call the below method.
Argument | Type | Description |
---|---|---|
groupName | String | Name of the group(cannot be null or empty) |
userJidList | List<String> | List of jids of the member (size cannot be less than 2 excluding group creator) |
imageFilePath | String | file path of the image (can be empty) |
info
There is an overloading method available for createGroup which accepts image as a File path
instead of url id.
caution
If there is no internet or the connection between chat server and the app isn't made create group functionality will be executed and group will be created locally. Until the group is available in server messaging/profile update should be restricted in app side by checking the isGroupInOfflineMode
property
of RecentChat or ProfileDetails class else an exception will be thrown.
#
Group profile Update#
Update group nameUser can able to update group name whenever they want by using the below method.
Argument | Type | Description |
---|---|---|
jid | String | jid of the group |
name | String | new name for the group which has to updated |
#
Update group profile imageUser can able to update group profile image whenever they want by using the below method.
To update group profile image as either file or by using uploaded image id:
Argument | Type | Description |
---|---|---|
jid | String | Jid of the group |
imageFilePath | String | File path of the group profile image |
#
Remove group profile imageUser can able to remove group profile image whenever they want by using the below method.
Argument | Type | Description |
---|---|---|
jid | String | Jid of the group |
caution
If there is no internet or the connection between chat server and the app isn't made group update functionality will be executed locally once the connection is restored it will be updated for other group members and in the server.
#
Get profile dataTo get the detail of a group call the below method.
Arguments | Type | Description |
---|---|---|
groupJid | String | Jid of the group |
fromServer | bool | if true fetches data from the server else from local database |
#
Get all GroupsTo fetch all the groups in which you are member of call the below method.
caution
Need to call getAllGroups atlas once after user login so that the all the groups info will be fetched and saved in local DB else no group related data will be available.
Argument | Type | Description |
---|---|---|
fromServer | bool | if true fetches data from the server else fetches data from local database |
#
Get Group MembersTo fetch all the groups members of a group call the below method.
caution
Fetching group members from a server will be called internally when required. So , unless it was necessary set false
for getServerData.
Argument | Type | Description |
---|---|---|
groupJid | String | Jid of the group |
fromServer | bool | if true fetches data from the server else fetches data from local database |
#
Check User is a memberTo check whether a user of a given jid is a member of the group
Argument | Type | Description |
---|---|---|
groupJID | String | Jid of the group |
userJid | String | Jid of the user |
#
Add user to GroupTo add users to a group call the below method.
Argument | Type | Description |
---|---|---|
grouJID | String | Jid of the group |
userList | List<String> | Jid list of the new users |
#
Remove a group memberTo remove a user from group call the below method.
Argument | Type | Description |
---|---|---|
grouJID | String | Jid of the group |
userList | String | Jid of the user who is going to be removed |
#
Make participant as adminUser can able to make some participant of the group as a admin to the group. The below method can be used to make someone as admin. only admins can perform this action
Argument | Type | Description |
---|---|---|
grouJID | String | jid of the group |
adminJid | String | jid of the group participant |
#
Check group adminUser can able to check some participant of the group is a admin or not to the group.
The below method can be used to check someone admin or not.The below method will return true
if userJid
is admin for the provided groupJid
.
Argument | Type | Description |
---|---|---|
grouJID | String | Jid of the group |
userJid | String | Jid of the group participant |
#
Group messagingGroup messaging is very similiar to the single chat messaging. Instead of giving single chat jid , you need to provide group jid. if you don't have group jid, you can prepare that using the above method by giving group id.
Refer this doc for group messaging
#
Message Delivered listTo get the list of users to whom a message was successfully delivered call the below method.
Refer this doc to know more about MessageStatusDetail Class
info
Only messages sent by the current user will have the options to get delivered and read list.
Argument | Type | Description |
---|---|---|
messageId | String | Id of a group message |
#
Message Read listTo get the list of users whom are read/seen the message call the below method.
info
Only messages sent by the current user will have the options to get delivered and read list.
Argument | Type | Description |
---|---|---|
messageId | String | Id of a group message |
#
Leave from a groupTo leave from a group in which you are a member call the below method.
Argument | Type | Description |
---|---|---|
grouJID | String | Jid of the group |
#
Delete a groupTo delete a group locally call the below method.
warning
Deleting a group only delete the group data locally its doesn't delete the group in the server or to other users.
Argument | Data type | Description |
---|---|---|
grouJID | String | Jid of the group |