Other chat features

Delete local media file#

To enable/disable the deletion of the associated media file in the app's document folder when we delete a media message call the below method.

ChatManager.deleteMediaFromDevice(delete: DELETE_MEDIA)
ArgumentTypeDescription
DELETE_MEDIABoolMaximum amount of a recent chat that can be pinned

Hide Notification Content#

To be in Compliance with Hipaa and other Security guidelines, sdk provides method to hide the title and content of the push notifations. By calling the below method we can hide the notification content.

ChatManager.hideNotificationContent(hide: HIDE)
ArgumentTypeDescription
HIDEBoolif true content will be hidden and shown as New Message

Process Video#

Slow motion videos captured by iOS devices has to be processed before sending a video message to support cross-platform messaging. For normal video nothing will be processed and it's URL will be returned in completion handler. Call the below method to process a video.

MediaUtils.processVideo(PHASSET) { PHASSET, STATUS, PROCESSED_VIDEO_URL, IS_SLOMO_VIDEO in
switch STATUS {
case.processing:
case.success:
case.failed:
}
}
ArgumentTypeDescription
PHASSETPHAssetPHAsset file object
VariableTypeDescription
PHASSETPHAssetPHAsset file object to be processed
STATUSMediaStatusan enum type to reflect status of the processing
PROCESSED_VIDEO_URLURLURL of the video
IS_SLOMO_VIDEOBooleantrue if it's a slomo video

Compress Image#

To compress and get the metadata of an image call the below method.

MediaUtils.compressImageFile(DATA,MEDIA_QUALITY) {IS_SUCCESS, DATA, FILENAME ,URL, FILEKEY, FILESIZE, ERRORMESSAGE in }
ArgumentTypeDescription
DATADataData of the uncompressed image to be compressed
MEDIA_QUALITYMediaQualityOutput quality of the compressed image
COMPLETION_HANDLER(Bool,Data?,String,URL?,String, Double, String?)tuple completion handler
VariableTypeDescription
IS_SUCCESSBooleantrue if compression is success else false
DATADataData of the compressed image
FILENAMEStringname of the compressed image
URLURLURL of the compressed image
FILEKEYBooleankey of the compressed ecnrypted image if encryption is enabled
FILESIZEDoubleSize of the compressed image in bytes
ERRORMESSAGEStringError reason message for the processing failure

Note : Default media quality for Image compression is medium.

info

MediaUtils.compressImage() method was deprecated and will be removed in the future releases, migrate to above method to process Image files.

Compress Video#

To compress and get the metadata of a video call the below method.

MediaUtils.compressVideoFile(PROCESSED_VIDEO_URL,MEDIA_QUALITY) {IS_SUCCESS, URL, FILENAME, FILEKEY, FILESIZE , DURATION, ERRORMESSAGE in }
ArgumentTypeDescription
PROCESSED_VIDEO_URLDataURL of the video to be compressed
MEDIA_QUALITYMediaQualityOutput quality of the compressed video
COMPLETION_HANDLER(Bool, URL?, String, String, Double, Double, String)tuple completion handler
VariableTypeDescription
IS_SUCCESSBooleantrue if compression is success else false
URLURLURL of the compressed video
FILENAMEStringName of the compressed video file
FILEKEYStringkey of the compressed ecnrypted video if encryption is enabled
FILESIZEDoubleSize of the compressed video in bytes
DURATIONDoubleDuration of the compressed video
ERRORMESSAGEStringError reason message for the processing failure

Note : Default media quality for video compression is medium.

info

MediaUtils.compressVideo() method was deprecated and will be removed in the future releases, migrate to above method to process video files.

Process Audio#

To process and get the metadata of an audio file call the below method.

MediaUtils.processAudioFile(AUDIO_URL,MAX_SIZE) {IS_SUCCESS, FILENAME, SAVED_FILE_URL, FILESIZE , DURATION, FILEKEY, ERRORMESSAGE in }
ArgumentTypeDescription
AUDIO_URLURLURL of the audio asset file to be processed
MAX_SIZEDoublevalidation size for maximum audio file size(default 30MB)
COMPLETION_HANDLER(Bool, String,URL?, Double, Double, String, String)tuple completion handler
VariableTypeDescription
IS_SUCCESSBooleantrue if processing is success else false
FILENAMEStringName of the processed audio file
SAVED_FILE_URLURLURL of the processed and saved audio file
FILESIZEDoubleSize of the processed audio in bytes
DURATIONDoubleDuration of the processed audio
FILEKEYStringKey of the processed ecnrypted audio if encryption is enabled
ERRORMESSAGEStringError reason message for the processing failure
info

MediaUtils.processAudio() method was deprecated and will be removed in the future releases, migrate to above method to process audio files.

Process Document#

To process and get the metadata of a document file call the below method.

MediaUtils.processDocumentFile(DOCUMENT_URL,MAX_SIZE) {IS_SUCCESS, SAVED_FILE_URL, FILESIZE , FILENAME, FILEKEY, ERRORMESSAGE in }
ArgumentTypeDescription
DOCUMENT_URLURLURL of the document file to be processed
MAX_SIZEDoublevalidation size for maximum Document file size(default 20MB)
COMPLETION_HANDLER(Bool, URL?,Double,String,String,String)tuple completion handler
VariableTypeDescription
IS_SUCCESSBooleantrue if processing is success else false
SAVED_FILE_URLURLURL of the processed and saved document file
FILESIZEDoubleSize of the processed document in bytes
FILENAMEStringName of the processed document file
FILEKEYStringKey of the processed ecnrypted document if encryption is enabled
ERRORMESSAGEStringError reason message for the processing failure
info

MediaUtils.processDocument() method was deprecated and will be removed in the future releases, migrate to above method to process Document files.

Get MetaData of user#

To get MetaData value of user call the below method.

    ChatManager.getMetaData { (isSuccess, flyError, resultDict) in
    if isSuccess {
    var flydata = resultDict
    print(flydata.getData())
    }else{
    //Getting metaData failed
    }
    }
    ArgumentTypeDescription
    CALLBACKFlyCompletionHandlerFlyCompletionHandler used as completion Handler

    Update MetaData of user#

    To Update MetaData value of user call the below method.

      ChatManager.updateMetaData([MetaData]) { (isSuccess, flyError, resultDict) in
      if isSuccess {
      var flydata = resultDict
      print(flydata.getData())
      }else{
      //Updating metaData failed
      }
      }
      ArgumentTypeDescription
      META_DATA[MetaData]list of key - value pair of metadata object. Maximum size is 3 (optional)
      CALLBACKFlyCompletionHandlerFlyCompletionHandler used as completion Handler