insertRecallMessage static method

Message insertRecallMessage({
  1. required Message recalledMessage,
  2. int? timestamp,
})

Implementation

static Message insertRecallMessage({
  required Message recalledMessage,
  int? timestamp,
}) {
  int time = timestamp ?? recalledMessage.serverTime;
  Message alertMsg = Message.createCustomSendMessage(
    targetId: recalledMessage.conversationId!,
    event: alertRecalledKey,
    chatType: recalledMessage.chatType,
    params: {
      alertOperatorIdKey: recalledMessage.from!,
    },
  );
  alertMsg.conversationId = recalledMessage.conversationId;
  alertMsg.serverTime = time;
  alertMsg.localTime = time;
  alertMsg.status = MessageStatus.SUCCESS;

  ChatSDKService.instance.insertMessage(message: alertMsg);
  return alertMsg;
}