chore: 简化 AVClient
parent
70b3a37fe3
commit
56a051080a
|
@ -47,7 +47,7 @@ namespace LeanCloudTests {
|
||||||
public void DeserializeList() {
|
public void DeserializeList() {
|
||||||
var json = "[1, \"hello\", [2, 3, 4], { \"count\": 22 }]";
|
var json = "[1, \"hello\", [2, 3, 4], { \"count\": 22 }]";
|
||||||
TestContext.Out.WriteLine(JsonConvert.DeserializeObject(json).GetType());
|
TestContext.Out.WriteLine(JsonConvert.DeserializeObject(json).GetType());
|
||||||
var obj = JsonConvert.DeserializeObject<object>(json, new LeanCloudJsonConverter());
|
var obj = JsonConvert.DeserializeObject<IList<object>>(json, new LeanCloudJsonConverter());
|
||||||
if (obj is IList<object>) {
|
if (obj is IList<object>) {
|
||||||
var arr = obj as List<object>;
|
var arr = obj as List<object>;
|
||||||
TestContext.Out.WriteLine(arr.GetType());
|
TestContext.Out.WriteLine(arr.GetType());
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
using System;
|
using System.Threading.Tasks;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using LeanCloud.Storage.Internal;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace LeanCloud.Storage.Internal {
|
namespace LeanCloud.Storage.Internal {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -34,7 +33,7 @@ namespace LeanCloud.Storage.Internal {
|
||||||
|
|
||||||
string propertiesString = tmp as string;
|
string propertiesString = tmp as string;
|
||||||
if (propertiesString != null) {
|
if (propertiesString != null) {
|
||||||
var dictionary = AVClient.DeserializeJsonString(propertiesString);
|
var dictionary = JsonConvert.DeserializeObject<IDictionary<string, object>>(propertiesString);
|
||||||
currentConfig = new AVConfig(dictionary);
|
currentConfig = new AVConfig(dictionary);
|
||||||
} else {
|
} else {
|
||||||
currentConfig = new AVConfig();
|
currentConfig = new AVConfig();
|
||||||
|
@ -53,7 +52,7 @@ namespace LeanCloud.Storage.Internal {
|
||||||
currentConfig = config;
|
currentConfig = config;
|
||||||
|
|
||||||
var jsonObject = ((IJsonConvertible)config).ToJSON();
|
var jsonObject = ((IJsonConvertible)config).ToJSON();
|
||||||
var jsonString = AVClient.SerializeJsonString(jsonObject);
|
var jsonString = JsonConvert.SerializeObject(jsonObject);
|
||||||
|
|
||||||
return storageController.LoadAsync().OnSuccess(t => t.Result.AddAsync(CurrentConfigKey, jsonString));
|
return storageController.LoadAsync().OnSuccess(t => t.Result.AddAsync(CurrentConfigKey, jsonString));
|
||||||
}).Unwrap().Unwrap(), CancellationToken.None);
|
}).Unwrap().Unwrap(), CancellationToken.None);
|
||||||
|
|
|
@ -7,6 +7,7 @@ using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace LeanCloud.Storage.Internal
|
namespace LeanCloud.Storage.Internal
|
||||||
{
|
{
|
||||||
|
@ -83,12 +84,10 @@ namespace LeanCloud.Storage.Internal
|
||||||
var blockSize = remainingSize > BLOCKSIZE ? BLOCKSIZE : remainingSize;
|
var blockSize = remainingSize > BLOCKSIZE ? BLOCKSIZE : remainingSize;
|
||||||
return MakeBlock(state, firstChunkBinary, blockSize).ContinueWith(t =>
|
return MakeBlock(state, firstChunkBinary, blockSize).ContinueWith(t =>
|
||||||
{
|
{
|
||||||
|
var dict = JsonConvert.DeserializeObject<IDictionary<string, object>>(t.Result.Item2, new LeanCloudJsonConverter());
|
||||||
var dic = AVClient.ReponseResolve(t.Result, CancellationToken.None);
|
var ctx = dict["ctx"].ToString();
|
||||||
var ctx = dic.Item2["ctx"].ToString();
|
offset = long.Parse(dict["offset"].ToString());
|
||||||
|
var host = dict["host"].ToString();
|
||||||
offset = long.Parse(dic.Item2["offset"].ToString());
|
|
||||||
var host = dic.Item2["host"].ToString();
|
|
||||||
|
|
||||||
state.completed += firstChunkBinary.Length;
|
state.completed += firstChunkBinary.Length;
|
||||||
if (state.completed % BLOCKSIZE == 0 || state.completed == totalSize)
|
if (state.completed % BLOCKSIZE == 0 || state.completed == totalSize)
|
||||||
|
@ -105,11 +104,11 @@ namespace LeanCloud.Storage.Internal
|
||||||
var chunkBinary = GetChunkBinary(state.completed, dataStream);
|
var chunkBinary = GetChunkBinary(state.completed, dataStream);
|
||||||
return PutChunk(state, chunkBinary, context, offset).ContinueWith(t =>
|
return PutChunk(state, chunkBinary, context, offset).ContinueWith(t =>
|
||||||
{
|
{
|
||||||
var dic = AVClient.ReponseResolve(t.Result, CancellationToken.None);
|
var dict = JsonConvert.DeserializeObject<IDictionary<string, object>>(t.Result.Item2, new LeanCloudJsonConverter());
|
||||||
var ctx = dic.Item2["ctx"].ToString();
|
var ctx = dict["ctx"].ToString();
|
||||||
|
|
||||||
offset = long.Parse(dic.Item2["offset"].ToString());
|
offset = long.Parse(dict["offset"].ToString());
|
||||||
var host = dic.Item2["host"].ToString();
|
var host = dict["host"].ToString();
|
||||||
state.completed += chunkBinary.Length;
|
state.completed += chunkBinary.Length;
|
||||||
if (state.completed % BLOCKSIZE == 0 || state.completed == totalSize)
|
if (state.completed % BLOCKSIZE == 0 || state.completed == totalSize)
|
||||||
{
|
{
|
||||||
|
|
|
@ -170,11 +170,7 @@ namespace LeanCloud
|
||||||
|
|
||||||
private static readonly object mutex = new object();
|
private static readonly object mutex = new object();
|
||||||
|
|
||||||
static AVClient()
|
static AVClient() {
|
||||||
{
|
|
||||||
versionString = "net-portable-" + Version;
|
|
||||||
|
|
||||||
//AVModuleController.Instance.ScanForModules();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -197,7 +193,6 @@ namespace LeanCloud
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly string versionString;
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 当前 SDK 版本号
|
/// 当前 SDK 版本号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -205,7 +200,7 @@ namespace LeanCloud
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return versionString;
|
return "net-v0.1.0";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,40 +239,19 @@ namespace LeanCloud
|
||||||
/// <param name="log"></param>
|
/// <param name="log"></param>
|
||||||
public static void PrintLog(string log)
|
public static void PrintLog(string log)
|
||||||
{
|
{
|
||||||
if (AVClient.LogTracker != null)
|
LogTracker?.Invoke(log);
|
||||||
{
|
|
||||||
AVClient.LogTracker(log);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool useProduction = true;
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether send the request to production server or staging server.
|
/// Gets or sets a value indicating whether send the request to production server or staging server.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value><c>true</c> if use production; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if use production; otherwise, <c>false</c>.</value>
|
||||||
public static bool UseProduction
|
public static bool UseProduction {
|
||||||
{
|
get; set;
|
||||||
get
|
|
||||||
{
|
|
||||||
return useProduction;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
useProduction = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool useMasterKey = false;
|
public static bool UseMasterKey {
|
||||||
public static bool UseMasterKey
|
get; set;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return useMasterKey;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
useMasterKey = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -363,90 +337,5 @@ namespace LeanCloud
|
||||||
}
|
}
|
||||||
return dict;
|
return dict;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static IDictionary<string, object> DeserializeJsonString(string jsonData)
|
|
||||||
{
|
|
||||||
return JsonConvert.DeserializeObject<Dictionary<string, object>>(jsonData, new LeanCloudJsonConverter());
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static string SerializeJsonString(IDictionary<string, object> jsonData)
|
|
||||||
{
|
|
||||||
return JsonConvert.SerializeObject(jsonData);
|
|
||||||
}
|
|
||||||
|
|
||||||
//public static Task<Tuple<HttpStatusCode, string>> HttpGetAsync(Uri uri)
|
|
||||||
//{
|
|
||||||
// return RequestAsync(uri, "GET", null, body: null, contentType: null, cancellationToken: CancellationToken.None);
|
|
||||||
//}
|
|
||||||
|
|
||||||
//public static Task<Tuple<HttpStatusCode, string>> RequestAsync(Uri uri, string method, IList<KeyValuePair<string, string>> headers, IDictionary<string, object> body, string contentType, CancellationToken cancellationToken)
|
|
||||||
//{
|
|
||||||
// var dataStream = body != null ? new MemoryStream(Encoding.UTF8.GetBytes(Json.Encode(body))) : null;
|
|
||||||
// return AVClient.RequestAsync(uri, method, headers, dataStream, contentType, cancellationToken);
|
|
||||||
// //return AVPlugins.Instance.HttpClient.ExecuteAsync(request, null, null, cancellationToken);
|
|
||||||
//}
|
|
||||||
|
|
||||||
//public static Task<Tuple<HttpStatusCode, string>> RequestAsync(Uri uri, string method, IList<KeyValuePair<string, string>> headers, Stream data, string contentType, CancellationToken cancellationToken)
|
|
||||||
//{
|
|
||||||
// HttpRequest request = new HttpRequest()
|
|
||||||
// {
|
|
||||||
// Data = data != null ? data : null,
|
|
||||||
// Headers = headers,
|
|
||||||
// Method = method,
|
|
||||||
// Uri = uri
|
|
||||||
// };
|
|
||||||
// return AVPlugins.Instance.HttpClient.ExecuteAsync(request, null, null, cancellationToken).OnSuccess(t =>
|
|
||||||
// {
|
|
||||||
// var response = t.Result;
|
|
||||||
// var contentString = response.Item2;
|
|
||||||
// int responseCode = (int)response.Item1;
|
|
||||||
// var responseLog = responseCode + ";" + contentString;
|
|
||||||
// PrintLog(responseLog);
|
|
||||||
// return response;
|
|
||||||
// });
|
|
||||||
//}
|
|
||||||
|
|
||||||
internal static Tuple<HttpStatusCode, IDictionary<string, object>> ReponseResolve(Tuple<HttpStatusCode, string> response, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
Tuple<HttpStatusCode, string> result = response;
|
|
||||||
HttpStatusCode code = result.Item1;
|
|
||||||
string item2 = result.Item2;
|
|
||||||
|
|
||||||
if (item2 == null)
|
|
||||||
{
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
|
||||||
return new Tuple<HttpStatusCode, IDictionary<string, object>>(code, null);
|
|
||||||
}
|
|
||||||
IDictionary<string, object> strs = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
|
|
||||||
strs = !item2.StartsWith("[", StringComparison.Ordinal) ? AVClient.DeserializeJsonString(item2) : new Dictionary<string, object>()
|
|
||||||
{
|
|
||||||
{ "results", JsonConvert.DeserializeObject<Dictionary<string, object>>(item2, new LeanCloudJsonConverter()) }
|
|
||||||
};
|
|
||||||
}
|
|
||||||
catch (Exception exception)
|
|
||||||
{
|
|
||||||
throw new AVException(AVException.ErrorCode.OtherCause, "Invalid response from server", exception);
|
|
||||||
}
|
|
||||||
var codeValue = (int)code;
|
|
||||||
if (codeValue > 203 || codeValue < 200)
|
|
||||||
{
|
|
||||||
throw new AVException((AVException.ErrorCode)((int)((strs.ContainsKey("code") ? (long)strs["code"] : (long)-1))), (strs.ContainsKey("error") ? strs["error"] as string : item2), null);
|
|
||||||
}
|
|
||||||
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
|
||||||
return new Tuple<HttpStatusCode, IDictionary<string, object>>(code, strs);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static Task<Tuple<HttpStatusCode, IDictionary<string, object>>> RunCommandAsync(AVCommand command)
|
|
||||||
{
|
|
||||||
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static bool IsSuccessStatusCode(HttpStatusCode responseStatus) {
|
|
||||||
return (responseStatus >= HttpStatusCode.OK) && (responseStatus <= HttpStatusCode.PartialContent);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,7 @@ namespace LeanCloud {
|
||||||
/// <param name="op">进行的操作名称。</param>
|
/// <param name="op">进行的操作名称。</param>
|
||||||
/// <param name="ttl">验证码失效时间。</param>
|
/// <param name="ttl">验证码失效时间。</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static Task<bool> RequestSMSCodeAsync(string mobilePhoneNumber, string name, string op, int ttl = 10)
|
public static Task RequestSMSCodeAsync(string mobilePhoneNumber, string name, string op, int ttl = 10)
|
||||||
{
|
{
|
||||||
return RequestSMSCodeAsync(mobilePhoneNumber, name, op, ttl, CancellationToken.None);
|
return RequestSMSCodeAsync(mobilePhoneNumber, name, op, ttl, CancellationToken.None);
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ namespace LeanCloud {
|
||||||
/// <param name="op">进行的操作名称。</param>
|
/// <param name="op">进行的操作名称。</param>
|
||||||
/// <param name="ttl">验证码失效时间。</param>
|
/// <param name="ttl">验证码失效时间。</param>
|
||||||
/// <param name="cancellationToken">Cancellation token。</param>
|
/// <param name="cancellationToken">Cancellation token。</param>
|
||||||
public static Task<bool> RequestSMSCodeAsync(string mobilePhoneNumber, string name, string op, int ttl = 10, CancellationToken cancellationToken = default(CancellationToken))
|
public static Task RequestSMSCodeAsync(string mobilePhoneNumber, string name, string op, int ttl = 10, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(mobilePhoneNumber))
|
if (string.IsNullOrEmpty(mobilePhoneNumber))
|
||||||
{
|
{
|
||||||
|
@ -130,10 +130,7 @@ namespace LeanCloud {
|
||||||
Method = HttpMethod.Post,
|
Method = HttpMethod.Post,
|
||||||
Content = strs
|
Content = strs
|
||||||
};
|
};
|
||||||
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command, cancellationToken: cancellationToken).ContinueWith(t =>
|
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command, cancellationToken: cancellationToken);
|
||||||
{
|
|
||||||
return AVClient.IsSuccessStatusCode(t.Result.Item1);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -141,9 +138,9 @@ namespace LeanCloud {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>是否发送成功。</returns>
|
/// <returns>是否发送成功。</returns>
|
||||||
/// <param name="mobilePhoneNumber">手机号。</param>
|
/// <param name="mobilePhoneNumber">手机号。</param>
|
||||||
public static Task<bool> RequestSMSCodeAsync(string mobilePhoneNumber)
|
public static Task RequestSMSCodeAsync(string mobilePhoneNumber)
|
||||||
{
|
{
|
||||||
return AVCloud.RequestSMSCodeAsync(mobilePhoneNumber, CancellationToken.None);
|
return RequestSMSCodeAsync(mobilePhoneNumber, CancellationToken.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -153,9 +150,9 @@ namespace LeanCloud {
|
||||||
/// <returns>是否发送成功。</returns>
|
/// <returns>是否发送成功。</returns>
|
||||||
/// <param name="mobilePhoneNumber">手机号。</param>
|
/// <param name="mobilePhoneNumber">手机号。</param>
|
||||||
/// <param name="cancellationToken">Cancellation Token.</param>
|
/// <param name="cancellationToken">Cancellation Token.</param>
|
||||||
public static Task<bool> RequestSMSCodeAsync(string mobilePhoneNumber, CancellationToken cancellationToken)
|
public static Task RequestSMSCodeAsync(string mobilePhoneNumber, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return AVCloud.RequestSMSCodeAsync(mobilePhoneNumber, null, null, 0, cancellationToken);
|
return RequestSMSCodeAsync(mobilePhoneNumber, null, null, 0, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -169,7 +166,7 @@ namespace LeanCloud {
|
||||||
/// <param name="sign">Sms's sign.</param>
|
/// <param name="sign">Sms's sign.</param>
|
||||||
/// <param name="cancellationToken">Cancellation token.</param>
|
/// <param name="cancellationToken">Cancellation token.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static Task<bool> RequestSMSCodeAsync(
|
public static Task RequestSMSCodeAsync(
|
||||||
string mobilePhoneNumber,
|
string mobilePhoneNumber,
|
||||||
string template,
|
string template,
|
||||||
IDictionary<string, object> env,
|
IDictionary<string, object> env,
|
||||||
|
@ -204,10 +201,7 @@ namespace LeanCloud {
|
||||||
Method = HttpMethod.Post,
|
Method = HttpMethod.Post,
|
||||||
Content = strs
|
Content = strs
|
||||||
};
|
};
|
||||||
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command).ContinueWith(t =>
|
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command);
|
||||||
{
|
|
||||||
return AVClient.IsSuccessStatusCode(t.Result.Item1);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -215,7 +209,7 @@ namespace LeanCloud {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="mobilePhoneNumber"></param>
|
/// <param name="mobilePhoneNumber"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static Task<bool> RequestVoiceCodeAsync(string mobilePhoneNumber)
|
public static Task RequestVoiceCodeAsync(string mobilePhoneNumber)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(mobilePhoneNumber))
|
if (string.IsNullOrEmpty(mobilePhoneNumber))
|
||||||
{
|
{
|
||||||
|
@ -234,10 +228,7 @@ namespace LeanCloud {
|
||||||
Content = body
|
Content = body
|
||||||
};
|
};
|
||||||
|
|
||||||
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command).ContinueWith(t =>
|
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command);
|
||||||
{
|
|
||||||
return AVClient.IsSuccessStatusCode(t.Result.Item1);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -246,9 +237,9 @@ namespace LeanCloud {
|
||||||
/// <returns>是否验证通过。</returns>
|
/// <returns>是否验证通过。</returns>
|
||||||
/// <param name="mobilePhoneNumber">手机号</param>
|
/// <param name="mobilePhoneNumber">手机号</param>
|
||||||
/// <param name="code">验证码。</param>
|
/// <param name="code">验证码。</param>
|
||||||
public static Task<bool> VerifySmsCodeAsync(string code, string mobilePhoneNumber)
|
public static Task VerifySmsCodeAsync(string code, string mobilePhoneNumber)
|
||||||
{
|
{
|
||||||
return AVCloud.VerifySmsCodeAsync(code, mobilePhoneNumber, CancellationToken.None);
|
return VerifySmsCodeAsync(code, mobilePhoneNumber, CancellationToken.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -258,15 +249,12 @@ namespace LeanCloud {
|
||||||
/// <param name="code">验证码。</param>
|
/// <param name="code">验证码。</param>
|
||||||
/// <param name="mobilePhoneNumber">手机号</param>
|
/// <param name="mobilePhoneNumber">手机号</param>
|
||||||
/// <param name="cancellationToken">Cancellation token.</param>
|
/// <param name="cancellationToken">Cancellation token.</param>
|
||||||
public static Task<bool> VerifySmsCodeAsync(string code, string mobilePhoneNumber, CancellationToken cancellationToken)
|
public static Task VerifySmsCodeAsync(string code, string mobilePhoneNumber, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var command = new AVCommand {
|
var command = new AVCommand {
|
||||||
Path = $"verifySmsCode/{code.Trim()}?mobilePhoneNumber={mobilePhoneNumber.Trim()}",
|
Path = $"verifySmsCode/{code.Trim()}?mobilePhoneNumber={mobilePhoneNumber.Trim()}",
|
||||||
};
|
};
|
||||||
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command, cancellationToken: cancellationToken).ContinueWith(t =>
|
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command, cancellationToken: cancellationToken);
|
||||||
{
|
|
||||||
return AVClient.IsSuccessStatusCode(t.Result.Item1);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -499,8 +487,7 @@ namespace LeanCloud {
|
||||||
Method = HttpMethod.Post,
|
Method = HttpMethod.Post,
|
||||||
Content = encodedParameters
|
Content = encodedParameters
|
||||||
};
|
};
|
||||||
return AVClient.RunCommandAsync(command);
|
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command);
|
||||||
|
|
||||||
}).Unwrap().OnSuccess(s =>
|
}).Unwrap().OnSuccess(s =>
|
||||||
{
|
{
|
||||||
var responseBody = s.Result.Item2;
|
var responseBody = s.Result.Item2;
|
||||||
|
|
|
@ -369,11 +369,10 @@ namespace LeanCloud
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(cmd).ContinueWith(t =>
|
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(cmd).OnSuccess(t =>
|
||||||
{
|
{
|
||||||
var result = t.Result.Item2;
|
var result = t.Result.Item2;
|
||||||
this.state.ObjectId = result["objectId"].ToString();
|
state.ObjectId = result["objectId"].ToString();
|
||||||
return AVClient.IsSuccessStatusCode(t.Result.Item1);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ namespace LeanCloud
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return AVClient.SerializeJsonString(this.BuildParameters(true));
|
return JsonConvert.SerializeObject(BuildParameters(true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ namespace LeanCloud
|
||||||
/// Whether the AVUser has been authenticated on this device, and the AVUser's session token is expired.
|
/// Whether the AVUser has been authenticated on this device, and the AVUser's session token is expired.
|
||||||
/// Only an authenticated AVUser can be saved and deleted.
|
/// Only an authenticated AVUser can be saved and deleted.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Task<bool> IsAuthenticatedAsync()
|
public Task IsAuthenticatedAsync()
|
||||||
{
|
{
|
||||||
lock (mutex)
|
lock (mutex)
|
||||||
{
|
{
|
||||||
|
@ -71,10 +71,7 @@ namespace LeanCloud
|
||||||
Path = $"users/me?session_token={CurrentSessionToken}",
|
Path = $"users/me?session_token={CurrentSessionToken}",
|
||||||
Method = HttpMethod.Get
|
Method = HttpMethod.Get
|
||||||
};
|
};
|
||||||
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command).ContinueWith(t =>
|
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command);
|
||||||
{
|
|
||||||
return AVClient.IsSuccessStatusCode(t.Result.Item1);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -279,9 +276,9 @@ namespace LeanCloud
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userObjectId">被关注的用户</param>
|
/// <param name="userObjectId">被关注的用户</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<bool> FollowAsync(string userObjectId)
|
public Task FollowAsync(string userObjectId)
|
||||||
{
|
{
|
||||||
return this.FollowAsync(userObjectId, null);
|
return FollowAsync(userObjectId, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -290,7 +287,7 @@ namespace LeanCloud
|
||||||
/// <param name="userObjectId">被关注的用户Id</param>
|
/// <param name="userObjectId">被关注的用户Id</param>
|
||||||
/// <param name="data">关注的时候附加属性</param>
|
/// <param name="data">关注的时候附加属性</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<bool> FollowAsync(string userObjectId, IDictionary<string, object> data)
|
public Task FollowAsync(string userObjectId, IDictionary<string, object> data)
|
||||||
{
|
{
|
||||||
if (data != null)
|
if (data != null)
|
||||||
{
|
{
|
||||||
|
@ -301,10 +298,7 @@ namespace LeanCloud
|
||||||
Method = HttpMethod.Post,
|
Method = HttpMethod.Post,
|
||||||
Content = data
|
Content = data
|
||||||
};
|
};
|
||||||
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command).ContinueWith(t =>
|
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command);
|
||||||
{
|
|
||||||
return AVClient.IsSuccessStatusCode(t.Result.Item1);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -312,16 +306,13 @@ namespace LeanCloud
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userObjectId"></param>
|
/// <param name="userObjectId"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<bool> UnfollowAsync(string userObjectId)
|
public Task UnfollowAsync(string userObjectId)
|
||||||
{
|
{
|
||||||
var command = new AVCommand {
|
var command = new AVCommand {
|
||||||
Path = $"users/{ObjectId}/friendship/{userObjectId}",
|
Path = $"users/{ObjectId}/friendship/{userObjectId}",
|
||||||
Method = HttpMethod.Delete
|
Method = HttpMethod.Delete
|
||||||
};
|
};
|
||||||
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command).ContinueWith(t =>
|
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command);
|
||||||
{
|
|
||||||
return AVClient.IsSuccessStatusCode(t.Result.Item1);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -330,8 +321,9 @@ namespace LeanCloud
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public AVQuery<AVUser> GetFollowerQuery()
|
public AVQuery<AVUser> GetFollowerQuery()
|
||||||
{
|
{
|
||||||
AVQuery<AVUser> query = new AVQuery<AVUser>();
|
AVQuery<AVUser> query = new AVQuery<AVUser> {
|
||||||
query.RelativeUri = string.Format("users/{0}/followers", this.ObjectId);
|
RelativeUri = string.Format("users/{0}/followers", this.ObjectId)
|
||||||
|
};
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1001,9 +993,9 @@ namespace LeanCloud
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="mobilePhoneNumber">The mobile phone number.</param>
|
/// <param name="mobilePhoneNumber">The mobile phone number.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static Task<bool> RequestLogInSmsCodeAsync(string mobilePhoneNumber)
|
public static Task RequestLogInSmsCodeAsync(string mobilePhoneNumber)
|
||||||
{
|
{
|
||||||
return AVUser.RequestLogInSmsCodeAsync(mobilePhoneNumber, CancellationToken.None);
|
return RequestLogInSmsCodeAsync(mobilePhoneNumber, CancellationToken.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1012,9 +1004,9 @@ namespace LeanCloud
|
||||||
/// <param name="mobilePhoneNumber">The mobile phone number.</param>
|
/// <param name="mobilePhoneNumber">The mobile phone number.</param>
|
||||||
/// <param name="validateToken">Validate token.</param>
|
/// <param name="validateToken">Validate token.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static Task<bool> RequestLogInSmsCodeAsync(string mobilePhoneNumber, string validateToken)
|
public static Task RequestLogInSmsCodeAsync(string mobilePhoneNumber, string validateToken)
|
||||||
{
|
{
|
||||||
return AVUser.RequestLogInSmsCodeAsync(mobilePhoneNumber, null, CancellationToken.None);
|
return RequestLogInSmsCodeAsync(mobilePhoneNumber, null, CancellationToken.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1023,7 +1015,7 @@ namespace LeanCloud
|
||||||
/// <param name="mobilePhoneNumber">The mobile phone number.</param>
|
/// <param name="mobilePhoneNumber">The mobile phone number.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static Task<bool> RequestLogInSmsCodeAsync(string mobilePhoneNumber, CancellationToken cancellationToken)
|
public static Task RequestLogInSmsCodeAsync(string mobilePhoneNumber, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return RequestLogInSmsCodeAsync(mobilePhoneNumber, null, cancellationToken);
|
return RequestLogInSmsCodeAsync(mobilePhoneNumber, null, cancellationToken);
|
||||||
}
|
}
|
||||||
|
@ -1035,7 +1027,7 @@ namespace LeanCloud
|
||||||
/// <param name="validateToken">Validate token.</param>
|
/// <param name="validateToken">Validate token.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static Task<bool> RequestLogInSmsCodeAsync(string mobilePhoneNumber, string validateToken, CancellationToken cancellationToken)
|
public static Task RequestLogInSmsCodeAsync(string mobilePhoneNumber, string validateToken, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
Dictionary<string, object> strs = new Dictionary<string, object>()
|
Dictionary<string, object> strs = new Dictionary<string, object>()
|
||||||
{
|
{
|
||||||
|
@ -1050,10 +1042,7 @@ namespace LeanCloud
|
||||||
Method = HttpMethod.Post,
|
Method = HttpMethod.Post,
|
||||||
Content = strs
|
Content = strs
|
||||||
};
|
};
|
||||||
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command).ContinueWith(t =>
|
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command);
|
||||||
{
|
|
||||||
return AVClient.IsSuccessStatusCode(t.Result.Item1);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1189,10 +1178,7 @@ namespace LeanCloud
|
||||||
Method = HttpMethod.Post,
|
Method = HttpMethod.Post,
|
||||||
Content = strs
|
Content = strs
|
||||||
};
|
};
|
||||||
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command).ContinueWith(t =>
|
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command);
|
||||||
{
|
|
||||||
return AVClient.IsSuccessStatusCode(t.Result.Item1);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1201,9 +1187,9 @@ namespace LeanCloud
|
||||||
/// <param name="newPassword">新密码</param>
|
/// <param name="newPassword">新密码</param>
|
||||||
/// <param name="smsCode">6位数验证码</param>
|
/// <param name="smsCode">6位数验证码</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static Task<bool> ResetPasswordBySmsCodeAsync(string newPassword, string smsCode)
|
public static Task ResetPasswordBySmsCodeAsync(string newPassword, string smsCode)
|
||||||
{
|
{
|
||||||
return AVUser.ResetPasswordBySmsCodeAsync(newPassword, smsCode, CancellationToken.None);
|
return ResetPasswordBySmsCodeAsync(newPassword, smsCode, CancellationToken.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1213,7 +1199,7 @@ namespace LeanCloud
|
||||||
/// <param name="smsCode">6位数验证码</param>
|
/// <param name="smsCode">6位数验证码</param>
|
||||||
/// <param name="cancellationToken">cancellationToken</param>
|
/// <param name="cancellationToken">cancellationToken</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static Task<bool> ResetPasswordBySmsCodeAsync(string newPassword, string smsCode, CancellationToken cancellationToken)
|
public static Task ResetPasswordBySmsCodeAsync(string newPassword, string smsCode, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
string currentSessionToken = AVUser.CurrentSessionToken;
|
string currentSessionToken = AVUser.CurrentSessionToken;
|
||||||
Dictionary<string, object> strs = new Dictionary<string, object>()
|
Dictionary<string, object> strs = new Dictionary<string, object>()
|
||||||
|
@ -1225,10 +1211,7 @@ namespace LeanCloud
|
||||||
Method = HttpMethod.Put,
|
Method = HttpMethod.Put,
|
||||||
Content = strs
|
Content = strs
|
||||||
};
|
};
|
||||||
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command).ContinueWith(t =>
|
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command);
|
||||||
{
|
|
||||||
return AVClient.IsSuccessStatusCode(t.Result.Item1);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1236,9 +1219,9 @@ namespace LeanCloud
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="mobilePhoneNumber">手机号</param>
|
/// <param name="mobilePhoneNumber">手机号</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static Task<bool> RequestMobilePhoneVerifyAsync(string mobilePhoneNumber)
|
public static Task RequestMobilePhoneVerifyAsync(string mobilePhoneNumber)
|
||||||
{
|
{
|
||||||
return AVUser.RequestMobilePhoneVerifyAsync(mobilePhoneNumber, null, CancellationToken.None);
|
return RequestMobilePhoneVerifyAsync(mobilePhoneNumber, null, CancellationToken.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1247,9 +1230,9 @@ namespace LeanCloud
|
||||||
/// <param name="mobilePhoneNumber">手机号</param>
|
/// <param name="mobilePhoneNumber">手机号</param>
|
||||||
/// <param name="validateToken">Validate token.</param>
|
/// <param name="validateToken">Validate token.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static Task<bool> RequestMobilePhoneVerifyAsync(string mobilePhoneNumber, string validateToken)
|
public static Task RequestMobilePhoneVerifyAsync(string mobilePhoneNumber, string validateToken)
|
||||||
{
|
{
|
||||||
return AVUser.RequestMobilePhoneVerifyAsync(mobilePhoneNumber, validateToken, CancellationToken.None);
|
return RequestMobilePhoneVerifyAsync(mobilePhoneNumber, validateToken, CancellationToken.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1258,7 +1241,7 @@ namespace LeanCloud
|
||||||
/// <param name="mobilePhoneNumber">手机号</param>
|
/// <param name="mobilePhoneNumber">手机号</param>
|
||||||
/// <param name="cancellationToken">CancellationToken</param>
|
/// <param name="cancellationToken">CancellationToken</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static Task<bool> RequestMobilePhoneVerifyAsync(string mobilePhoneNumber, CancellationToken cancellationToken)
|
public static Task RequestMobilePhoneVerifyAsync(string mobilePhoneNumber, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return RequestMobilePhoneVerifyAsync(mobilePhoneNumber, null, cancellationToken);
|
return RequestMobilePhoneVerifyAsync(mobilePhoneNumber, null, cancellationToken);
|
||||||
}
|
}
|
||||||
|
@ -1270,15 +1253,13 @@ namespace LeanCloud
|
||||||
/// <param name="validateToken">Validate token.</param>
|
/// <param name="validateToken">Validate token.</param>
|
||||||
/// <param name="cancellationToken">CancellationToken</param>
|
/// <param name="cancellationToken">CancellationToken</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static Task<bool> RequestMobilePhoneVerifyAsync(string mobilePhoneNumber, string validateToken, CancellationToken cancellationToken)
|
public static Task RequestMobilePhoneVerifyAsync(string mobilePhoneNumber, string validateToken, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
string currentSessionToken = AVUser.CurrentSessionToken;
|
string currentSessionToken = AVUser.CurrentSessionToken;
|
||||||
Dictionary<string, object> strs = new Dictionary<string, object>()
|
Dictionary<string, object> strs = new Dictionary<string, object> {
|
||||||
{
|
|
||||||
{ "mobilePhoneNumber", mobilePhoneNumber }
|
{ "mobilePhoneNumber", mobilePhoneNumber }
|
||||||
};
|
};
|
||||||
if (String.IsNullOrEmpty(validateToken))
|
if (!string.IsNullOrEmpty(validateToken)) {
|
||||||
{
|
|
||||||
strs.Add("validate_token", validateToken);
|
strs.Add("validate_token", validateToken);
|
||||||
}
|
}
|
||||||
var command = new AVCommand {
|
var command = new AVCommand {
|
||||||
|
@ -1286,10 +1267,7 @@ namespace LeanCloud
|
||||||
Method = HttpMethod.Post,
|
Method = HttpMethod.Post,
|
||||||
Content = strs
|
Content = strs
|
||||||
};
|
};
|
||||||
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command).ContinueWith(t =>
|
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command);
|
||||||
{
|
|
||||||
return AVClient.IsSuccessStatusCode(t.Result.Item1);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1298,9 +1276,9 @@ namespace LeanCloud
|
||||||
/// <param name="code">手机收到的验证码</param>
|
/// <param name="code">手机收到的验证码</param>
|
||||||
/// <param name="mobilePhoneNumber">手机号</param>
|
/// <param name="mobilePhoneNumber">手机号</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static Task<bool> VerifyMobilePhoneAsync(string code, string mobilePhoneNumber)
|
public static Task VerifyMobilePhoneAsync(string code, string mobilePhoneNumber)
|
||||||
{
|
{
|
||||||
return AVUser.VerifyMobilePhoneAsync(code, mobilePhoneNumber, CancellationToken.None);
|
return VerifyMobilePhoneAsync(code, mobilePhoneNumber, CancellationToken.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1310,16 +1288,13 @@ namespace LeanCloud
|
||||||
/// <param name="mobilePhoneNumber">手机号,可选</param>
|
/// <param name="mobilePhoneNumber">手机号,可选</param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static Task<bool> VerifyMobilePhoneAsync(string code, string mobilePhoneNumber, CancellationToken cancellationToken)
|
public static Task VerifyMobilePhoneAsync(string code, string mobilePhoneNumber, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var command = new AVCommand {
|
var command = new AVCommand {
|
||||||
Path = $"verifyMobilePhone/{code.Trim()}?mobilePhoneNumber={mobilePhoneNumber.Trim()}",
|
Path = $"verifyMobilePhone/{code.Trim()}?mobilePhoneNumber={mobilePhoneNumber.Trim()}",
|
||||||
Method = HttpMethod.Post
|
Method = HttpMethod.Post
|
||||||
};
|
};
|
||||||
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command).ContinueWith(t =>
|
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command);
|
||||||
{
|
|
||||||
return AVClient.IsSuccessStatusCode(t.Result.Item1);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1327,16 +1302,13 @@ namespace LeanCloud
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="code">手机收到的验证码</param>
|
/// <param name="code">手机收到的验证码</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static Task<bool> VerifyMobilePhoneAsync(string code)
|
public static Task VerifyMobilePhoneAsync(string code)
|
||||||
{
|
{
|
||||||
var command = new AVCommand {
|
var command = new AVCommand {
|
||||||
Path = $"verifyMobilePhone/{code.Trim()}",
|
Path = $"verifyMobilePhone/{code.Trim()}",
|
||||||
Method = HttpMethod.Post
|
Method = HttpMethod.Post
|
||||||
};
|
};
|
||||||
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command).ContinueWith(t =>
|
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command);
|
||||||
{
|
|
||||||
return AVClient.IsSuccessStatusCode(t.Result.Item1);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1360,7 +1332,7 @@ namespace LeanCloud
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="email">邮箱地址</param>
|
/// <param name="email">邮箱地址</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static Task<bool> RequestEmailVerifyAsync(string email)
|
public static Task RequestEmailVerifyAsync(string email)
|
||||||
{
|
{
|
||||||
Dictionary<string, object> strs = new Dictionary<string, object>()
|
Dictionary<string, object> strs = new Dictionary<string, object>()
|
||||||
{
|
{
|
||||||
|
@ -1371,10 +1343,7 @@ namespace LeanCloud
|
||||||
Method = HttpMethod.Post,
|
Method = HttpMethod.Post,
|
||||||
Content = strs
|
Content = strs
|
||||||
};
|
};
|
||||||
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command).ContinueWith(t =>
|
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command);
|
||||||
{
|
|
||||||
return AVClient.IsSuccessStatusCode(t.Result.Item1);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue