Users

User List#

To retrive all registered users on MirrorFly Plugin use below method. User list can also be retrived based on search key word, also this method supports pagination. This function will return the total number of pages.

warning

User presence and Profile instant update will not happen until a messege is sent to that particular user.

Mirrorfly.getUserList(page, search, [perPageResultSize]).then((data){
var item = userListFromJson(data);
}).catchError((error) {
});

Refer this doc to know more about Profile Details Class

ArgumentTypeDescription
pageintPage number of user list
perPageResultSizeintNumber of users per page as an optional param default value 20
searchStringtext characters for which search has to happen default value empty

Sync Contact#

warning

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 Plugin 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 enableMobileNumberLogin in Mirrorfly.initializeSDK()

Mirrorfly.syncContacts(isFirstTime);
ArgumentTypeDescription
isFirstTimebooleantrue for first time and false after when synchronising contacts

To observe contact sync complete event use this below Method.

Mirrorfly.onContactSyncComplete.listen(event){
};

To avoid unnecessay multiple contact sync calls get the status of the contact sync beore calling syncContacts.

var syncIsProgress = await Mirrorfly.contactSyncStateValue();

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.

Mirrorfly.getRegisteredUsers(server).then((value) {
}).catchError((onError) {
/* Error handling */
});

Refer this doc to know more about ProfileDetails Class

ArgumentDescriptionData type
serverbooleantrue to fetch from server

Revoke Contact Sync#

If mobile number is used as a primary id for communication in chat Plugin and contact sync have been completed then the following code block will delete user contacts and revoke the contact sync.

Mirrorfly.revokeContactSync().then((value) {
}).catchError((onError) {
/* Error handling */
});