fix: conv reads when last message is null.
parent
fbf7d07f85
commit
71d1bff27d
|
|
@ -186,10 +186,13 @@ namespace LeanCloud.Realtime.Internal.Controller {
|
||||||
LCIMMessage msg) {
|
LCIMMessage msg) {
|
||||||
ReadCommand read = new ReadCommand();
|
ReadCommand read = new ReadCommand();
|
||||||
ReadTuple tuple = new ReadTuple {
|
ReadTuple tuple = new ReadTuple {
|
||||||
Cid = convId,
|
Cid = convId
|
||||||
Mid = msg.Id,
|
|
||||||
Timestamp = msg.SentTimestamp
|
|
||||||
};
|
};
|
||||||
|
// 当不传 msg 时,服务端将其收到的最后一条消息标记为已读,可能与客户端不一致
|
||||||
|
if (msg != null) {
|
||||||
|
tuple.Mid = msg.Id;
|
||||||
|
tuple.Timestamp = msg.SentTimestamp;
|
||||||
|
}
|
||||||
read.Convs.Add(tuple);
|
read.Convs.Add(tuple);
|
||||||
GenericCommand command = NewCommand(CommandType.Read);
|
GenericCommand command = NewCommand(CommandType.Read);
|
||||||
command.ReadMessage = read;
|
command.ReadMessage = read;
|
||||||
|
|
|
||||||
|
|
@ -185,7 +185,7 @@ namespace LeanCloud.Realtime {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual async Task Read() {
|
public virtual async Task Read() {
|
||||||
if (LastMessage == null) {
|
if (Unread == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await Client.MessageController.Read(Id, LastMessage);
|
await Client.MessageController.Read(Id, LastMessage);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue