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> {
{ "runtime", $"dotnet-{Environment.Version}" },
{ "version", LCApplication.SDKVersion }
{ "version", LCInternalApplication.SDKVersion }
};
}
}

View File

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

View File

@ -99,7 +99,7 @@ namespace LeanCloud.Engine {
LCApplication.Initialize(Environment.GetEnvironmentVariable("LEANCLOUD_APP_ID"),
Environment.GetEnvironmentVariable("LEANCLOUD_APP_KEY"),
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();
ClassHooks = assembly.GetTypes()

View File

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

View File

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

View File

@ -15,7 +15,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
protected LCConnection Connection {
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) {
return new GenericCommand {
Cmd = cmd,
AppId = LCApplication.AppId,
AppId = LCInternalApplication.AppId,
PeerId = Client.Id,
};
}

View File

@ -284,7 +284,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
{ "client_id", Client.Id },
{ "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);
List<object> results = response["results"] as List<object>;
return results.Select(item => {
@ -341,7 +341,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
GenericCommand command = new GenericCommand {
Cmd = CommandType.Conv,
Op = OpType.Query,
AppId = LCApplication.AppId,
AppId = LCInternalApplication.AppId,
PeerId = Client.Id,
};
ConvCommand convMessage = new ConvCommand();

View File

@ -83,7 +83,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
signature = await Client.SignatureFactory.CreateConnectSignature(Client.Id);
}
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 }
});
signature = new LCIMSignature {

View File

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