insertCreateGroupMessage static method
Implementation
static Future<void> insertCreateGroupMessage({
required Group group,
String? creator,
int? timestamp,
}) async {
int time = timestamp ?? DateTime.now().millisecondsSinceEpoch - 1;
Message timeMsg = Message.createCustomSendMessage(
targetId: group.groupId,
event: alertTimeKey,
chatType: ChatType.GroupChat,
);
timeMsg.serverTime = time;
timeMsg.localTime = time;
timeMsg.status = MessageStatus.SUCCESS;
await ChatSDKService.instance.insertMessage(
message: timeMsg,
);
Message alertMsg = Message.createCustomSendMessage(
targetId: group.groupId,
event: alertGroupCreateKey,
chatType: ChatType.GroupChat,
params: {
alertOperatorIdKey: group.owner ?? creator ?? '',
alertOperatorNameKey: creator ?? group.owner ?? '',
alertTargetIdKey: group.groupId,
alertTargetNameKey: group.name ?? '',
},
);
alertMsg.conversationId = group.groupId;
alertMsg.serverTime = time + 1;
alertMsg.localTime = time + 1;
alertMsg.status = MessageStatus.SUCCESS;
await ChatSDKService.instance.insertMessage(
message: alertMsg,
runMessageReceived: false,
needUpdateConversationList: true,
);
}