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