chore: 调整命名空间和目录结构
parent
38287c9a9c
commit
a06b836a10
|
@ -187,6 +187,7 @@ namespace LeanCloud.Realtime {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await Client.MessageController.Read(Id, LastMessage);
|
await Client.MessageController.Read(Id, LastMessage);
|
||||||
|
Unread = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -5,7 +5,7 @@ using System.Threading.Tasks;
|
||||||
using Google.Protobuf;
|
using Google.Protobuf;
|
||||||
using LeanCloud.Realtime.Internal.Router;
|
using LeanCloud.Realtime.Internal.Router;
|
||||||
using LeanCloud.Realtime.Internal.WebSocket;
|
using LeanCloud.Realtime.Internal.WebSocket;
|
||||||
using LeanCloud.Realtime.Protocol;
|
using LeanCloud.Realtime.Internal.Protocol;
|
||||||
using LeanCloud.Common;
|
using LeanCloud.Common;
|
||||||
using LeanCloud.Storage;
|
using LeanCloud.Storage;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using LeanCloud.Common;
|
using LeanCloud.Common;
|
||||||
using LeanCloud.Realtime.Protocol;
|
using LeanCloud.Realtime.Internal.Protocol;
|
||||||
|
|
||||||
namespace LeanCloud.Realtime.Internal.Connection {
|
namespace LeanCloud.Realtime.Internal.Connection {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using LeanCloud.Realtime.Protocol;
|
using LeanCloud.Realtime.Internal.Protocol;
|
||||||
using LeanCloud.Realtime.Internal.Connection;
|
using LeanCloud.Realtime.Internal.Connection;
|
||||||
|
|
||||||
namespace LeanCloud.Realtime.Internal.Controller {
|
namespace LeanCloud.Realtime.Internal.Controller {
|
||||||
|
|
|
@ -4,7 +4,7 @@ using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using LeanCloud.Realtime.Protocol;
|
using LeanCloud.Realtime.Internal.Protocol;
|
||||||
using LeanCloud.Storage.Internal;
|
using LeanCloud.Storage.Internal;
|
||||||
using LeanCloud.Storage.Internal.Codec;
|
using LeanCloud.Storage.Internal.Codec;
|
||||||
using LeanCloud.Common;
|
using LeanCloud.Common;
|
||||||
|
@ -552,7 +552,12 @@ namespace LeanCloud.Realtime.Internal.Controller {
|
||||||
if (errors != null) {
|
if (errors != null) {
|
||||||
result.FailureList = new List<LCIMOperationFailure>();
|
result.FailureList = new List<LCIMOperationFailure>();
|
||||||
foreach (ErrorCommand error in errors) {
|
foreach (ErrorCommand error in errors) {
|
||||||
result.FailureList.Add(new LCIMOperationFailure(error));
|
LCIMOperationFailure failure = new LCIMOperationFailure {
|
||||||
|
Code = error.Code,
|
||||||
|
Reason = error.Reason,
|
||||||
|
IdList = error.Pids?.ToList()
|
||||||
|
};
|
||||||
|
result.FailureList.Add(failure);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -597,6 +602,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
|
||||||
message.Id = conv.Mid;
|
message.Id = conv.Mid;
|
||||||
message.FromClientId = conv.From;
|
message.FromClientId = conv.From;
|
||||||
message.SentTimestamp = conv.Timestamp;
|
message.SentTimestamp = conv.Timestamp;
|
||||||
|
message.Mentioned = conv.Mentioned;
|
||||||
conversation.LastMessage = message;
|
conversation.LastMessage = message;
|
||||||
}
|
}
|
||||||
return conversation;
|
return conversation;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using LeanCloud.Realtime.Protocol;
|
using LeanCloud.Realtime.Internal.Protocol;
|
||||||
|
|
||||||
namespace LeanCloud.Realtime.Internal.Controller {
|
namespace LeanCloud.Realtime.Internal.Controller {
|
||||||
internal class LCIMGoAwayController : LCIMController {
|
internal class LCIMGoAwayController : LCIMController {
|
||||||
|
|
|
@ -4,7 +4,7 @@ using System.Threading.Tasks;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Google.Protobuf;
|
using Google.Protobuf;
|
||||||
using LeanCloud.Realtime.Protocol;
|
using LeanCloud.Realtime.Internal.Protocol;
|
||||||
|
|
||||||
namespace LeanCloud.Realtime.Internal.Controller {
|
namespace LeanCloud.Realtime.Internal.Controller {
|
||||||
internal class LCIMMessageController : LCIMController {
|
internal class LCIMMessageController : LCIMController {
|
||||||
|
@ -46,6 +46,19 @@ namespace LeanCloud.Realtime.Internal.Controller {
|
||||||
if (options.Will) {
|
if (options.Will) {
|
||||||
direct.Will = options.Will;
|
direct.Will = options.Will;
|
||||||
}
|
}
|
||||||
|
// 推送数据
|
||||||
|
if (options.PushData != null) {
|
||||||
|
direct.PushData = JsonConvert.SerializeObject(options.PushData);
|
||||||
|
}
|
||||||
|
// 提醒所有人
|
||||||
|
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);
|
GenericCommand command = NewCommand(CommandType.Direct);
|
||||||
command.DirectMessage = direct;
|
command.DirectMessage = direct;
|
||||||
// 优先级
|
// 优先级
|
||||||
|
@ -177,6 +190,8 @@ namespace LeanCloud.Realtime.Internal.Controller {
|
||||||
message.PatchedTimestamp = item.PatchTimestamp;
|
message.PatchedTimestamp = item.PatchTimestamp;
|
||||||
message.MentionAll = item.MentionAll;
|
message.MentionAll = item.MentionAll;
|
||||||
message.MentionIdList = item.MentionPids.ToList();
|
message.MentionIdList = item.MentionPids.ToList();
|
||||||
|
message.Mentioned = message.MentionAll ||
|
||||||
|
message.MentionIdList.Contains(Client.Id);
|
||||||
return message;
|
return message;
|
||||||
}).ToList().AsReadOnly();
|
}).ToList().AsReadOnly();
|
||||||
}
|
}
|
||||||
|
@ -256,6 +271,8 @@ namespace LeanCloud.Realtime.Internal.Controller {
|
||||||
message.SentTimestamp = direct.Timestamp;
|
message.SentTimestamp = direct.Timestamp;
|
||||||
message.MentionAll = direct.MentionAll;
|
message.MentionAll = direct.MentionAll;
|
||||||
message.MentionIdList = direct.MentionPids.ToList();
|
message.MentionIdList = direct.MentionPids.ToList();
|
||||||
|
message.Mentioned = message.MentionAll ||
|
||||||
|
message.MentionIdList.Contains(Client.Id);
|
||||||
message.PatchedTimestamp = direct.PatchTimestamp;
|
message.PatchedTimestamp = direct.PatchTimestamp;
|
||||||
message.IsTransient = direct.Transient;
|
message.IsTransient = direct.Transient;
|
||||||
// 通知服务端已接收
|
// 通知服务端已接收
|
||||||
|
@ -265,6 +282,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
|
||||||
}
|
}
|
||||||
// 获取对话
|
// 获取对话
|
||||||
LCIMConversation conversation = await Client.GetOrQueryConversation(direct.Cid);
|
LCIMConversation conversation = await Client.GetOrQueryConversation(direct.Cid);
|
||||||
|
conversation.Unread++;
|
||||||
conversation.LastMessage = message;
|
conversation.LastMessage = message;
|
||||||
Client.OnMessage?.Invoke(conversation, message);
|
Client.OnMessage?.Invoke(conversation, message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using LeanCloud.Realtime.Protocol;
|
using LeanCloud.Realtime.Internal.Protocol;
|
||||||
|
|
||||||
namespace LeanCloud.Realtime.Internal.Controller {
|
namespace LeanCloud.Realtime.Internal.Controller {
|
||||||
internal class LCIMSessionController : LCIMController {
|
internal class LCIMSessionController : LCIMController {
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -5,7 +5,7 @@ using System.Linq;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using LeanCloud.Common;
|
using LeanCloud.Common;
|
||||||
using LeanCloud.Storage;
|
using LeanCloud.Storage;
|
||||||
using LeanCloud.Realtime.Protocol;
|
using LeanCloud.Realtime.Internal.Protocol;
|
||||||
using LeanCloud.Realtime.Internal.Controller;
|
using LeanCloud.Realtime.Internal.Controller;
|
||||||
using LeanCloud.Realtime.Internal.Connection;
|
using LeanCloud.Realtime.Internal.Connection;
|
||||||
|
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
using System.Linq;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using LeanCloud.Realtime.Protocol;
|
|
||||||
|
|
||||||
namespace LeanCloud.Realtime {
|
|
||||||
public class LCIMOperationFailure {
|
|
||||||
public int Code {
|
|
||||||
get; set;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Reason {
|
|
||||||
get; set;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<string> MemberList {
|
|
||||||
get; set;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LCIMOperationFailure(ErrorCommand error) {
|
|
||||||
Code = error.Code;
|
|
||||||
Reason = error.Reason;
|
|
||||||
MemberList = error.Pids.ToList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,4 +1,6 @@
|
||||||
namespace LeanCloud.Realtime {
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace LeanCloud.Realtime {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 消息优先级
|
/// 消息优先级
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -40,6 +42,10 @@
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Dictionary<string, object> PushData {
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
public static LCIMMessageSendOptions Default = new LCIMMessageSendOptions();
|
public static LCIMMessageSendOptions Default = new LCIMMessageSendOptions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,5 +23,7 @@
|
||||||
<Folder Include="Signature\" />
|
<Folder Include="Signature\" />
|
||||||
<Folder Include="Internal\Controller\" />
|
<Folder Include="Internal\Controller\" />
|
||||||
<Folder Include="Internal\Connection\" />
|
<Folder Include="Internal\Connection\" />
|
||||||
|
<Folder Include="Internal\Protocol\" />
|
||||||
|
<Folder Include="Result\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace LeanCloud.Realtime {
|
||||||
|
/// <summary>
|
||||||
|
/// 操作失败
|
||||||
|
/// </summary>
|
||||||
|
public class LCIMOperationFailure {
|
||||||
|
/// <summary>
|
||||||
|
/// 失败码
|
||||||
|
/// </summary>
|
||||||
|
public int Code {
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 失败原因
|
||||||
|
/// </summary>
|
||||||
|
public string Reason {
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 失败数据
|
||||||
|
/// </summary>
|
||||||
|
public List<string> IdList {
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
|
//public LCIMOperationFailure(ErrorCommand error) {
|
||||||
|
// Code = error.Code;
|
||||||
|
// Reason = error.Reason;
|
||||||
|
// MemberList = error.Pids.ToList();
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,11 +1,20 @@
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
|
||||||
namespace LeanCloud.Realtime {
|
namespace LeanCloud.Realtime {
|
||||||
|
/// <summary>
|
||||||
|
/// 查询分页结果
|
||||||
|
/// </summary>
|
||||||
public class LCIMPageResult {
|
public class LCIMPageResult {
|
||||||
|
/// <summary>
|
||||||
|
/// 当前分页数据集
|
||||||
|
/// </summary>
|
||||||
public ReadOnlyCollection<string> Results {
|
public ReadOnlyCollection<string> Results {
|
||||||
get; internal set;
|
get; internal set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 下次请求的数据
|
||||||
|
/// </summary>
|
||||||
public string Next {
|
public string Next {
|
||||||
get; internal set;
|
get; internal set;
|
||||||
}
|
}
|
|
@ -1,13 +1,20 @@
|
||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using LeanCloud.Storage;
|
|
||||||
|
|
||||||
namespace LeanCloud.Realtime {
|
namespace LeanCloud.Realtime {
|
||||||
|
/// <summary>
|
||||||
|
/// 部分成功结果
|
||||||
|
/// </summary>
|
||||||
public class LCIMPartiallySuccessResult {
|
public class LCIMPartiallySuccessResult {
|
||||||
|
/// <summary>
|
||||||
|
/// 成功数据集
|
||||||
|
/// </summary>
|
||||||
public List<string> SuccessfulClientIdList {
|
public List<string> SuccessfulClientIdList {
|
||||||
get; internal set;
|
get; internal set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 失败原因
|
||||||
|
/// </summary>
|
||||||
public List<LCIMOperationFailure> FailureList {
|
public List<LCIMOperationFailure> FailureList {
|
||||||
get; internal set;
|
get; internal set;
|
||||||
}
|
}
|
|
@ -2,6 +2,9 @@
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace LeanCloud.Realtime {
|
namespace LeanCloud.Realtime {
|
||||||
|
/// <summary>
|
||||||
|
/// 签名工程接口
|
||||||
|
/// </summary>
|
||||||
public interface ILCIMSignatureFactory {
|
public interface ILCIMSignatureFactory {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 登录签名
|
/// 登录签名
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
protoc --proto_path=. --csharp_out=. messages2.proto.orig
|
protoc --proto_path=. --csharp_out=../Internal/Protocol messages2.proto.orig
|
|
@ -1,7 +1,7 @@
|
||||||
syntax = "proto2";
|
syntax = "proto2";
|
||||||
|
|
||||||
package push_server.messages2;
|
package push_server.messages2;
|
||||||
option csharp_namespace = "LeanCloud.Realtime.Protocol";
|
option csharp_namespace = "LeanCloud.Realtime.Internal.Protocol";
|
||||||
|
|
||||||
// note that this line will be removed by out build script until we
|
// note that this line will be removed by out build script until we
|
||||||
// finally upgraded to protobuffer 3
|
// finally upgraded to protobuffer 3
|
||||||
|
|
Loading…
Reference in New Issue