Set/Update User Profile Data

ProfileDetails#

Every single chat contact has been modelled after ProfileDetails class. It holds the data of a user name, display picture, whether you blocked them or not etc. Refer this doc to know more about ProfileDetails Class .

Update your profile info#

To update your profile call the below method.

    ContactManager.shared.updateMyProfile(PROFILE_OBJECT){ isSuccess, flyError, flyData in
    if isSuccess {
    // Profile updated successfully update the UI
    } else{
    print(flyError!.localizedDescription)
    }
    }
    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.

    ArgumentTypeDescription
    PROFILE_OBJECTProfileProfile object which the updated value
    CALLBACKFlyCallbackFlyCallback implemented as as lambda expression

    Update profile image#

    To update your profile image call the below method.

      ContactManager.shared.updateMyProfileImage(IMAGE){ isSuccess, flyError, flyData in
      if isSuccess {
      // Profile Image updated successfully update the UI
      } else{
      print(flyError!.localizedDescription)
      }
      }
      ArgumentTypeDescription
      IMAGEStringImageURL of the profile image, URL can be local path or remote url
      CALLBACKFlyCompletionHandlerFlyCompletionHandler used as completion Handler

      Remove Profile Image#

      To remove your profile image call the below method.

        ContactManager.shared.removeProfileImage(){ isSuccess, flyError, flyData in
        if isSuccess {
        // Profile Image removed successfully update the UI
        } else{
        print(flyError!.localizedDescription)
        }
        }
        ArgumentTypeDescription
        CALLBACKFlyCompletionHandlerFlyCompletionHandler used as completion Handler

        Create user profile status#

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

          ChatManager.saveProfileStatus(STATUSTEXT,CURRENTSTATUS)
          ArgumentTypeDescription
          STATUSTEXTStringstatusText of the current status
          CURRENTSTATUSBoolcurrentStatus of the selected status

          Update user profile status#

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

            let (status, statusMessage) = ChatManager.updateStatus(STATUSID,STATUSTEXT,CURRENTSTATUS)
            ArgumentTypeDescription
            STATUSIDStringstatusId of the status
            STATUSTEXTStringstatusText of the current status
            CURRENTSTATUSBoolcurrentStatus of the selected status

            Enable/Disable User Busy status#

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

              ChatManager.shared.enableDisableBusyStatus(ENABLE_BUSY_STATUS)
              ArgumentTypeDescription
              ENABLE_BUSY_STATUSBooltrueenables busy status and false disables busy status

              Set User Busy status#

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

                ChatManager.shared.setMyBusyStatus(BUSY_STATUS_TEXT)
                ArgumentTypeDescription
                BUSY_STATUS_TEXTStringbusy status text cannot be longer than 140 characters

                Delete a user Busy Status#

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

                  ChatManager.shared.deleteBusyStatus(statusId: STATUS_ID)
                  ArgumentTypeDescription
                  STATUS_IDStringObject of the user busy status that has to be deleted
                  caution

                  User cannot delete a busy status which is currently selected.