insertCreateThreadEventMessage static method
Future<void>
insertCreateThreadEventMessage({
- required ChatThreadEvent event,
- String? creator,
- int? timestamp,
Implementation
static Future<void> insertCreateThreadEventMessage({
required ChatThreadEvent event,
String? creator,
int? timestamp,
}) async {
ChatThread thread = event.chatThread!;
int time = timestamp ??
event.chatThread?.createAt ??
DateTime.now().millisecondsSinceEpoch - 1;
Message timeMsg = Message.createCustomSendMessage(
targetId: thread.parentId,
event: alertTimeKey,
chatType: ChatType.GroupChat,
);
timeMsg.serverTime = time;
timeMsg.localTime = time;
timeMsg.status = MessageStatus.SUCCESS;
await ChatSDKService.instance.insertMessage(
message: timeMsg,
runMessageReceived: true,
);
Message alertMsg = Message.createCustomSendMessage(
targetId: thread.parentId,
event: alertCreateThreadKey,
chatType: ChatType.GroupChat,
params: {
alertOperatorIdKey: event.from,
alertTargetIdKey: thread.threadId,
alertTargetNameKey: thread.threadName ?? '',
alertTargetParentIdKey: thread.messageId,
},
);
alertMsg.conversationId = thread.parentId;
alertMsg.serverTime = time + 1;
alertMsg.localTime = time + 1;
alertMsg.status = MessageStatus.SUCCESS;
await ChatSDKService.instance.insertMessage(
message: alertMsg,
runMessageReceived: true,
needUpdateConversationList: true,
);
}