Callback listeners

Observe Profile events Individually#

To observe profile related events, refer the below listeners where ever needed

Contacts Profiles Fetched#

If the client application has mobile number as the primary identifier of the user and enabled contact sync they can fetch their contacts data and its completion is triggered in the following callbacks.

Mirrorfly.usersProfilesFetched.listen((event){
//true profiles fetched is success.
});

User blocked you#

If a user blocked you then the following method will be triggered.

Mirrorfly.userBlockedMe.listen((event){
var data = json.decode(event.toString());
var jid = data["jid"];
//jid will be user's Jid who blocked you
});

User unblocked you#

If a user unblocked you then the following method will be triggered.

Mirrorfly.userUnBlockedMe.listen((event){
var data = json.decode(event.toString());
var jid = data["jid"];
//jid will be user's Jid who unblocked you
});

User Updated his profile#

If a user updated his profile then the following method will be triggered.

Mirrorfly.userUpdatedHisProfile.listen((event){
var data = json.decode(event.toString());
var jid = data["jid"];
//jid will be user's Jid who updated his profile
});

User Deleted his profile#

If a user deleted his profile then the following method will be triggered.

Mirrorfly.userDeletedHisProfile.listen((event){
var data = json.decode(event.toString());
var jid = data["jid"];
//jid will be user's Jid who deleted his profile
});

My Profile update status#

Once you initiated the update for your profile its status will be triggered by the following method.

Mirrorfly.myProfileUpdated.listen((event){
//if true profile update is succes else profile update failed
});

Users blocked me list callback#

When called to get the users who blocked me then the following method will be triggered.

Mirrorfly.usersWhoBlockedMeListFetched.listen((onMessageReceived){
var data = json.decode(event.toString());
var jidlist = data["jidlist"];
//jidList will be list of user's Jid who blocked you
});

Users I blocked list callback#

When called to get the users who i blocked then the following method will be triggered.

Mirrorfly.usersIBlockedListFetched.listen((event){
var data = json.decode(event.toString());
var jidlist = data["jidlist"];
//jidList will be list of user's Jid who i blocked
});

User profile fetched#

When called to get the profile detatil of a user from the server then the following method will be triggered.

Mirrorfly.userProfileFetched.listen((event){
var data = json.decode(event.toString());
var jid = data["jid"];
var profileDetails = data["profileDetails"];
//profileDetails of the requested user
});

Block a user#

When called to block a user then the following method will be triggered.

Mirrorfly.blockedThisUser.listen((event){
var data = json.decode(event.toString());
var jid = data["jid"];
//jid will be user's Jid who i blocked just now
});

UnBlock a user#

When called to unblock a user then the following method will be triggered.

Mirrorfly.unblockedThisUser.listen((event){
var data = json.decode(event.toString());
var jid = data["jid"];
//jid will be user's Jid who i unblocked just now
});

Admin blocked#

When Admin blocked then the following method will be triggered

Mirrorfly.onAdminBlockedUser.listen((event){
var data = json.decode(event.toString());
var jid = data["jid"];
var status = data["status"];
//You logged out of chat sdk update the UI
});

Admin blocked others#

When Admin blocked then the following method will be triggered

Mirrorfly.onAdminBlockedOtherUser.listen((event){
var data = json.decode(event.toString());
var jid = data["jid"];
var type = data["type"];
var status = data["status"];
//You logged out of chat sdk update the UI
});

Contact Sync Completed#

When Contact Sync completes then the following method will be triggered

Mirrorfly.onContactSyncComplete.listen((event){
});

Observe Profile events Collectively#

Assign the listener to the appropriate class to receive event updates. Extend the class and implement the necessary event listeners collectively for streamlined integration you can register your own listener by using the below method.

tip

There can be only one message listener at a time, if you set multiple times using the below method it will replace the old listener always.

Mirrorfly.setProfileEventListener(YourClass());
class YourClass extends ProfileEventListeners{
@override
void blockedThisUser(String userJid) {
// TODO: implement blockedThisUser
}
@override
void myProfileUpdated() {
// TODO: implement myProfileUpdated
}
@override
void onAdminBlockedOtherUser(String jid, String chatType, String isBlocked) {
// TODO: implement onAdminBlockedOtherUser
}
@override
void onAdminBlockedUser(String jid, String isBlocked) {
// TODO: implement onAdminBlockedUser
}
@override
void onContactSyncComplete(bool isSuccess) {
// TODO: implement onContactSyncComplete
}
@override
void unblockedThisUser(String jid) {
// TODO: implement unblockedThisUser
}
@override
void userBlockedMe(String jid) {
// TODO: implement userBlockedMe
}
@override
void userDeletedHisProfile(String jid) {
// TODO: implement userDeletedHisProfile
}
@override
void userProfileFetched(String jid, ProfileData profileData) {
// TODO: implement userProfileFetched
}
@override
void userUnBlockedMe(String jid) {
// TODO: implement userUnBlockedMe
}
@override
void userUpdatedHisProfile(String jid) {
// TODO: implement userUpdatedHisProfile
}
@override
void usersIBlockedListFetched(List<String> jidList) {
// TODO: implement usersIBlockedListFetched
}
@override
void usersProfilesFetched() {
// TODO: implement usersProfilesFetched
}
@override
void usersWhoBlockedMeListFetched(String jidList) {
// TODO: implement usersWhoBlockedMeListFetched
}
}