* LCIMMessageController.cs:

* LCIMConversationController.cs: chore: 支持确认收到和已读消息
oneRain 2020-04-15 11:41:00 +08:00
parent f5c56e5a34
commit 6df8ea80b7
2 changed files with 37 additions and 20 deletions

View File

@ -105,26 +105,6 @@ namespace LeanCloud.Realtime.Internal.Controller {
return response.ConvMessage.Count;
}
/// <summary>
/// 标记对话的消息已读
/// </summary>
/// <param name="convId"></param>
/// <param name="message"></param>
/// <returns></returns>
internal async Task Read(string convId,
LCIMMessage message) {
ReadCommand read = new ReadCommand();
ReadTuple tuple = new ReadTuple {
Cid = convId,
Mid = message.Id,
Timestamp = message.SentTimestamp
};
read.Convs.Add(tuple);
GenericCommand request = NewCommand(CommandType.Read, OpType.Open);
request.ReadMessage = read;
await Client.Connection.SendRequest(request);
}
/// <summary>
/// 更新对话属性
/// </summary>

View File

@ -139,6 +139,43 @@ namespace LeanCloud.Realtime.Internal.Controller {
return null;
}
/// <summary>
/// 确认收到消息
/// </summary>
/// <param name="convId"></param>
/// <param name="msgId"></param>
/// <returns></returns>
internal async Task Ack(string convId,
string msgId) {
AckCommand ack = new AckCommand {
Cid = convId,
Mid = msgId
};
GenericCommand request = NewCommand(CommandType.Ack);
request.AckMessage = ack;
await Client.Connection.SendRequest(request);
}
/// <summary>
/// 确认已读消息
/// </summary>
/// <param name="convId"></param>
/// <param name="msg"></param>
/// <returns></returns>
internal async Task Read(string convId,
LCIMMessage msg) {
ReadCommand read = new ReadCommand();
ReadTuple tuple = new ReadTuple {
Cid = convId,
Mid = msg.Id,
Timestamp = msg.SentTimestamp
};
read.Convs.Add(tuple);
GenericCommand request = NewCommand(CommandType.Read, OpType.Open);
request.ReadMessage = read;
await Client.Connection.SendRequest(request);
}
#endregion
#region 消息处理