Profile module
All the contact related operation will be found below.
#
Contact SyncIf contact sync is enabled in ChatSDK builder,then phone book contacts can be synced with the server by calling the below method. Once the contacts were synced successfully it will let the user communicate with their contacts who uses the client app too.
- Swift
- Objective-C
Argument | Type | Description |
---|---|---|
CALLBACK | FlyCompletionHandler | FlyCompletionHandler used as completion Handler |
Note : To access phone contacts add the Privacy - Contacts Usage Description key and proper description for contact access request value, so the
ContactSyncManager
class can read phone's contacts for syncing.
#
Observe Contact SyncThe progress of contact syncing can be observed using the NotificationCenter using the name of FlyConstants.contactSyncState
. From the notification's userInfo
get the status of the progress using the key FlyConstants.contactSyncState
, which gives a string value which can be used as a raw value
for the enum type ContactSyncState
. The code snippet below shows the show the observer and handling of contact sync progress.
- Swift
- Objective-C
Once contact sync is completed successfully, ContactManager.shared.getFriendsList()
method will be called internally to fetch the profile data of the
phone contacts who are all installed the client app.
Note : Remove the Observer for Contact Sync properly to avoid memory leaks.
#
FriendsThe contacts who are in your contacts after the contact sync is considered as your friends, those people's only observe your profile and presence updates.
#
ProfileDetailsEvery single chat contact has been modelled after ProfileDetails class. It holds the data of a user name, display picture, whether you blocked them or not etc. Refer Class documentation to know about ProfileDetails Class
#
Get Friends ListOnce we started communicating , we can get the list of contact with chat data with whom we communicated so far.
- Swift
- Objective-C
Refer Class documentation to know about ProfileDetails Class
Argument | Type | Description |
---|---|---|
FETCH_FROM_SERVER | Bool | true to fetch from server false will fetch from local database |
CALLBACK | FlyCompletionHandler | FlyCompletionHandler used as completion Handler |
#
Get User profile dataTo get the profile data of a user(not a group) call the below method.
- Swift
- Objective-C
Argument | Type | Description |
---|---|---|
USER_JID | String | Jid of the user |
FETCH_FROM_SERVER | Bool | true to fetch from server false will fetch from local database |
SAVE_AS_FRIEND | Bool | if true the user will be saved as friend and will be available in list of contacts to chat |
CALLBACK | FlyCompletionHandler | FlyCompletionHandler used as completion Handler |
#
Update your profile infoTo update your profile call the below method.
- Swift
- Objective-C
info
In profile object for image property set the absolute file path of a file if a image file needs to be uploaded or else set it to profile image id.
Argument | Description | Data type |
---|---|---|
PROFILE_OBJECT | Profile | Profile object which the updated value |
CALLBACK | FlyCallback | FlyCallback implemented as as lambda expression |
#
Remove Profile ImageTo remove your profile image call the below method.
- Swift
- Objective-C
Argument | Type | Description |
---|---|---|
CALLBACK | FlyCompletionHandler | FlyCompletionHandler used as completion Handler |
#
Enable disable hide seen statusHide Last seen status enables the user's last logged in time unavailable to their friends. To enable or disable the hide last seen status of the user call the below method.
#
Block a UserTo block a user call the below method.
- Swift
- Objective-C
Argument | Type | Description |
---|---|---|
JID_TO_BLOCK | String | JID of the user |
CALLBACK | FlyCompletionHandler | FlyCompletionHandler used as completion Handler |
#
Unblock a UserTo unblock a user who is blocked already call the below method.
- Swift
- Objective-C
Argument | Type | Description |
---|---|---|
JID_TO_UNBLOCK | String | JID of the user |
CALLBACK | FlyCompletionHandler | FlyCompletionHandler used as completion Handler |
caution
Blocking and Unblocking valid for Single chat user only not for Group/Broadcast.
#
Get user profiles that you blockedTo get the list of chat user profiles that you blocked call the below method.
- Swift
- Objective-C
Refer Class documentation to know about ProfileDetails Class
Argument | Description | Data type |
---|---|---|
FETCH_FROM_SERVER | true to fetch from server false will fetch from local database | Bool |
CALLBACK | FlyCompletionHandler | FlyCompletionHandler used as completion Handler |
Note : To make server call internet connection is required
#
Get user profiles that blocked youTo get the list of single chat user that blocked you call the below method.
- Swift
- Objective-C
Refer Class documentation to know about ProfileDetails Class
Argument | Description | Data type |
---|---|---|
FETCH_FROM_SERVER | true to fetch from server false will fetch from local database | Bool |
CALLBACK | FlyCompletionHandler | FlyCompletionHandler used as completion Handler |
Note : To make server call internet connection is required
#
Enable disable hide seen statusHide Last seen status enables the user's last logged in time unavailable to their friends. To enable or disable the hide last seen status of the user call the below method.
- Swift
- Objective-C
Argument | Type | Description |
---|---|---|
EnableLastSeen | Bool | true enables the last seen available to friends false disables it |
CALLBACK | FlyCompletionHandler | FlyCompletionHandler used as completion Handler |
#
Check last seen statusTo check whether last seen status is available to friends or not, call the below method.
- Swift
- Objective-C
#
Get last seen statusTo get whether last seen status is available to friends or not, call the below method.
- Swift
- Objective-C
Argument | Type | Description |
---|---|---|
JID_TO_GETLASTSEEN | String | JID of the user |
CALLBACK | FlyCompletionHandler | FlyCompletionHandler used as completion Handler |
#
Delete My AccountTo delete your chat account call the below method. This will clear your profile,login information and messages(including media files) in the server as well as in your device. No information will be retained after account deletion. And if registration is made again with the same account it will be treated as a new account.
- Swift
- Objective-C
Argument | Type | Description |
---|---|---|
REASON | String | Reason for the account deletion |
FEEDBACK | String | Feedback for tha app if any |
CALLBACK | FlyCompletionHandler | FlyCompletionHandler used as completion Handler |
caution
Once account is deleted the user will be removed from every group in which is he/her is a participant.