Migration guide

MirrorFly Chat SDK Version 3 has introduced major send message method changes to streamline the code structure and enhance its scalability.

This guide explains step by step guide for migrating to Version 3.

Send Text Message#

Step 1: Below method were deprecated from Version 3, Remove the following method from the code.

    FlyMessenger.sendTextMessage(TO_JID, TEXT, REPLY_MESSAGE_ID, MENTION_IDS){isSuccess,error,message in
    if isSuccess {
    // append message in your array and the update ui
    }
    }

    Step 2: This method is newly introduced from Version 3, Add the following code to send the message.

      var textMessage = TextMessage()
      textMessage.toId = TO_JID
      textMessage.messageText = MESSAGE
      textMessage.replyMessageId = REPLY_MESSAGE_ID // Optional
      textMessage.mentionedUsersIds = MENTION_IDS // Optional
      textMessage.metaData = META_DATA // Optional
      textMessage.topicID = TOPIC_ID // Optional
      FlyMessenger.sendTextMessage(messageParams: messageParams) { isSuccess, error, chatMessage in
      if (isSuccess) {
      // append message in your array and the update ui
      }
      }

      Refer this doc to know more about Send Text Message

      Send File Message#

      Step 1: Below method were deprecated from Version 3, Remove the following method from the code.

      Location Message#

        FlyMessenger.sendLocationMessage(TO_JID, LATITUDE, LONGITUDE, REPLY_MESSAGE_ID){ isSuccess,error,message in
        if isSuccess {
        // append message in your array and the update ui
        }
        }

        Contact Message#

          FlyMessenger.sendContactMessage(TO_JID, CONTACT_NAME, CONTACT_NUMBERS, REPLY_MESSAGE_ID){isSuccess,error,message in
          if isSuccess {
          // append message in your array and the update ui
          }
          }

          Document Message#

            FlyMessenger.sendDocumentMessage(TO_JID, MEDIA_DATA, REPLY_MESSAGE_ID){isSuccess,error,message in
            if isSuccess {
            // append message in your array and the update ui
            }
            }

            Video Message#

              FlyMessenger.sendVideoMessage(TO_JID, MEDIA_DATA, REPLY_MESSAGE_ID, MENTION_IDS){isSuccess,error,message in
              if isSuccess {
              // append message in your array and the update ui
              }
              }

              Image message#

                FlyMessenger.sendImageMessage(TO_JID, MEDIA_DATA, REPLY_MESSAGE_ID, MENTION_IDS){isSuccess,error,message in
                if isSuccess {
                // append message in your array and the update ui
                }
                }

                Audio message#

                  FlyMessenger.sendAudioMessage(TO_JID, MEDIA_DATA,IS_RECORDED,REPLY_MESSAGE_ID)(isSuccess, message) -> {
                  if isSuccess {
                  // append message in your array and the update ui
                  }
                  });

                  Step 2: This method is newly introduced from Version 3, Add the following code to send the file messages.

                    var fileMessageParams = FileMessageParams()
                    fileMessageParams.fileUrl = FILE_URL
                    fileMessageParams.fileName = FILE_NAME
                    fileMessageParams.fileSize = FILE_SIZE
                    fileMessageParams.duration = DURATION
                    fileMessageParams.thumbImage = THUMB_IMAGE
                    fileMessageParams.caption = CAPTION
                    fileMessageParams.fileKey = FILE_KEY
                    var fileMessage = FileMessage()
                    fileMessage.toId = TO_JID
                    fileMessage.messageType = MessageType.video
                    fileMessage.fileMessage = fileMessageParams
                    fileMessage.replyMessageId = REPLY_MESSAGE_ID // Optional
                    fileMessage.mentionedUsersIds = MENTION_IDS // Optional
                    fileMessage.metaData = META_DATA // Optional
                    fileMessage.topicID = TOPIC_ID // Optional
                    FlyMessenger.sendFileMessage(messageParams: fileMessage){ isSuccess,error,message in
                    if (isSuccess) {
                    //you can add this message object to your arraylist,
                    //then you can notify the tableview
                    }
                    }

                    Refer this doc to know more about Send File Messages