MesiboProfile

Estimated reading time: 7 minutes

MesiboProfile/MesiboSelfProfile methods

The following methods are available in the MesiboProfile class to access and modify a profile. MesiboSelfProfile is a derived class of MesiboProfile.

toggleArchive

Enable or disable whether a profile is to be archived.

mMesiboProfile.toggleArchive();

isArchieved

Returns true if profile is archieved, false otherwise.

mMesiboProfile.isArchieved();

toggleMute

Enable or disable profile updates. If you mute, you will not be notified when that profile is updated.

mMesiboProfile.toggleMute();

isMuted

Returns true if a profile is muted, false otherwise.

mMesiboProfile.isMuted();

isSelfProfile

Returns true if it is your own profile, false otherwise.

mMesiboProfile.isSelfProfile();

isBlocked

Returns true if a profile has been blocked, false otherwise. If a profile has been blocked, you will not be notified if that profile is updated.

mMesiboProfile.isBlocked();

setHidden

Make the visibility of your profile to hidden. If a profile has been hidden, it will not be visible to other users. ie; No one other than you will be able to view the profile details.

Takes the following parameter:

  • enable, Pass true to hide the profile, false to unhide it
mMesiboProfile.setHidden(True);

blockMessages

Enable or disable blocking of messages from a user/group with this profile. If you block messages from a profile, that user will not be able to send you messages.

Takes the following parameter:

  • enable, Pass true to enable blocking, false otherwise
mMesiboProfile.blockMessages(True);

setName

Set the profile name. If it is your self profile, if you set the name and sync it, it will be updated globally. If it is other’s profile, name will have local priority - the name you set here will be updated locally.

Takes the following parameter:

  • name, String
mMesiboProfile.setName("Alice");

getName

Gets the profile name.

String name = mMesiboProfile.getName();

setStatus

Set profile status. The profile status/bio is text that is typically displayed on a profile.

Takes the following parameter:

  • status, String
mMesiboProfile.setStatus("Hello, I am using App");

getStatus

Returns the profile status.

mMesiboProfile.getStatus()

setInfo

Set profile information.

Takes the following parameter:

  • info, String
mMesiboProfile.setInfo("This is profile info");

getInfo

Returns profile information

String info = mMesiboProfile.getInfo();

setImage

Set the image bitmap

Takes the following parameter:

  • bitmap, Bitmap object
mMesiboProfile.setImage(imageBitmap);

setImageFromFile

Set the image from a path to file

Takes the following parameter:

  • bitmap, Bitmap object
mMesiboProfile.setImageFromFile("/path/to/file");

getImage

Returns the profile image.

Bitmap photo = mMesiboProfile.getImage();

getImageOrThumbnail

Returns the profile bitmap or thumbnail.

Bitmap photo = mMesiboProfile.getImageOrThumbnail();

getImageOrThumbnailPath

Returns the profile bitmap or thumbnail path.

String path = mMesiboProfile.getImageOrThumbnailPath();

setImageUrl

Set the local path(remote path, if photos are not downloaded onto the local device, but loaded directly from the remote server) to load photos from.

Takes the following parameter:

  • file url, File url(on the server) where the photo is stored

getImageUrl

Returns the picture path

String path = mMesiboProfile.getImageUrl();

getThumbanil

Returns the image thumbnail

Bitmap tn = mMesiboProfile.getThumbnail();

setCustomProfile

Set this profile as a custom profile for a user.

Takes the following parameter:

  • other
mMesiboProfile.setCustomProfile("123");

getCustomProfile

Returns Custom profile user

String other = mMesiboProfile.getCustomProfile();

setDraft

Set a value, in draft mode. When a user is editing a profile, you can use this to temprarily save the value in draft.

Takes the following parameter:

  • value, Draft value
mMesiboProfile.setDraft("draft value");

getDraft

Returns draft value

String val = mMesiboProfile.getDraft();

isDeleted

Returns true if profile has been deleted, false otherwise.

if(mMesiboProfile.isDeleted()){
    // Profile deleted. Cleanup
} 

hasProfile

Returns true if this user has a global profile. If a user does not have a global profile, it means a MesiboProfile object has been created locally and it doesn’t exist on the server.

if(mMesiboProfile.hasProfile()){
  // Has a global profile.
}

enableSync

Enable or disable profile sync.

Takes the following parameter:

  • enable, Pass true to enable sync, false otherwise

If sync is enabled on a self profile, then changes that you make for the self profile will be synced onto the server and other users who have subscribed to your profile will be notified. Changes will stay local, if sync is disabled.

If sync is disabled on a local profile, then you will be notified when the profile is updated on the server.

mMesiboProfile.enableSync(True);

hasUpdate

Check if the profile that you have is the latest one, by comparing it to the one on the server. If the profile is stale, then hasUpdate returns true and you can sync the profile.

if(mMesiboProfile.hasUpdate()){
   // Need to sync 
}

subscribe

Subscribe to a profile to be notified of updates to the profile

mMesiboProfile.subscribe()

You will now be notified through Profile Listeners whenever the profile is update on the server.

publish

Use the publish method to publish your self profile onto the server.

Takes the following parameters:

  • visibility, Pass true to make the profile visible. Others users can get your profile using your address. If you want to make your profile invisible to others, pass false.
  • forced, Pass to true to force update the profile
mMesiboProfile.publish(True, False)

addListener

Add a MesiboProfile.Listener to be notified of updates to this profile. See Profile Listeners

mMesiboProfile.addListener(mListenerInstance);

removeListener

Remove MesiboProfile.Listener that was added using addListener

mMesiboProfile.removeListener(mListenerInstance);

save

Save the profile locally.

mMesiboProfile.save()

isDeleted

Returns true if profile is deleted, false otherwise

removeLocalProfile

Remove saved profile. Profile details at global level will now be available. Any modifications you made locally will be undone.

remove

Remove the profile completely

removeSyncedProfile

Remove the original profile. Only profile details set at local level will now be available.

profile