chore: 完善对话接口和事件

oneRain 2020-04-26 11:53:20 +08:00
parent 659da6acc8
commit fa2b4d9c79
1 changed files with 27 additions and 1 deletions

View File

@ -252,7 +252,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
Cid = convId
};
conv.M.AddRange(clientIds);
GenericCommand request = NewCommand(CommandType.Conv, OpType.Remove);
GenericCommand request = NewCommand(CommandType.Conv, OpType.RemoveShutup);
request.ConvMessage = conv;
GenericCommand response = await Client.Connection.SendRequest(request);
return NewPartiallySuccessResult(response.ConvMessage.AllowedPids, response.ConvMessage.FailedPids);
@ -580,6 +580,9 @@ namespace LeanCloud.Realtime.Internal.Controller {
case OpType.Blocked:
await OnBlocked(convMessage);
break;
case OpType.Unblocked:
await OnUnblocked(convMessage);
break;
case OpType.MembersBlocked:
await OnMembersBlocked(convMessage);
break;
@ -589,6 +592,9 @@ namespace LeanCloud.Realtime.Internal.Controller {
case OpType.Shutuped:
await OnMuted(convMessage);
break;
case OpType.Unshutuped:
await OnUnmuted(convMessage);
break;
case OpType.MembersShutuped:
await OnMembersMuted(convMessage);
break;
@ -662,6 +668,16 @@ namespace LeanCloud.Realtime.Internal.Controller {
Client.OnMuted?.Invoke(conversation, convMessage.InitBy);
}
/// <summary>
/// 当前用户被解除禁言
/// </summary>
/// <param name="convMessage"></param>
/// <returns></returns>
private async Task OnUnmuted(ConvCommand convMessage) {
LCIMConversation conversation = await Client.GetOrQueryConversation(convMessage.Cid);
Client.OnUnmuted?.Invoke(conversation, convMessage.InitBy);
}
/// <summary>
/// 有成员被禁言
/// </summary>
@ -696,6 +712,16 @@ namespace LeanCloud.Realtime.Internal.Controller {
Client.OnBlocked?.Invoke(conversation, convMessage.InitBy);
}
/// <summary>
/// 当前用户被解除黑名单
/// </summary>
/// <param name="convMessage"></param>
/// <returns></returns>
private async Task OnUnblocked(ConvCommand convMessage) {
LCIMConversation conversation = await Client.GetOrQueryConversation(convMessage.Cid);
Client.OnUnblocked?.Invoke(conversation, convMessage.InitBy);
}
/// <summary>
/// 有用户被拉黑
/// </summary>