chore: 简化初始化流程

oneRain 2019-07-23 14:35:07 +08:00
parent 3446116c14
commit cf2e6c576e
2 changed files with 37 additions and 46 deletions

View File

@ -409,18 +409,6 @@ namespace LeanCloud.Realtime
/// 登录的时候告知服务器,本次登录所使用的离线消息策略 /// 登录的时候告知服务器,本次登录所使用的离线消息策略
/// </summary> /// </summary>
public OfflineMessageStrategy OfflineMessageStrategy { get; set; } public OfflineMessageStrategy OfflineMessageStrategy { get; set; }
/// <summary>
/// Gets or sets the realtime server.
/// </summary>
/// <value>The realtime server.</value>
public Uri RealtimeServer { get; set; }
/// <summary>
/// Gets or sets the push router server.
/// </summary>
/// <value>The push router server.</value>
public Uri RTMRouter { get; set; }
} }
/// <summary> /// <summary>
@ -1086,13 +1074,13 @@ namespace LeanCloud.Realtime
return Task.FromResult(true); return Task.FromResult(true);
} }
if (CurrentConfiguration.RealtimeServer != null) if (AVClient.CurrentConfiguration.RealtimeServer != null)
{ {
_wss = CurrentConfiguration.RealtimeServer.ToString(); _wss = AVClient.CurrentConfiguration.RealtimeServer;
AVRealtime.PrintLog("use configuration realtime server with url: " + _wss); AVRealtime.PrintLog("use configuration realtime server with url: " + _wss);
return OpenAsync(_wss, subprotocol, enforce); return OpenAsync(_wss, subprotocol, enforce);
} }
var routerUrl = CurrentConfiguration.RTMRouter != null ? CurrentConfiguration.RTMRouter.ToString() : null; var routerUrl = AVClient.CurrentConfiguration.RTMServer;
return RouterController.GetAsync(routerUrl, secure, cancellationToken).OnSuccess(r => return RouterController.GetAsync(routerUrl, secure, cancellationToken).OnSuccess(r =>
{ {
var routerState = r.Result; var routerState = r.Result;
@ -1136,7 +1124,7 @@ namespace LeanCloud.Realtime
/// <returns></returns> /// <returns></returns>
public Task<Tuple<int, IDictionary<string, object>>> RunCommandAsync(AVIMCommand command) public Task<Tuple<int, IDictionary<string, object>>> RunCommandAsync(AVIMCommand command)
{ {
command.AppId(this.CurrentConfiguration.ApplicationId); command.AppId(AVClient.CurrentConfiguration.ApplicationId);
return this.AVIMCommandRunner.RunCommandAsync(command); return this.AVIMCommandRunner.RunCommandAsync(command);
} }
@ -1146,7 +1134,7 @@ namespace LeanCloud.Realtime
/// <param name="command"></param> /// <param name="command"></param>
public void RunCommand(AVIMCommand command) public void RunCommand(AVIMCommand command)
{ {
command.AppId(this.CurrentConfiguration.ApplicationId); command.AppId(AVClient.CurrentConfiguration.ApplicationId);
this.AVIMCommandRunner.RunCommand(command); this.AVIMCommandRunner.RunCommand(command);
} }

View File

@ -102,7 +102,7 @@ namespace LeanCloud
/// <summary> /// <summary>
/// The LeanCloud application ID of your app. /// The LeanCloud application ID of your app.
/// </summary> /// </summary>
public String ApplicationId { get; set; } public string ApplicationId { get; set; }
/// <summary> /// <summary>
/// LeanCloud C# SDK 支持的服务节点,目前支持华北,华东和北美公有云节点和私有节点,以及专属节点 /// LeanCloud C# SDK 支持的服务节点,目前支持华北,华东和北美公有云节点和私有节点,以及专属节点
@ -120,13 +120,13 @@ namespace LeanCloud
/// <summary> /// <summary>
/// The LeanCloud application key for your app. /// The LeanCloud application key for your app.
/// </summary> /// </summary>
public String ApplicationKey { get; set; } public string ApplicationKey { get; set; }
/// <summary> /// <summary>
/// The LeanCloud master key for your app. /// The LeanCloud master key for your app.
/// </summary> /// </summary>
/// <value>The master key.</value> /// <value>The master key.</value>
public String MasterKey { get; set; } public string MasterKey { get; set; }
/// <summary> /// <summary>
/// Gets or sets additional HTTP headers to be sent with network requests from the SDK. /// Gets or sets additional HTTP headers to be sent with network requests from the SDK.
@ -139,28 +139,31 @@ namespace LeanCloud
public VersionInformation VersionInfo { get; set; } public VersionInformation VersionInfo { get; set; }
/// <summary> /// <summary>
/// Gets or sets the engine server uri. The Uri must have no path port. /// 存储服务器地址
/// If this property is set, all LeanEngine cloud func calls will use this server as LeanEngine server.
/// </summary>
/// <value>The engine server uri.</value>
public Uri EngineServer { get; set; }
/// <summary>
/// Gets or sets the API server.
/// </summary> /// </summary>
/// <value>The API server.</value> /// <value>The API server.</value>
public Uri ApiServer { get; set; } public string ApiServer { get; set; }
/// <summary> /// <summary>
/// Gets or sets the push server. /// 云引擎服务器地址
/// </summary> /// </summary>
/// <value>The push server.</value> /// <value>The engine server uri.</value>
public string EngineServer { get; set; }
/// <summary>
/// 即时通信服务器地址
/// </summary>
/// <value>The RTMR outer.</value>
public string RTMServer { get; set; }
/// <summary>
/// 直连即时通信服务器地址
/// </summary>
/// <value>The realtime server.</value>
public string RealtimeServer { get; set; }
public Uri PushServer { get; set; } public Uri PushServer { get; set; }
/// <summary>
/// Gets or sets the stats server.
/// </summary>
/// <value>The stats server.</value>
public Uri StatsServer { get; set; } public Uri StatsServer { get; set; }
} }