chore: support platform

oneRain 2021-04-07 18:10:19 +08:00
parent 42c2e6c7e2
commit e0bdffc7f0
9 changed files with 14 additions and 15 deletions

View File

@ -14,7 +14,7 @@ namespace LeanCloud.Engine {
return new Dictionary<string, string> { return new Dictionary<string, string> {
{ "runtime", $"dotnet-{Environment.Version}" }, { "runtime", $"dotnet-{Environment.Version}" },
{ "version", LCApplication.SDKVersion } { "version", LCInternalApplication.SDKVersion }
}; };
} }
} }

View File

@ -8,8 +8,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Common\Common\Common.csproj" /> <ProjectReference Include="..\Storage\Storage.Standard\Storage.Standard.csproj" />
<ProjectReference Include="..\Storage\Storage\Storage.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" /> <FrameworkReference Include="Microsoft.AspNetCore.App" />

View File

@ -99,7 +99,7 @@ namespace LeanCloud.Engine {
LCApplication.Initialize(Environment.GetEnvironmentVariable("LEANCLOUD_APP_ID"), LCApplication.Initialize(Environment.GetEnvironmentVariable("LEANCLOUD_APP_ID"),
Environment.GetEnvironmentVariable("LEANCLOUD_APP_KEY"), Environment.GetEnvironmentVariable("LEANCLOUD_APP_KEY"),
Environment.GetEnvironmentVariable("LEANCLOUD_API_SERVER")); Environment.GetEnvironmentVariable("LEANCLOUD_API_SERVER"));
LCApplication.AddHeader(LCHookKeyName, Environment.GetEnvironmentVariable("LEANCLOUD_APP_HOOK_KEY")); LCInternalApplication.AddHeader(LCHookKeyName, Environment.GetEnvironmentVariable("LEANCLOUD_APP_HOOK_KEY"));
Assembly assembly = Assembly.GetCallingAssembly(); Assembly assembly = Assembly.GetCallingAssembly();
ClassHooks = assembly.GetTypes() ClassHooks = assembly.GetTypes()

View File

@ -80,7 +80,7 @@ namespace LeanCloud.LiveQuery {
data.Add("sessionToken", user.SessionToken); data.Add("sessionToken", user.SessionToken);
} }
string path = "LiveQuery/subscribe"; string path = "LiveQuery/subscribe";
Dictionary<string, object> result = await LCApplication.HttpClient.Post<Dictionary<string, object>>(path, Dictionary<string, object> result = await LCInternalApplication.HttpClient.Post<Dictionary<string, object>>(path,
data: data); data: data);
if (result.TryGetValue("query_id", out object id)) { if (result.TryGetValue("query_id", out object id)) {
Id = id as string; Id = id as string;
@ -95,7 +95,7 @@ namespace LeanCloud.LiveQuery {
{ "query_id", Id } { "query_id", Id }
}; };
string path = "LiveQuery/unsubscribe"; string path = "LiveQuery/unsubscribe";
await LCApplication.HttpClient.Post<Dictionary<string, object>>(path, await LCInternalApplication.HttpClient.Post<Dictionary<string, object>>(path,
data: data); data: data);
// 移除 // 移除
liveQueries.Remove(Id); liveQueries.Remove(Id);
@ -104,7 +104,7 @@ namespace LeanCloud.LiveQuery {
private static async Task Login() { private static async Task Login() {
Dictionary<string, object> data = new Dictionary<string, object> { Dictionary<string, object> data = new Dictionary<string, object> {
{ "cmd", "login" }, { "cmd", "login" },
{ "appId", LCApplication.AppId }, { "appId", LCInternalApplication.AppId },
{ "installationId", DeviceId }, { "installationId", DeviceId },
{ "clientTs", DateTimeOffset.Now.ToUnixTimeMilliseconds() }, { "clientTs", DateTimeOffset.Now.ToUnixTimeMilliseconds() },
{ "service", 1 } { "service", 1 }

View File

@ -56,7 +56,7 @@ namespace LeanCloud.Realtime.Internal.Connection {
// 发送 ping 包 // 发送 ping 包
GenericCommand command = new GenericCommand { GenericCommand command = new GenericCommand {
Cmd = CommandType.Echo, Cmd = CommandType.Echo,
AppId = LCApplication.AppId, AppId = LCInternalApplication.AppId,
PeerId = connection.id PeerId = connection.id
}; };
try { try {

View File

@ -15,7 +15,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
protected LCConnection Connection { protected LCConnection Connection {
get { get {
return LCRealtime.GetConnection(LCApplication.AppId); return LCRealtime.GetConnection(LCInternalApplication.AppId);
} }
} }
@ -28,7 +28,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
protected GenericCommand NewCommand(CommandType cmd) { protected GenericCommand NewCommand(CommandType cmd) {
return new GenericCommand { return new GenericCommand {
Cmd = cmd, Cmd = cmd,
AppId = LCApplication.AppId, AppId = LCInternalApplication.AppId,
PeerId = Client.Id, PeerId = Client.Id,
}; };
} }

View File

@ -284,7 +284,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
{ "client_id", Client.Id }, { "client_id", Client.Id },
{ "cid", convId } { "cid", convId }
}; };
Dictionary<string, object> response = await LCApplication.HttpClient.Get<Dictionary<string, object>>(path, Dictionary<string, object> response = await LCInternalApplication.HttpClient.Get<Dictionary<string, object>>(path,
headers: headers, queryParams: queryParams); headers: headers, queryParams: queryParams);
List<object> results = response["results"] as List<object>; List<object> results = response["results"] as List<object>;
return results.Select(item => { return results.Select(item => {
@ -341,7 +341,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
GenericCommand command = new GenericCommand { GenericCommand command = new GenericCommand {
Cmd = CommandType.Conv, Cmd = CommandType.Conv,
Op = OpType.Query, Op = OpType.Query,
AppId = LCApplication.AppId, AppId = LCInternalApplication.AppId,
PeerId = Client.Id, PeerId = Client.Id,
}; };
ConvCommand convMessage = new ConvCommand(); ConvCommand convMessage = new ConvCommand();

View File

@ -83,7 +83,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
signature = await Client.SignatureFactory.CreateConnectSignature(Client.Id); signature = await Client.SignatureFactory.CreateConnectSignature(Client.Id);
} }
if (signature == null && !string.IsNullOrEmpty(Client.SessionToken)) { if (signature == null && !string.IsNullOrEmpty(Client.SessionToken)) {
Dictionary<string, object> ret = await LCApplication.HttpClient.Post<Dictionary<string, object>>("rtm/sign", data: new Dictionary<string, object> { Dictionary<string, object> ret = await LCInternalApplication.HttpClient.Post<Dictionary<string, object>>("rtm/sign", data: new Dictionary<string, object> {
{ "session_token", Client.SessionToken } { "session_token", Client.SessionToken }
}); });
signature = new LCIMSignature { signature = new LCIMSignature {

View File

@ -22,8 +22,8 @@ namespace LeanCloud.Realtime.Internal.Router {
} }
async Task<LCRTMServer> Fetch() { async Task<LCRTMServer> Fetch() {
string server = await LCApplication.AppRouter.GetRealtimeServer(); string server = await LCInternalApplication.AppRouter.GetRealtimeServer();
string url = $"{server}/v1/route?appId={LCApplication.AppId}&secure=1"; string url = $"{server}/v1/route?appId={LCInternalApplication.AppId}&secure=1";
HttpRequestMessage request = new HttpRequestMessage { HttpRequestMessage request = new HttpRequestMessage {
RequestUri = new Uri(url), RequestUri = new Uri(url),