User Presence

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.setLastSeenVisibility(enable: ENABLE_LAST_SEEN, flyCallBack: (FlyResponse response) {
if (response.isSuccess) {
// Last seen status updated successfully
} else {
// updation failed print throwable for more info
}
});
ArgumentTypeDescription
ENABLE_LAST_SEENbooleantrue enables the last seen available to friends false disables it
flyCallbackFlyResponsecallback to observe the action status

Check hide last seen status#

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

bool isLastSeenVisible = await Mirrorfly.isLastSeenVisible();

Get Last seen time of a user#

if you want to get the last seen time for the chat user, you can utilise the below method.

Mirrorfly.getUserLastSeenTime(jid: profile.jid.toString(), flyCallBack: (FlyResponse response) {
if(response.isSuccess && response.hasData){
if(response.data == "0"){
// user is ONLINE
}else{
//Convert time stamp into DateTime
//DateTime lastSeen = DateTime.fromMillisecondsSinceEpoch(int.parse(response.data), isUtc: true);
}
}
}}
ArgumentTypeDescription
JIDStringjid of the chat user
flyCallbackFlyResponsecallback to observe the action status

Note : This method return to the timestamp value 0 means ONLINE otherwise you need to convert to the timestamp value based on your timezone.