支持Flutter6端开发。惺惺是一个100%开源社交平台,每个人都可以搭建自己的服务器,掌握数据的所有权。
XXIMCore core = XXIMCore();
core.init(
params: Params(
deviceModel: "",
deviceId: "",
osVersion: "",
platform: "",
appVersion: "",
language: "",
),
connectListener: ConnectListener(
onConnecting: () {},
onSuccess: () {},
onClose: ({error}) {},
),
receivePushListener: ReceivePushListener(
onPushMsgDataList: (msgDataList) {},
onPushNoticeDataList: (noticeDataList) {},
),
);
core.login(
apiUrl: "",
wsUrl: "",
token: "",
userId: "",
networkUsed: "",
);
core.logout();
core.isLogin();
core.setLanguage("");
BatchGetConvSeqReq batchGetConvSeqReq = BatchGetConvSeqReq(
convIdList: [],
);
BatchGetConvSeqResp? batchGetConvSeqResp = await core.batchGetConvSeq(
req: batchGetConvSeqReq,
onSuccess: (data) {},
onError: (code, {msg}) {},
);
BatchGetMsgListByConvIdReq batchGetMsgListByConvIdReq = BatchGetMsgListByConvIdReq(
items: [
BatchGetMsgListByConvIdReq_Item(
convId: "",
seqList: [],
),
],
push: true ?? false,
);
GetMsgListResp? getMsgListResp = await core.batchGetMsgListByConvId(
req: batchGetMsgListByConvIdReq,
onSuccess: (data) {},
onError: (code, {msg}) {},
);
GetMsgByIdReq getMsgByIdReq = GetMsgByIdReq(
clientMsgId: "",
serverMsgId: "",
push: true ?? false,
);
GetMsgByIdResp? getMsgByIdResp = await core.getMsgById(
req: getMsgByIdReq,
onSuccess: (data) {},
onError: (code, {msg}) {},
);
SendMsgListReq req = SendMsgListReq(
msgDataList: [
MsgData(
clientMsgId: "",
clientTime: "",
senderId: "",
senderInfo: utf8.encode(""),
senderConvInfo: utf8.encode(""),
convId: "",
atUsers: [],
contentType: ContentType.text,
content: utf8.encode(""),
options: MsgData_Options(
storageForServer: true,
storageForClient: true,
needDecrypt: true,
offlinePush: true,
updateConvMsg: true,
updateUnreadCount: true,
),
offlinePush: MsgData_OfflinePush(
title: "",
content: "",
payload: "",
),
ext: utf8.encode(""),
),
],
deliverAfter: 0,
);
bool? status = await core.sendMsgList(
req: req,
onSuccess: (data) {},
onError: (code, {msg}) {},
);
AckNoticeDataReq req = AckNoticeDataReq(
noticeIds: [],
);
bool? status = await core.ackNoticeDataReq(
req: req,
onSuccess: (data) {},
onError: (code, {msg}) {},
);