sendImageMessage method
dynamic
sendImageMessage(
- String? path,
- String? caption,
- String? replyMessageID,
- BuildContext context,
Implementation
sendImageMessage(String? path, String? caption, String? replyMessageID,
BuildContext context) async {
debugPrint("Path ==> $path");
var busyStatus = !profile.isGroupProfile.checkNull()
? await Mirrorfly.isBusyStatusEnabled()
: false;
if (!busyStatus.checkNull()) {
if (isReplying.value) {
replyMessageID = replyChatMessage.messageId;
}
isReplying(false);
if (File(path!).existsSync()) {
return Mirrorfly.sendImageMessage(
profile.jid!, path, caption, replyMessageID)
.then((value) {
clearMessage();
ChatMessageModel chatMessageModel = sendMessageModelFromJson(value);
chatList.insert(0, chatMessageModel);
scrollToBottom();
return chatMessageModel;
});
} else {
debugPrint("file not found for upload");
}
} else {
//show busy status popup
messageObject = MessageObject(
toJid: profile.jid.toString(),
replyMessageId: (isReplying.value) ? replyChatMessage.messageId : Constants.emptyString,
messageType: Constants.mImage,
file: path,
caption: caption);
if (context.mounted) showBusyStatusAlert(disableBusyChatAndSend, context);
}
}