sendLocationMessage method

dynamic sendLocationMessage(
  1. Profile profile,
  2. double latitude,
  3. double longitude,
  4. BuildContext context,
)

Implementation

sendLocationMessage(Profile profile, double latitude, double longitude,
    BuildContext context) async {
  var busyStatus = !profile.isGroupProfile.checkNull()
      ? await Mirrorfly.isBusyStatusEnabled()
      : false;
  if (!busyStatus.checkNull()) {
    var replyMessageId = Constants.emptyString;
    if (isReplying.value) {
      replyMessageId = replyChatMessage.messageId;
    }
    isReplying(false);

    Mirrorfly.sendLocationMessage(
            profile.jid.toString(), latitude, longitude, replyMessageId)
        .then((value) {
      mirrorFlyLog("Location_msg", value.toString());
      ChatMessageModel chatMessageModel = sendMessageModelFromJson(value);
      chatList.insert(0, chatMessageModel);
      scrollToBottom();
    });
  } else {
    //show busy status popup
    messageObject = MessageObject(
        toJid: profile.jid.toString(),
        replyMessageId: (isReplying.value) ? replyChatMessage.messageId : Constants.emptyString,
        messageType: Constants.mLocation,
        latitude: latitude,
        longitude: longitude);
    if (context.mounted) showBusyStatusAlert(disableBusyChatAndSend, context);
  }
}