diff --git a/Common/Common.AOT/Common.AOT.csproj b/Common/Common.AOT/Common.AOT.csproj
index e5b34be..81fc26c 100644
--- a/Common/Common.AOT/Common.AOT.csproj
+++ b/Common/Common.AOT/Common.AOT.csproj
@@ -11,11 +11,9 @@
-
- Common\Common.csproj
-
-
-
+
+ Common\LCCore.cs
+
Common\AppRouter\LCAppServer.cs
@@ -31,8 +29,14 @@
Common\Http\LCHttpUtils.cs
-
- Common\Task\LCTaskExtensions.cs
+
+ Common\Http\LCHttpClient.cs
+
+
+ Common\Persistence\PersistenceController.cs
+
+
+ Common\Persistence\IPersistence.cs
Common\Log\LCLogger.cs
diff --git a/Common/Common/Common.csproj b/Common/Common/Common.csproj
index ac8b4ca..1c7a113 100644
--- a/Common/Common/Common.csproj
+++ b/Common/Common/Common.csproj
@@ -9,8 +9,8 @@
-
+
diff --git a/Storage/Storage/Internal/Http/LCHttpClient.cs b/Common/Common/Http/LCHttpClient.cs
similarity index 84%
rename from Storage/Storage/Internal/Http/LCHttpClient.cs
rename to Common/Common/Http/LCHttpClient.cs
index 7a4b0e9..bcd61de 100644
--- a/Storage/Storage/Internal/Http/LCHttpClient.cs
+++ b/Common/Common/Http/LCHttpClient.cs
@@ -8,9 +8,8 @@ using System.Net.Http.Headers;
using System.Text;
using System.Security.Cryptography;
using LC.Newtonsoft.Json;
-using LeanCloud.Common;
-namespace LeanCloud.Storage.Internal.Http {
+namespace LeanCloud.Common {
public class LCHttpClient {
private readonly string appId;
@@ -26,6 +25,8 @@ namespace LeanCloud.Storage.Internal.Http {
readonly MD5 md5;
+ private Dictionary>> runtimeHeaderTasks = new Dictionary>>();
+
public LCHttpClient(string appId, string appKey, string server, string sdkVersion, string apiVersion) {
this.appId = appId;
this.appKey = appKey;
@@ -42,6 +43,16 @@ namespace LeanCloud.Storage.Internal.Http {
md5 = MD5.Create();
}
+ public void AddRuntimeHeaderTask(string key, Func> task) {
+ if (key == null) {
+ return;
+ }
+ if (task == null) {
+ return;
+ }
+ runtimeHeaderTasks[key] = task;
+ }
+
public Task Get(string path,
Dictionary headers = null,
Dictionary queryParams = null) {
@@ -120,7 +131,7 @@ namespace LeanCloud.Storage.Internal.Http {
}
async Task BuildUrl(string path, Dictionary queryParams = null) {
- string apiServer = await LCInternalApplication.AppRouter.GetApiServer();
+ string apiServer = await LCCore.AppRouter.GetApiServer();
string url = $"{apiServer}/{apiVersion}/{path}";
if (queryParams != null) {
IEnumerable queryPairs = queryParams.Select(kv => $"{kv.Key}={kv.Value}");
@@ -137,9 +148,9 @@ namespace LeanCloud.Storage.Internal.Http {
headers.Add(kv.Key, kv.Value.ToString());
}
}
- if (LCInternalApplication.UseMasterKey && !string.IsNullOrEmpty(LCInternalApplication.MasterKey)) {
+ if (LCCore.UseMasterKey && !string.IsNullOrEmpty(LCCore.MasterKey)) {
// Master Key
- headers.Add("X-LC-Key", $"{LCInternalApplication.MasterKey},master");
+ headers.Add("X-LC-Key", $"{LCCore.MasterKey},master");
} else {
// 签名
long timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
@@ -148,15 +159,21 @@ namespace LeanCloud.Storage.Internal.Http {
string sign = $"{hash},{timestamp}";
headers.Add("X-LC-Sign", sign);
}
- if (LCInternalApplication.AdditionalHeaders.Count > 0) {
- foreach (KeyValuePair kv in LCInternalApplication.AdditionalHeaders) {
+ if (LCCore.AdditionalHeaders.Count > 0) {
+ foreach (KeyValuePair kv in LCCore.AdditionalHeaders) {
headers.Add(kv.Key, kv.Value);
}
}
- // 当前用户 Session Token
- LCUser currentUser = await LCUser.GetCurrent();
- if (!headers.Contains("X-LC-Session") && currentUser != null) {
- headers.Add("X-LC-Session", currentUser.SessionToken);
+ // 服务额外 headers
+ foreach (KeyValuePair>> kv in runtimeHeaderTasks) {
+ if (headers.Contains(kv.Key)) {
+ continue;
+ }
+ string value = await kv.Value.Invoke();
+ if (value == null) {
+ continue;
+ }
+ headers.Add(kv.Key, value);
}
}
diff --git a/Storage/Storage/LCInternalApplication.cs b/Common/Common/LCCore.cs
similarity index 69%
rename from Storage/Storage/LCInternalApplication.cs
rename to Common/Common/LCCore.cs
index b7094f0..4fb54e4 100644
--- a/Storage/Storage/LCInternalApplication.cs
+++ b/Common/Common/LCCore.cs
@@ -1,20 +1,16 @@
using System;
using System.Collections.Generic;
-using LeanCloud.Common;
-using LeanCloud.Storage;
-using LeanCloud.Storage.Internal.Http;
-using LeanCloud.Storage.Internal.Storage;
-namespace LeanCloud {
+namespace LeanCloud.Common {
///
/// LeanCloud Application
///
- public class LCInternalApplication {
+ public class LCCore {
// SDK 版本号,用于 User-Agent 统计
public const string SDKVersion = "0.7.3";
// 接口版本号,用于接口版本管理
- internal const string APIVersion = "1.1";
+ public const string APIVersion = "1.1";
public static string AppId {
get; private set;
@@ -44,7 +40,7 @@ namespace LeanCloud {
get; set;
}
- public static StorageController StorageController {
+ public static PersistenceController PersistenceController {
get; set;
}
@@ -67,13 +63,6 @@ namespace LeanCloud {
AppKey = appKey;
MasterKey = masterKey;
- // 注册 LeanCloud 内部子类化类型
- LCObject.RegisterSubclass(LCUser.CLASS_NAME, () => new LCUser());
- LCObject.RegisterSubclass(LCRole.CLASS_NAME, () => new LCRole());
- LCObject.RegisterSubclass(LCFile.CLASS_NAME, () => new LCFile());
- LCObject.RegisterSubclass(LCStatus.CLASS_NAME, () => new LCStatus());
- LCObject.RegisterSubclass(LCFriendshipRequest.CLASS_NAME, () => new LCFriendshipRequest());
-
AppRouter = new LCAppRouter(appId, server);
HttpClient = new LCHttpClient(appId, appKey, server, SDKVersion, APIVersion);
diff --git a/Common/Common/Persistence/IPersistence.cs b/Common/Common/Persistence/IPersistence.cs
new file mode 100644
index 0000000..2c5dc60
--- /dev/null
+++ b/Common/Common/Persistence/IPersistence.cs
@@ -0,0 +1,5 @@
+namespace LeanCloud.Common {
+ public interface IPersistence {
+ string GetPersistencePath();
+ }
+}
diff --git a/Storage/Storage/Internal/Storage/StorageController.cs b/Common/Common/Persistence/PersistenceController.cs
similarity index 76%
rename from Storage/Storage/Internal/Storage/StorageController.cs
rename to Common/Common/Persistence/PersistenceController.cs
index 551d0ab..285d1c9 100644
--- a/Storage/Storage/Internal/Storage/StorageController.cs
+++ b/Common/Common/Persistence/PersistenceController.cs
@@ -1,23 +1,20 @@
using System;
-using System.Reflection;
-using System.Linq;
using System.Threading.Tasks;
using System.IO;
using System.Text;
-using System.Collections.Generic;
using IOFile = System.IO.File;
-namespace LeanCloud.Storage.Internal.Storage {
- public class StorageController {
- private readonly IStorage storage;
+namespace LeanCloud.Common {
+ public class PersistenceController {
+ private readonly IPersistence persistence;
- public StorageController(IStorage storage) {
- this.storage = storage;
+ public PersistenceController(IPersistence persistence) {
+ this.persistence = persistence;
}
public async Task WriteText(string filename, string text) {
- if (storage == null) {
+ if (persistence == null) {
return;
}
@@ -31,7 +28,7 @@ namespace LeanCloud.Storage.Internal.Storage {
}
public async Task ReadText(string filename) {
- if (storage == null) {
+ if (persistence == null) {
return null;
}
@@ -51,7 +48,7 @@ namespace LeanCloud.Storage.Internal.Storage {
}
public Task Delete(string filename) {
- if (storage == null) {
+ if (persistence == null) {
return Task.CompletedTask;
}
@@ -62,10 +59,10 @@ namespace LeanCloud.Storage.Internal.Storage {
}
private string GetFileFullPath(string filename) {
- if (storage == null) {
+ if (persistence == null) {
throw new Exception("no IStrorage.");
}
- return Path.Combine(storage.GetStoragePath(), filename);
+ return Path.Combine(persistence.GetPersistencePath(), filename);
}
}
}
diff --git a/Common/Common/Task/LCTaskExtensions.cs b/Common/Common/Task/LCTaskExtensions.cs
deleted file mode 100644
index bd0b0cb..0000000
--- a/Common/Common/Task/LCTaskExtensions.cs
+++ /dev/null
@@ -1,148 +0,0 @@
-// Copyright (c) 2015-present, Parse, LLC. All rights reserved. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. An additional grant of patent rights can be found in the PATENTS file in the same directory.
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Runtime.ExceptionServices;
-using System.Threading.Tasks;
-
-namespace LeanCloud.Common {
- ///
- /// Provides helper methods that allow us to use terser code elsewhere.
- ///
- public static class LCTaskExtensions {
- ///
- /// Ensures a task (even null) is awaitable.
- ///
- ///
- ///
- ///
- public static Task Safe(this Task task) {
- return task ?? Task.FromResult(default);
- }
-
- ///
- /// Ensures a task (even null) is awaitable.
- ///
- ///
- ///
- public static Task Safe(this Task task) {
- return task ?? Task.FromResult
-
+
+
+
+
diff --git a/Engine/Controllers/LCClassHookController.cs b/Engine/Internal/Controllers/LCClassHookController.cs
similarity index 100%
rename from Engine/Controllers/LCClassHookController.cs
rename to Engine/Internal/Controllers/LCClassHookController.cs
diff --git a/Engine/Controllers/LCFunctionController.cs b/Engine/Internal/Controllers/LCFunctionController.cs
similarity index 100%
rename from Engine/Controllers/LCFunctionController.cs
rename to Engine/Internal/Controllers/LCFunctionController.cs
diff --git a/Engine/Controllers/LCPingController.cs b/Engine/Internal/Controllers/LCPingController.cs
similarity index 88%
rename from Engine/Controllers/LCPingController.cs
rename to Engine/Internal/Controllers/LCPingController.cs
index cb37ac6..0374541 100644
--- a/Engine/Controllers/LCPingController.cs
+++ b/Engine/Internal/Controllers/LCPingController.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Cors;
+using LeanCloud.Common;
namespace LeanCloud.Engine {
[ApiController]
@@ -14,7 +15,7 @@ namespace LeanCloud.Engine {
return new Dictionary {
{ "runtime", $"dotnet-{Environment.Version}" },
- { "version", LCInternalApplication.SDKVersion }
+ { "version", LCCore.SDKVersion }
};
}
}
diff --git a/Engine/Controllers/LCUserHookController.cs b/Engine/Internal/Controllers/LCUserHookController.cs
similarity index 100%
rename from Engine/Controllers/LCUserHookController.cs
rename to Engine/Internal/Controllers/LCUserHookController.cs
diff --git a/Engine/Attributes/LCEngineClassHookAttribute.cs b/Engine/Public/Attributes/LCEngineClassHookAttribute.cs
similarity index 100%
rename from Engine/Attributes/LCEngineClassHookAttribute.cs
rename to Engine/Public/Attributes/LCEngineClassHookAttribute.cs
diff --git a/Engine/Attributes/LCEngineFunctionAttribute.cs b/Engine/Public/Attributes/LCEngineFunctionAttribute.cs
similarity index 100%
rename from Engine/Attributes/LCEngineFunctionAttribute.cs
rename to Engine/Public/Attributes/LCEngineFunctionAttribute.cs
diff --git a/Engine/Attributes/LCEngineFunctionParamAttribute.cs b/Engine/Public/Attributes/LCEngineFunctionParamAttribute.cs
similarity index 100%
rename from Engine/Attributes/LCEngineFunctionParamAttribute.cs
rename to Engine/Public/Attributes/LCEngineFunctionParamAttribute.cs
diff --git a/Engine/Attributes/LCEngineRealtimeHookAttribute.cs b/Engine/Public/Attributes/LCEngineRealtimeHookAttribute.cs
similarity index 100%
rename from Engine/Attributes/LCEngineRealtimeHookAttribute.cs
rename to Engine/Public/Attributes/LCEngineRealtimeHookAttribute.cs
diff --git a/Engine/Attributes/LCEngineUserHookAttribute.cs b/Engine/Public/Attributes/LCEngineUserHookAttribute.cs
similarity index 100%
rename from Engine/Attributes/LCEngineUserHookAttribute.cs
rename to Engine/Public/Attributes/LCEngineUserHookAttribute.cs
diff --git a/Engine/LCEngine.cs b/Engine/Public/LCEngine.cs
similarity index 99%
rename from Engine/LCEngine.cs
rename to Engine/Public/LCEngine.cs
index e9cf772..d507196 100644
--- a/Engine/LCEngine.cs
+++ b/Engine/Public/LCEngine.cs
@@ -99,7 +99,7 @@ namespace LeanCloud.Engine {
LCApplication.Initialize(Environment.GetEnvironmentVariable("LEANCLOUD_APP_ID"),
Environment.GetEnvironmentVariable("LEANCLOUD_APP_KEY"),
Environment.GetEnvironmentVariable("LEANCLOUD_API_SERVER"));
- LCInternalApplication.AddHeader(LCHookKeyName, Environment.GetEnvironmentVariable("LEANCLOUD_APP_HOOK_KEY"));
+ LCCore.AddHeader(LCHookKeyName, Environment.GetEnvironmentVariable("LEANCLOUD_APP_HOOK_KEY"));
Assembly assembly = Assembly.GetCallingAssembly();
ClassHooks = assembly.GetTypes()
diff --git a/Engine/LCEngineRequestContext.cs b/Engine/Public/LCEngineRequestContext.cs
similarity index 100%
rename from Engine/LCEngineRequestContext.cs
rename to Engine/Public/LCEngineRequestContext.cs
diff --git a/LiveQuery/LiveQuery.AOT/LiveQuery.AOT.csproj b/LiveQuery/LiveQuery.AOT/LiveQuery.AOT.csproj
index 4633b07..a803f74 100644
--- a/LiveQuery/LiveQuery.AOT/LiveQuery.AOT.csproj
+++ b/LiveQuery/LiveQuery.AOT/LiveQuery.AOT.csproj
@@ -11,22 +11,17 @@
-
- LiveQuery\LiveQuery.csproj
-
-
-
-
- LiveQuery\LCLiveQuery.cs
-
-
- LiveQuery\LCQueryExtension.cs
-
LiveQuery\Internal\LCLiveQueryHeartBeat.cs
LiveQuery\Internal\LCLiveQueryConnection.cs
+
+ LiveQuery\Public\LCLiveQuery.cs
+
+
+ LiveQuery\Public\LCQueryExtension.cs
+
diff --git a/LiveQuery/LiveQuery/LiveQuery.csproj b/LiveQuery/LiveQuery/LiveQuery.csproj
index a705ffe..529b34e 100644
--- a/LiveQuery/LiveQuery/LiveQuery.csproj
+++ b/LiveQuery/LiveQuery/LiveQuery.csproj
@@ -11,5 +11,6 @@
+
diff --git a/LiveQuery/LiveQuery/LCLiveQuery.cs b/LiveQuery/LiveQuery/Public/LCLiveQuery.cs
similarity index 97%
rename from LiveQuery/LiveQuery/LCLiveQuery.cs
rename to LiveQuery/LiveQuery/Public/LCLiveQuery.cs
index 8389832..1976ca5 100644
--- a/LiveQuery/LiveQuery/LCLiveQuery.cs
+++ b/LiveQuery/LiveQuery/Public/LCLiveQuery.cs
@@ -3,6 +3,7 @@ using System.Linq;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Threading.Tasks;
+using LeanCloud.Common;
using LeanCloud.Storage;
using LeanCloud.Storage.Internal.Object;
using LeanCloud.LiveQuery.Internal;
@@ -80,7 +81,7 @@ namespace LeanCloud.LiveQuery {
data.Add("sessionToken", user.SessionToken);
}
string path = "LiveQuery/subscribe";
- Dictionary result = await LCInternalApplication.HttpClient.Post>(path,
+ Dictionary result = await LCCore.HttpClient.Post>(path,
data: data);
if (result.TryGetValue("query_id", out object id)) {
Id = id as string;
@@ -95,7 +96,7 @@ namespace LeanCloud.LiveQuery {
{ "query_id", Id }
};
string path = "LiveQuery/unsubscribe";
- await LCInternalApplication.HttpClient.Post>(path,
+ await LCCore.HttpClient.Post>(path,
data: data);
// 移除
liveQueries.Remove(Id);
@@ -104,7 +105,7 @@ namespace LeanCloud.LiveQuery {
private static async Task Login() {
Dictionary data = new Dictionary {
{ "cmd", "login" },
- { "appId", LCInternalApplication.AppId },
+ { "appId", LCCore.AppId },
{ "installationId", DeviceId },
{ "clientTs", DateTimeOffset.Now.ToUnixTimeMilliseconds() },
{ "service", 1 }
diff --git a/LiveQuery/LiveQuery/LCQueryExtension.cs b/LiveQuery/LiveQuery/Public/LCQueryExtension.cs
similarity index 100%
rename from LiveQuery/LiveQuery/LCQueryExtension.cs
rename to LiveQuery/LiveQuery/Public/LCQueryExtension.cs
diff --git a/Realtime/Realtime.AOT/Realtime.AOT.csproj b/Realtime/Realtime.AOT/Realtime.AOT.csproj
index 3f0f7b2..1b51c5b 100644
--- a/Realtime/Realtime.AOT/Realtime.AOT.csproj
+++ b/Realtime/Realtime.AOT/Realtime.AOT.csproj
@@ -12,83 +12,83 @@
-
- Realtime\LCIMClient.cs
+
+ Realtime\Public\LCIMClient.cs
-
- Realtime\LCRealtime.cs
+
+ Realtime\Public\LCRealtime.cs
-
- Realtime\Result\LCIMOperationFailure.cs
+
+ Realtime\Public\Result\LCIMOperationFailure.cs
-
- Realtime\Result\LCIMPageResult.cs
+
+ Realtime\Public\Result\LCIMPageResult.cs
-
- Realtime\Result\LCIMPartiallySuccessResult.cs
+
+ Realtime\Public\Result\LCIMPartiallySuccessResult.cs
-
- Realtime\Signature\LCIMSignature.cs
+
+ Realtime\Public\Signature\LCIMSignature.cs
-
- Realtime\Signature\ILCIMSignatureFactory.cs
+
+ Realtime\Public\Signature\ILCIMSignatureFactory.cs
-
- Realtime\Signature\LCIMSignatureAction.cs
+
+ Realtime\Public\Signature\LCIMSignatureAction.cs
-
- Realtime\Message\LCIMVideoMessage.cs
+
+ Realtime\Public\Message\LCIMVideoMessage.cs
-
- Realtime\Message\LCIMMessageSendOptions.cs
+
+ Realtime\Public\Message\LCIMMessageSendOptions.cs
-
- Realtime\Message\LCIMBinaryMessage.cs
+
+ Realtime\Public\Message\LCIMBinaryMessage.cs
-
- Realtime\Message\LCIMFileMessage.cs
+
+ Realtime\Public\Message\LCIMFileMessage.cs
-
- Realtime\Message\LCIMRecalledMessage.cs
+
+ Realtime\Public\Message\LCIMRecalledMessage.cs
-
- Realtime\Message\LCIMMessage.cs
+
+ Realtime\Public\Message\LCIMMessage.cs
-
- Realtime\Message\LCIMTextMessage.cs
+
+ Realtime\Public\Message\LCIMTextMessage.cs
-
- Realtime\Message\LCIMImageMessage.cs
+
+ Realtime\Public\Message\LCIMImageMessage.cs
-
- Realtime\Message\LCIMAudioMessage.cs
+
+ Realtime\Public\Message\LCIMAudioMessage.cs
-
- Realtime\Message\LCIMLocationMessage.cs
+
+ Realtime\Public\Message\LCIMLocationMessage.cs
-
- Realtime\Message\LCIMTypedMessage.cs
+
+ Realtime\Public\Message\LCIMTypedMessage.cs
-
- Realtime\Conversation\LCIMConversation.cs
+
+ Realtime\Public\Conversation\LCIMConversation.cs
-
- Realtime\Conversation\LCIMServiceConversation.cs
+
+ Realtime\Public\Conversation\LCIMServiceConversation.cs
-
- Realtime\Conversation\LCIMConversationMemberInfo.cs
+
+ Realtime\Public\Conversation\LCIMConversationMemberInfo.cs
-
- Realtime\Conversation\LCIMConversationQuery.cs
+
+ Realtime\Public\Conversation\LCIMConversationQuery.cs
-
- Realtime\Conversation\LCIMChatRoom.cs
+
+ Realtime\Public\Conversation\LCIMChatRoom.cs
-
- Realtime\Conversation\LCIMMessageQueryOptions.cs
+
+ Realtime\Public\Conversation\LCIMMessageQueryOptions.cs
-
- Realtime\Conversation\LCIMTemporaryConversation.cs
+
+ Realtime\Public\Conversation\LCIMTemporaryConversation.cs
Realtime\Internal\WebSocket\LCWebSocketClient.cs
@@ -121,9 +121,4 @@
Realtime\Internal\Router\LCRTMRouter.cs
-
-
- Realtime\Realtime.csproj
-
-
diff --git a/Realtime/Realtime.Test/LocalSignatureFactory.cs b/Realtime/Realtime.Test/LocalSignatureFactory.cs
index 1483914..7bf87ee 100644
--- a/Realtime/Realtime.Test/LocalSignatureFactory.cs
+++ b/Realtime/Realtime.Test/LocalSignatureFactory.cs
@@ -5,7 +5,7 @@ using System.Threading.Tasks;
using System.Collections.Generic;
using System.Security.Cryptography;
using LeanCloud.Realtime;
-using LeanCloud;
+using LeanCloud.Common;
namespace Realtime.Test {
public class LocalSignatureFactory : ILCIMSignatureFactory {
@@ -14,7 +14,7 @@ namespace Realtime.Test {
public Task CreateConnectSignature(string clientId) {
long timestamp = DateTimeOffset.Now.ToUnixTimeSeconds();
string nonce = NewNonce();
- string signature = GenerateSignature(LCInternalApplication.AppId, clientId, string.Empty, timestamp.ToString(), nonce);
+ string signature = GenerateSignature(LCCore.AppId, clientId, string.Empty, timestamp.ToString(), nonce);
return Task.FromResult(new LCIMSignature {
Signature = signature,
Timestamp = timestamp,
@@ -31,7 +31,7 @@ namespace Realtime.Test {
}
long timestamp = DateTimeOffset.Now.ToUnixTimeSeconds();
string nonce = NewNonce();
- string signature = GenerateSignature(LCInternalApplication.AppId, clientId, sortedMemberIds, timestamp.ToString(), nonce);
+ string signature = GenerateSignature(LCCore.AppId, clientId, sortedMemberIds, timestamp.ToString(), nonce);
return Task.FromResult(new LCIMSignature {
Signature = signature,
Timestamp = timestamp,
@@ -48,7 +48,7 @@ namespace Realtime.Test {
}
long timestamp = DateTimeOffset.Now.ToUnixTimeSeconds();
string nonce = NewNonce();
- string signature = GenerateSignature(LCInternalApplication.AppId, clientId, conversationId, sortedMemberIds, timestamp.ToString(), nonce, action);
+ string signature = GenerateSignature(LCCore.AppId, clientId, conversationId, sortedMemberIds, timestamp.ToString(), nonce, action);
return Task.FromResult(new LCIMSignature {
Signature = signature,
Timestamp = timestamp,
@@ -65,7 +65,7 @@ namespace Realtime.Test {
}
long timestamp = DateTimeOffset.Now.ToUnixTimeSeconds();
string nonce = NewNonce();
- string signature = GenerateSignature(LCInternalApplication.AppId, clientId, conversationId, sortedMemberIds, timestamp.ToString(), nonce, action);
+ string signature = GenerateSignature(LCCore.AppId, clientId, conversationId, sortedMemberIds, timestamp.ToString(), nonce, action);
return Task.FromResult(new LCIMSignature {
Signature = signature,
Timestamp = timestamp,
diff --git a/Realtime/Realtime/Internal/Connection/LCHeartBeat.cs b/Realtime/Realtime/Internal/Connection/LCHeartBeat.cs
index 0948993..ea1b902 100644
--- a/Realtime/Realtime/Internal/Connection/LCHeartBeat.cs
+++ b/Realtime/Realtime/Internal/Connection/LCHeartBeat.cs
@@ -1,6 +1,7 @@
using System;
using System.Threading;
using System.Threading.Tasks;
+using LeanCloud.Common;
using LeanCloud.Realtime.Internal.Protocol;
namespace LeanCloud.Realtime.Internal.Connection {
@@ -56,7 +57,7 @@ namespace LeanCloud.Realtime.Internal.Connection {
// 发送 ping 包
GenericCommand command = new GenericCommand {
Cmd = CommandType.Echo,
- AppId = LCInternalApplication.AppId,
+ AppId = LCCore.AppId,
PeerId = connection.id
};
try {
diff --git a/Realtime/Realtime/Internal/Controller/LCIMController.cs b/Realtime/Realtime/Internal/Controller/LCIMController.cs
index e3779fc..501aee3 100644
--- a/Realtime/Realtime/Internal/Controller/LCIMController.cs
+++ b/Realtime/Realtime/Internal/Controller/LCIMController.cs
@@ -1,4 +1,5 @@
-using LeanCloud.Realtime.Internal.Protocol;
+using LeanCloud.Common;
+using LeanCloud.Realtime.Internal.Protocol;
using LeanCloud.Realtime.Internal.Connection;
namespace LeanCloud.Realtime.Internal.Controller {
@@ -15,7 +16,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
protected LCConnection Connection {
get {
- return LCRealtime.GetConnection(LCInternalApplication.AppId);
+ return LCRealtime.GetConnection(LCCore.AppId);
}
}
@@ -28,7 +29,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
protected GenericCommand NewCommand(CommandType cmd) {
return new GenericCommand {
Cmd = cmd,
- AppId = LCInternalApplication.AppId,
+ AppId = LCCore.AppId,
PeerId = Client.Id,
};
}
diff --git a/Realtime/Realtime/Internal/Controller/LCIMConversationController.cs b/Realtime/Realtime/Internal/Controller/LCIMConversationController.cs
index 99062fb..88f72c3 100644
--- a/Realtime/Realtime/Internal/Controller/LCIMConversationController.cs
+++ b/Realtime/Realtime/Internal/Controller/LCIMConversationController.cs
@@ -284,7 +284,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
{ "client_id", Client.Id },
{ "cid", convId }
};
- Dictionary response = await LCInternalApplication.HttpClient.Get>(path,
+ Dictionary response = await LCCore.HttpClient.Get>(path,
headers: headers, queryParams: queryParams);
List