Get a User List
#
User ListTo retrive all registered users on MirrorFly SDK use below method. User list can also be retrived based on search key word, also this method supports pagination. This function will return total page of users.
warning
User presence and Profile instant update will not happen until a messege is sent to that particular user.
Refer this doc to know more about Profile Details Class
Argument | Type | Description |
---|---|---|
PAGE_NUMBER | int | Page number of user list default value 1 |
PER_PAGE_RESULT_SIZE | int | Number of users per page default value 50 |
SEARCH_TERM | String | text characters for which search has to happen default value empty |
META_DATA | MetaDataUserList | model class which filters the results by metadata default value is empty |
CALLBACK | FlyCompletionHandler | FlyCompletionHandler used as completion Handler |
#
Sync Contactwarning
It will be only applicable for mobile number registration and contact book synchronization.
If mobile number is used as a primary id for communication in chat sdk then there has to be sync between user and server. The following code block initiate the contact sync and let the user communicate with their contacts who uses the client app too.
Note : In order to sync mobile contacts need to enable Contact syncing using
ChatManager.enableContactSync()
method
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.
Once contact sync is completed successfully, ContactManager.shared.getRegisteredUsers()
method will be called internally to fetch the profile data of the
phone contacts.
Note : Remove the Observer for Contact Sync properly to avoid memory leaks.
#
Get Registered UsersNote : The registered contacts who are in your contacts will retrieved after the contact sync, those people's only observe your profile,user presence updates.
Once we started communicating , we can get the list of contact with chat data with whom we communicated so far.
Refer this doc to know more 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 |
caution
FlyCompletionHandler
which is used as a callback for most of the i/o operation is being expressed as lambda expression for easy reading.