sendLocationMessage method
dynamic
sendLocationMessage(
- ProfileDetails profile,
- double latitude,
- double longitude,
- BuildContext context,
Implementation
sendLocationMessage(ProfileDetails 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.sendMessage(
messageParams: MessageParams.location(
toJid: profile.jid.checkNull(),
replyMessageId: replyMessageId,
topicId: topicId,
locationMessageParams: LocationMessageParams(
latitude: latitude, longitude: longitude)),
flyCallback: (response) {
if (response.isSuccess) {
mirrorFlyLog("location message", response.data.toString());
scrollToBottom();
updateLastMessage(response.data);
} else {
LogMessage.d("sendMessage", response.errorMessage);
}
});
} 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);
}
}