To 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.
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
|PAGE_NUMBER||Page number of user list |
|PER_PAGE_RESULT_SIZE||Number of users per page |
|SEARCH_TERM||text characters for which search has to happen |
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
Note : To access phone contacts add the Privacy - Contacts Usage Description key and proper description for contact access request value, so the
ContactSyncManagerclass can read phone's contacts for syncing.
#Observe Contact Sync
The 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
Note : Remove the Observer for Contact Sync properly to avoid memory leaks.
#Get Registered Users
Note : 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
FlyCompletionHandler which is used as a callback for most of the i/o operation is being expressed as lambda expression for easy reading.