insertGroupLeaveMessage static method
Implementation
static Future<void> insertGroupLeaveMessage(String groupId) async {
if (Client.getInstance.options?.deleteMessagesAsExitGroup == true) {
return;
}
String userId = ChatSDKService.instance.currentUserId!;
Message alertMsg = Message.createCustomSendMessage(
targetId: groupId,
event: alertGroupLeaveKey,
chatType: ChatType.GroupChat,
params: {
alertOperatorIdKey: userId,
},
);
alertMsg.conversationId = groupId;
alertMsg.serverTime = DateTime.now().millisecondsSinceEpoch;
alertMsg.localTime = alertMsg.serverTime;
alertMsg.status = MessageStatus.SUCCESS;
await ChatSDKService.instance.insertMessage(
message: alertMsg,
runMessageReceived: true,
needUpdateConversationList: true,
);
}