* LCIMConversation.cs:

* LCIMConversationController.cs:

* LCIMMessageController.cs: chore: 完善提醒功能
oneRain 2020-04-28 14:48:36 +08:00
parent 5d0c5a32e6
commit c3fbf36971
3 changed files with 16 additions and 0 deletions

View File

@ -187,6 +187,7 @@ namespace LeanCloud.Realtime {
return;
}
await Client.MessageController.Read(Id, LastMessage);
Unread = 0;
}
/// <summary>

View File

@ -597,6 +597,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
message.Id = conv.Mid;
message.FromClientId = conv.From;
message.SentTimestamp = conv.Timestamp;
message.Mentioned = conv.Mentioned;
conversation.LastMessage = message;
}
return conversation;

View File

@ -46,6 +46,15 @@ namespace LeanCloud.Realtime.Internal.Controller {
if (options.Will) {
direct.Will = options.Will;
}
// 提醒所有人
if (message.MentionAll) {
direct.MentionAll = message.MentionAll;
}
// 提醒用户列表
if (message.MentionIdList != null &&
message.MentionIdList.Count > 0) {
direct.MentionPids.AddRange(message.MentionIdList);
}
GenericCommand command = NewCommand(CommandType.Direct);
command.DirectMessage = direct;
// 优先级
@ -177,6 +186,8 @@ namespace LeanCloud.Realtime.Internal.Controller {
message.PatchedTimestamp = item.PatchTimestamp;
message.MentionAll = item.MentionAll;
message.MentionIdList = item.MentionPids.ToList();
message.Mentioned = message.MentionAll ||
message.MentionIdList.Contains(Client.Id);
return message;
}).ToList().AsReadOnly();
}
@ -256,6 +267,8 @@ namespace LeanCloud.Realtime.Internal.Controller {
message.SentTimestamp = direct.Timestamp;
message.MentionAll = direct.MentionAll;
message.MentionIdList = direct.MentionPids.ToList();
message.Mentioned = message.MentionAll ||
message.MentionIdList.Contains(Client.Id);
message.PatchedTimestamp = direct.PatchTimestamp;
message.IsTransient = direct.Transient;
// 通知服务端已接收
@ -265,6 +278,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
}
// 获取对话
LCIMConversation conversation = await Client.GetOrQueryConversation(direct.Cid);
conversation.Unread++;
conversation.LastMessage = message;
Client.OnMessage?.Invoke(conversation, message);
}