Mesibo Profile Customization Listener and Functions

In some situations, you may want to modify or fill in missing profile information. For instance, if a user hasn't uploaded a profile picture, their profile image will be empty. Instead of displaying nothing, you can replace it with a custom image. Similarly, you might need to override the user's name with a name from their phone book based on your app's logic. In this section, we will describe mesibo customization listener and functions.

Mesibo Profile Customization Listener

mesibo offers a listener called MesiboProfileCustomizationListener which gets triggered the first time a profile is accessed. It will be also triggered when your app requires the user's name or image, and these details are missing. Your app can implement and listen to these updates to tailor the profile as needed.

Mesibo.addListener(customizationListener);

This listener has three functions:

Mesibo_onCustomizeProfile

Mesibo_onCustomizeProfile is called when your app accesses the profile for the first time. Here, you may modify the profile object to suit your specific requirements.

You can return true to indicate success, ensuring that this function won't be called again for this profile unless there are changes in the profile. If you're not ready to make immediate changes, perhaps waiting for data from a server, and want mesibo to call it again later, return false. In this case, mesibo will call this function again the next time the profile is accessed.

boolean Mesibo_onCustomizeProfile(MesiboProfile profile){

    profile.setOverrideName("another name");
    return true;
}

Mesibo_onGetProfileName

Mesibo_onGetProfileName is called when your app calls name-related profile functions (e.g., getName, getFirstName) and the name is empty. You can either set the name here or return a name that will be used temporarily. Mesibo provides functions to temporarily change the name without making permanent modifications. Details of these functions are provided later in this document.

String Mesibo_onGetProfileName(MesiboProfile profile){

  return "another name";
}

Mesibo_onGetProfileImage

Mesibo_onGetProfileImage is called when your app invokes image-related profile functions (e.g., getImage, getThumbnail) and the image is empty. You can either set the image and thumbnail here or return an image that will be used as a temporary thumbnail. Mesibo provides functions to temporarily change the image and thumbnail without making permanent adjustments. These functions are explained further in this document.

Example:

Image Mesibo_onGetProfileImage(MesiboProfile profile){

  return someThumbnail;
}

Resetting Customizations

If you want to clear the customizations and have the Mesibo_onCustomizeProfile function called again for all profiles, you can achieve this by using:

Mesibo.resetProfileCustomizations();

Mesibo Profile Customization Functions

While you have the flexibility to use any profile set functions for customizing profiles, mesibo provides a set of specific functions for temporarily modifying profile names and images without making permanent changes. These functions also offer unique features to override the actual profile information or provide backup profile name and images.

Profile Name

Within a Mesibo profile, there are three categories of names:

  • The actual name set by the user.
  • The overridden name set by the app.
  • The temporary name set by the app.

When any name-related functions (e.g., getName) are called, the profile returns the actual name if it hasn't been overridden. However, if an overridden name is present, it will be returned instead of the actual name. This feature allows the app to forcefully change the name, irrespective of any changes made by the user. You can override the name using:

profile.setOverrideName("new name");

The temporary name is used when both the actual and overridden names are empty. You can set the temporary name with:

profile.setTemporaryName("new name");

Profile Image

Similar to the name mentioned above, you can also set a temporary image and thumbnail using:

profile.setImage(image, thumbnail);

If the thumbnail is null, it will be generated from the provided image. Temporary image and thumbnail come into play when the actual image and thumbnail are missing.

These customization functions and listener enable you to dynamically adjust profile information to enhance user experiences. Additionally, mesibo supports profile synchronization to further tailor your application's profile management.