Profile module

Get User profile data#

To get the profile data of a user(not a group) call the below method.

Mirrorfly.getUserProfile(jid,[fromserver,saveasfriend]).then((value) {
var data = profileDataFromJson(value);
}).catchError((onError) {
/* Error handling */
});

Refer this doc to know more about ProfileData Class

ArgumentTypeDescription
jidStringJid of the user
fromserverbooleantrue to fetch from server
saveasfriendbooleanif true the user will be saved as friend and will be available in contact list

Update User profile#

To update your profile call the below method.

Mirrorfly.updateMyProfile(name, email, mobile, status,image).then((value) {
var data = profileUpdateFromJson(value);
/* Profile image updated. Update the UI */
}).catchError((error) {
/* Error handling */
});
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.

Refer this doc to know more about Profile Class

ArgumentData typeDescription
nameStringname of the user
emailStringemail id of the user
mobileStringmobile number of the user
statusStringstatus of the user
imageStringimage url of the user

Update profile image#

To update your profile image call the below method.

Mirrorfly.updateMyProfileImage(imagePath).then((value) {
var data = json.decode(value);
var imageUrl = data['data']['image'];
//Profile image Updated. Update the UI
}).catchError((onError) {
/* Error handling */
});
ArgumentTypeDescription
imagePathStringfile path of the profile image
info

To fetch the image use {"Authorization": 'token'} in http header. if you get 401 error on fetching then call below method to refresh auth token and update the header. initialy you will get the token from registration response.

Refresh token for Profile image#

To refresh token for profile image call the below method.

Mirrorfly.authToken().then((String? value) {
if (value!=null){
//refech the image with this new Token Profile image. Update the UI
}
}).catchError((onError) {
//auth token refresh failed print throwable to find the exception details
});

Remove profile image#

To remove your profile image call the below method.

Mirrorfly.removeProfileImage().then((bool? value) {
if (value!=null){
//Profile image removed. Update the UI
}
}).catchError((onError) {
//Removing profile image failed print throwable to find the exception details
});

All the contact related operation will be found below.#

Block a User#

To block a user call the below method.

Mirrorfly.blockUser(userJID).then((value) {
if (value!=null){
//Update the UI
}
}).catchError((onError) {
});
ArgumentTypeDescription
userJIDStringJID of the user to Block

Unblock a User#

To unblock a user who is blocked already call the below method.

Mirrorfly.unblockUser(userJID).then((bool? value) {
if (value!=null &&){
//Update the UI
}
}).catchError((onError) {
});
ArgumentTypeDescription
userJIDStringJID of the user to unBlock
caution

Blocking and Unblocking valid for Single chat user only not for Group/Broadcast.

Get user profiles that you blocked#

To get the list of chat user profiles that you blocked call the below method.

Mirrorfly.getUsersIBlocked(server).then((value) {
if (value!=null){
var list = memberFromJson(value);
//Update the UI
}
}).catchError((onError) {
});
ArgumentTypeDescription
serverbooleantrue to get the synced list from server false to get the list from local data.

Note : To make server call internet connection is required

Get current User busy status#

User can get their current user busy status using the below method.

Mirrorfly.getMyBusyStatus().then((value){
var userBusyStatus = json.decode(value);
var status = userBusyStatus["status"];
// Update UI
}).catchError((er){
// Error handling
});

Get the list of User saved profile statuses#

User can get their list of previously saved user statuses by calling the below method.

Mirrorfly.getProfileStatusList().then((value){
if (value != null) {
var profileStatus = statusDataFromJson(value.toString());
// Status List
}
}).catchError((er){
// Error handling
});
info

This list also contains some pre defined values.

Insert User Default Status#

User can insert the default status to get status list from getProfileStatusList().

Mirrorfly.insertDefaultStatus(status).then((value){
}).catchError((er){
// Error handling
});
ArgumentTypeDescription
statusStringStatus text cannot be longer than 140 characters

Set User status#

User can set the status for their profile using the below method.

Mirrorfly.setMyProfileStatus(status,statusId).then((value){
var data = json.decode(value.toString());
// Status Set
}).catchError((er){
// Error handling
});
ArgumentTypeDescription
statusStringStatus text cannot be longer than 140 characters
statusIdStringid of the Status

Get the list of User saved busy statuses#

User can get their list of previously saved user busy statuses by calling the below method.

Mirrorfly.getBusyStatusList().then((value){
var busyStausList = statusDataFromJson(value);
}).catchError((er){
// Error handling
});
info

This list also contains some pre defined values.

Set User Busy status#

User can set the busy status message for their one to one chat conversation using the below method.

Mirrorfly.setMyBusyStatus(busyStatus).then((bool? value){
}).catchError((er){
// Error handling
});
ArgumentTypeDescription
busyStatusStringbusy status text cannot be longer than 140 characters

Enable/Disable User Busy status#

User can enable and disable their busy status using the below method.

Mirrorfly.enableDisableBusyStatus(enable).then((bool? value){
}).catchError((er){
// Error handling
});
ArgumentTypeDescription
enablebooleantrue enables busy status and false disables busy status

Check User Busy status is enabled#

User can check whether their busy status is enabled or disabled.

bool? busyStatus = await Mirrorfly.isBusyStatusEnabled();

Delete a user Status#

User can delete their user status by calling the below method.

Mirrorfly.deleteProfileStatus(id,status,isCurrentStatus).then((bool? value){
}).catchError((er){
// Error handling
});
ArgumentTypeDescription
idStringid from the profile status
statusStringstatus from the profile status
isCurrentStatusboolisCurrentStatus from the profile status
caution

User cannot delete a status which is currently selected.

Delete a user Busy Status#

User can delete their busy status by calling the below method.

Mirrorfly.deleteBusyStatus(id,status,isCurrentStatus).then((bool? value){
}).catchError((er){
// Error handling
});
ArgumentTypeDescription
idStringid from the busy status
statusStringstatus from the busy status
isCurrentStatusboolisCurrentStatus from the busy status
caution

User cannot delete a busy status which is currently selected.

Enable disable hide seen status#

Hide 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.

Mirrorfly.enableDisableHideLastSeen(enable).then((bool? value){
}).catchError((er){
// Error handling
});
ArgumentTypeDescription
enablebooleantrue enables the last seen available to friends false disables it

Check last seen status#

To check whether last seen status is available to friends or not, call the below method.

bool? isHided = await Mirrorfly.isHideLastSeenEnabled();