diff --git a/Storage/Storage.Test/JsonTest.cs b/Storage/Storage.Test/JsonTest.cs index be4bee2..67c0998 100644 --- a/Storage/Storage.Test/JsonTest.cs +++ b/Storage/Storage.Test/JsonTest.cs @@ -47,7 +47,7 @@ namespace LeanCloudTests { public void DeserializeList() { var json = "[1, \"hello\", [2, 3, 4], { \"count\": 22 }]"; TestContext.Out.WriteLine(JsonConvert.DeserializeObject(json).GetType()); - var obj = JsonConvert.DeserializeObject(json, new LeanCloudJsonConverter()); + var obj = JsonConvert.DeserializeObject>(json, new LeanCloudJsonConverter()); if (obj is IList) { var arr = obj as List; TestContext.Out.WriteLine(arr.GetType()); diff --git a/Storage/Storage/Internal/Config/Controller/AVCurrentConfigController.cs b/Storage/Storage/Internal/Config/Controller/AVCurrentConfigController.cs index 41ba8d8..2d97a58 100644 --- a/Storage/Storage/Internal/Config/Controller/AVCurrentConfigController.cs +++ b/Storage/Storage/Internal/Config/Controller/AVCurrentConfigController.cs @@ -1,8 +1,7 @@ -using System; -using System.Threading.Tasks; +using System.Threading.Tasks; using System.Threading; using System.Collections.Generic; -using LeanCloud.Storage.Internal; +using Newtonsoft.Json; namespace LeanCloud.Storage.Internal { /// @@ -34,7 +33,7 @@ namespace LeanCloud.Storage.Internal { string propertiesString = tmp as string; if (propertiesString != null) { - var dictionary = AVClient.DeserializeJsonString(propertiesString); + var dictionary = JsonConvert.DeserializeObject>(propertiesString); currentConfig = new AVConfig(dictionary); } else { currentConfig = new AVConfig(); @@ -53,7 +52,7 @@ namespace LeanCloud.Storage.Internal { currentConfig = config; 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)); }).Unwrap().Unwrap(), CancellationToken.None); diff --git a/Storage/Storage/Internal/File/Controller/QiniuFileController.cs b/Storage/Storage/Internal/File/Controller/QiniuFileController.cs index c44f79a..c1de447 100644 --- a/Storage/Storage/Internal/File/Controller/QiniuFileController.cs +++ b/Storage/Storage/Internal/File/Controller/QiniuFileController.cs @@ -7,6 +7,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using System.Net.Http; +using Newtonsoft.Json; namespace LeanCloud.Storage.Internal { @@ -83,12 +84,10 @@ namespace LeanCloud.Storage.Internal var blockSize = remainingSize > BLOCKSIZE ? BLOCKSIZE : remainingSize; return MakeBlock(state, firstChunkBinary, blockSize).ContinueWith(t => { - - var dic = AVClient.ReponseResolve(t.Result, CancellationToken.None); - var ctx = dic.Item2["ctx"].ToString(); - - offset = long.Parse(dic.Item2["offset"].ToString()); - var host = dic.Item2["host"].ToString(); + var dict = JsonConvert.DeserializeObject>(t.Result.Item2, new LeanCloudJsonConverter()); + var ctx = dict["ctx"].ToString(); + offset = long.Parse(dict["offset"].ToString()); + var host = dict["host"].ToString(); state.completed += firstChunkBinary.Length; if (state.completed % BLOCKSIZE == 0 || state.completed == totalSize) @@ -105,11 +104,11 @@ namespace LeanCloud.Storage.Internal var chunkBinary = GetChunkBinary(state.completed, dataStream); return PutChunk(state, chunkBinary, context, offset).ContinueWith(t => { - var dic = AVClient.ReponseResolve(t.Result, CancellationToken.None); - var ctx = dic.Item2["ctx"].ToString(); + var dict = JsonConvert.DeserializeObject>(t.Result.Item2, new LeanCloudJsonConverter()); + var ctx = dict["ctx"].ToString(); - offset = long.Parse(dic.Item2["offset"].ToString()); - var host = dic.Item2["host"].ToString(); + offset = long.Parse(dict["offset"].ToString()); + var host = dict["host"].ToString(); state.completed += chunkBinary.Length; if (state.completed % BLOCKSIZE == 0 || state.completed == totalSize) { diff --git a/Storage/Storage/Public/AVClient.cs b/Storage/Storage/Public/AVClient.cs index 362cf22..e148f44 100644 --- a/Storage/Storage/Public/AVClient.cs +++ b/Storage/Storage/Public/AVClient.cs @@ -170,11 +170,7 @@ namespace LeanCloud private static readonly object mutex = new object(); - static AVClient() - { - versionString = "net-portable-" + Version; - - //AVModuleController.Instance.ScanForModules(); + static AVClient() { } /// @@ -197,7 +193,6 @@ namespace LeanCloud } } - private static readonly string versionString; /// /// 当前 SDK 版本号 /// @@ -205,7 +200,7 @@ namespace LeanCloud { get { - return versionString; + return "net-v0.1.0"; } } @@ -244,40 +239,19 @@ namespace LeanCloud /// public static void PrintLog(string log) { - if (AVClient.LogTracker != null) - { - AVClient.LogTracker(log); - } + LogTracker?.Invoke(log); } - static bool useProduction = true; /// /// Gets or sets a value indicating whether send the request to production server or staging server. /// /// true if use production; otherwise, false. - public static bool UseProduction - { - get - { - return useProduction; - } - set - { - useProduction = value; - } + public static bool UseProduction { + get; set; } - static bool useMasterKey = false; - public static bool UseMasterKey - { - get - { - return useMasterKey; - } - set - { - useMasterKey = value; - } + public static bool UseMasterKey { + get; set; } /// @@ -363,90 +337,5 @@ namespace LeanCloud } return dict; } - - internal static IDictionary DeserializeJsonString(string jsonData) - { - return JsonConvert.DeserializeObject>(jsonData, new LeanCloudJsonConverter()); - } - - internal static string SerializeJsonString(IDictionary jsonData) - { - return JsonConvert.SerializeObject(jsonData); - } - - //public static Task> HttpGetAsync(Uri uri) - //{ - // return RequestAsync(uri, "GET", null, body: null, contentType: null, cancellationToken: CancellationToken.None); - //} - - //public static Task> RequestAsync(Uri uri, string method, IList> headers, IDictionary 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> RequestAsync(Uri uri, string method, IList> 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> ReponseResolve(Tuple response, CancellationToken cancellationToken) - { - Tuple result = response; - HttpStatusCode code = result.Item1; - string item2 = result.Item2; - - if (item2 == null) - { - cancellationToken.ThrowIfCancellationRequested(); - return new Tuple>(code, null); - } - IDictionary strs = null; - try - { - - strs = !item2.StartsWith("[", StringComparison.Ordinal) ? AVClient.DeserializeJsonString(item2) : new Dictionary() - { - { "results", JsonConvert.DeserializeObject>(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>(code, strs); - } - - internal static Task>> RunCommandAsync(AVCommand command) - { - return AVPlugins.Instance.CommandRunner.RunCommandAsync>(command); - } - - internal static bool IsSuccessStatusCode(HttpStatusCode responseStatus) { - return (responseStatus >= HttpStatusCode.OK) && (responseStatus <= HttpStatusCode.PartialContent); - } } } diff --git a/Storage/Storage/Public/AVCloud.cs b/Storage/Storage/Public/AVCloud.cs index 842bb55..7f3f816 100644 --- a/Storage/Storage/Public/AVCloud.cs +++ b/Storage/Storage/Public/AVCloud.cs @@ -87,7 +87,7 @@ namespace LeanCloud { /// 进行的操作名称。 /// 验证码失效时间。 /// - public static Task 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); } @@ -102,7 +102,7 @@ namespace LeanCloud { /// 进行的操作名称。 /// 验证码失效时间。 /// Cancellation token。 - public static Task 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)) { @@ -130,10 +130,7 @@ namespace LeanCloud { Method = HttpMethod.Post, Content = strs }; - return AVPlugins.Instance.CommandRunner.RunCommandAsync>(command, cancellationToken: cancellationToken).ContinueWith(t => - { - return AVClient.IsSuccessStatusCode(t.Result.Item1); - }); + return AVPlugins.Instance.CommandRunner.RunCommandAsync>(command, cancellationToken: cancellationToken); } /// @@ -141,9 +138,9 @@ namespace LeanCloud { /// /// 是否发送成功。 /// 手机号。 - public static Task 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 { /// 是否发送成功。 /// 手机号。 /// Cancellation Token. - public static Task 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); } /// @@ -169,7 +166,7 @@ namespace LeanCloud { /// Sms's sign. /// Cancellation token. /// - public static Task RequestSMSCodeAsync( + public static Task RequestSMSCodeAsync( string mobilePhoneNumber, string template, IDictionary env, @@ -204,10 +201,7 @@ namespace LeanCloud { Method = HttpMethod.Post, Content = strs }; - return AVPlugins.Instance.CommandRunner.RunCommandAsync>(command).ContinueWith(t => - { - return AVClient.IsSuccessStatusCode(t.Result.Item1); - }); + return AVPlugins.Instance.CommandRunner.RunCommandAsync>(command); } /// @@ -215,7 +209,7 @@ namespace LeanCloud { /// /// /// - public static Task RequestVoiceCodeAsync(string mobilePhoneNumber) + public static Task RequestVoiceCodeAsync(string mobilePhoneNumber) { if (string.IsNullOrEmpty(mobilePhoneNumber)) { @@ -234,10 +228,7 @@ namespace LeanCloud { Content = body }; - return AVPlugins.Instance.CommandRunner.RunCommandAsync>(command).ContinueWith(t => - { - return AVClient.IsSuccessStatusCode(t.Result.Item1); - }); + return AVPlugins.Instance.CommandRunner.RunCommandAsync>(command); } /// @@ -246,9 +237,9 @@ namespace LeanCloud { /// 是否验证通过。 /// 手机号 /// 验证码。 - public static Task 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); } /// @@ -258,15 +249,12 @@ namespace LeanCloud { /// 验证码。 /// 手机号 /// Cancellation token. - public static Task VerifySmsCodeAsync(string code, string mobilePhoneNumber, CancellationToken cancellationToken) + public static Task VerifySmsCodeAsync(string code, string mobilePhoneNumber, CancellationToken cancellationToken) { var command = new AVCommand { Path = $"verifySmsCode/{code.Trim()}?mobilePhoneNumber={mobilePhoneNumber.Trim()}", }; - return AVPlugins.Instance.CommandRunner.RunCommandAsync>(command, cancellationToken: cancellationToken).ContinueWith(t => - { - return AVClient.IsSuccessStatusCode(t.Result.Item1); - }); + return AVPlugins.Instance.CommandRunner.RunCommandAsync>(command, cancellationToken: cancellationToken); } /// @@ -499,8 +487,7 @@ namespace LeanCloud { Method = HttpMethod.Post, Content = encodedParameters }; - return AVClient.RunCommandAsync(command); - + return AVPlugins.Instance.CommandRunner.RunCommandAsync>(command); }).Unwrap().OnSuccess(s => { var responseBody = s.Result.Item2; diff --git a/Storage/Storage/Public/AVFile.cs b/Storage/Storage/Public/AVFile.cs index c9e4f4b..3a1ec57 100644 --- a/Storage/Storage/Public/AVFile.cs +++ b/Storage/Storage/Public/AVFile.cs @@ -369,11 +369,10 @@ namespace LeanCloud }; } - return AVPlugins.Instance.CommandRunner.RunCommandAsync>(cmd).ContinueWith(t => + return AVPlugins.Instance.CommandRunner.RunCommandAsync>(cmd).OnSuccess(t => { var result = t.Result.Item2; - this.state.ObjectId = result["objectId"].ToString(); - return AVClient.IsSuccessStatusCode(t.Result.Item1); + state.ObjectId = result["objectId"].ToString(); }); } diff --git a/Storage/Storage/Public/AVQuery.cs b/Storage/Storage/Public/AVQuery.cs index 621fc12..7512c39 100644 --- a/Storage/Storage/Public/AVQuery.cs +++ b/Storage/Storage/Public/AVQuery.cs @@ -69,7 +69,7 @@ namespace LeanCloud { get { - return AVClient.SerializeJsonString(this.BuildParameters(true)); + return JsonConvert.SerializeObject(BuildParameters(true)); } } diff --git a/Storage/Storage/Public/AVUser.cs b/Storage/Storage/Public/AVUser.cs index bbc55be..d2fb783 100644 --- a/Storage/Storage/Public/AVUser.cs +++ b/Storage/Storage/Public/AVUser.cs @@ -58,7 +58,7 @@ namespace LeanCloud /// 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. /// - public Task IsAuthenticatedAsync() + public Task IsAuthenticatedAsync() { lock (mutex) { @@ -71,10 +71,7 @@ namespace LeanCloud Path = $"users/me?session_token={CurrentSessionToken}", Method = HttpMethod.Get }; - return AVPlugins.Instance.CommandRunner.RunCommandAsync>(command).ContinueWith(t => - { - return AVClient.IsSuccessStatusCode(t.Result.Item1); - }); + return AVPlugins.Instance.CommandRunner.RunCommandAsync>(command); } /// @@ -279,9 +276,9 @@ namespace LeanCloud /// /// 被关注的用户 /// - public Task FollowAsync(string userObjectId) + public Task FollowAsync(string userObjectId) { - return this.FollowAsync(userObjectId, null); + return FollowAsync(userObjectId, null); } /// @@ -290,7 +287,7 @@ namespace LeanCloud /// 被关注的用户Id /// 关注的时候附加属性 /// - public Task FollowAsync(string userObjectId, IDictionary data) + public Task FollowAsync(string userObjectId, IDictionary data) { if (data != null) { @@ -301,10 +298,7 @@ namespace LeanCloud Method = HttpMethod.Post, Content = data }; - return AVPlugins.Instance.CommandRunner.RunCommandAsync>(command).ContinueWith(t => - { - return AVClient.IsSuccessStatusCode(t.Result.Item1); - }); + return AVPlugins.Instance.CommandRunner.RunCommandAsync>(command); } /// @@ -312,16 +306,13 @@ namespace LeanCloud /// /// /// - public Task UnfollowAsync(string userObjectId) + public Task UnfollowAsync(string userObjectId) { var command = new AVCommand { Path = $"users/{ObjectId}/friendship/{userObjectId}", Method = HttpMethod.Delete }; - return AVPlugins.Instance.CommandRunner.RunCommandAsync>(command).ContinueWith(t => - { - return AVClient.IsSuccessStatusCode(t.Result.Item1); - }); + return AVPlugins.Instance.CommandRunner.RunCommandAsync>(command); } /// @@ -330,8 +321,9 @@ namespace LeanCloud /// public AVQuery GetFollowerQuery() { - AVQuery query = new AVQuery(); - query.RelativeUri = string.Format("users/{0}/followers", this.ObjectId); + AVQuery query = new AVQuery { + RelativeUri = string.Format("users/{0}/followers", this.ObjectId) + }; return query; } @@ -1001,9 +993,9 @@ namespace LeanCloud /// /// The mobile phone number. /// - public static Task RequestLogInSmsCodeAsync(string mobilePhoneNumber) + public static Task RequestLogInSmsCodeAsync(string mobilePhoneNumber) { - return AVUser.RequestLogInSmsCodeAsync(mobilePhoneNumber, CancellationToken.None); + return RequestLogInSmsCodeAsync(mobilePhoneNumber, CancellationToken.None); } /// @@ -1012,9 +1004,9 @@ namespace LeanCloud /// The mobile phone number. /// Validate token. /// - public static Task 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); } /// @@ -1023,7 +1015,7 @@ namespace LeanCloud /// The mobile phone number. /// The cancellation token. /// - public static Task RequestLogInSmsCodeAsync(string mobilePhoneNumber, CancellationToken cancellationToken) + public static Task RequestLogInSmsCodeAsync(string mobilePhoneNumber, CancellationToken cancellationToken) { return RequestLogInSmsCodeAsync(mobilePhoneNumber, null, cancellationToken); } @@ -1035,7 +1027,7 @@ namespace LeanCloud /// Validate token. /// The cancellation token. /// - public static Task RequestLogInSmsCodeAsync(string mobilePhoneNumber, string validateToken, CancellationToken cancellationToken) + public static Task RequestLogInSmsCodeAsync(string mobilePhoneNumber, string validateToken, CancellationToken cancellationToken) { Dictionary strs = new Dictionary() { @@ -1050,10 +1042,7 @@ namespace LeanCloud Method = HttpMethod.Post, Content = strs }; - return AVPlugins.Instance.CommandRunner.RunCommandAsync>(command).ContinueWith(t => - { - return AVClient.IsSuccessStatusCode(t.Result.Item1); - }); + return AVPlugins.Instance.CommandRunner.RunCommandAsync>(command); } /// @@ -1189,10 +1178,7 @@ namespace LeanCloud Method = HttpMethod.Post, Content = strs }; - return AVPlugins.Instance.CommandRunner.RunCommandAsync>(command).ContinueWith(t => - { - return AVClient.IsSuccessStatusCode(t.Result.Item1); - }); + return AVPlugins.Instance.CommandRunner.RunCommandAsync>(command); } /// @@ -1201,9 +1187,9 @@ namespace LeanCloud /// 新密码 /// 6位数验证码 /// - public static Task 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); } /// @@ -1213,7 +1199,7 @@ namespace LeanCloud /// 6位数验证码 /// cancellationToken /// - public static Task ResetPasswordBySmsCodeAsync(string newPassword, string smsCode, CancellationToken cancellationToken) + public static Task ResetPasswordBySmsCodeAsync(string newPassword, string smsCode, CancellationToken cancellationToken) { string currentSessionToken = AVUser.CurrentSessionToken; Dictionary strs = new Dictionary() @@ -1225,10 +1211,7 @@ namespace LeanCloud Method = HttpMethod.Put, Content = strs }; - return AVPlugins.Instance.CommandRunner.RunCommandAsync>(command).ContinueWith(t => - { - return AVClient.IsSuccessStatusCode(t.Result.Item1); - }); + return AVPlugins.Instance.CommandRunner.RunCommandAsync>(command); } /// @@ -1236,9 +1219,9 @@ namespace LeanCloud /// /// 手机号 /// - public static Task RequestMobilePhoneVerifyAsync(string mobilePhoneNumber) + public static Task RequestMobilePhoneVerifyAsync(string mobilePhoneNumber) { - return AVUser.RequestMobilePhoneVerifyAsync(mobilePhoneNumber, null, CancellationToken.None); + return RequestMobilePhoneVerifyAsync(mobilePhoneNumber, null, CancellationToken.None); } /// @@ -1247,9 +1230,9 @@ namespace LeanCloud /// 手机号 /// Validate token. /// - public static Task 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); } /// @@ -1258,7 +1241,7 @@ namespace LeanCloud /// 手机号 /// CancellationToken /// - public static Task RequestMobilePhoneVerifyAsync(string mobilePhoneNumber, CancellationToken cancellationToken) + public static Task RequestMobilePhoneVerifyAsync(string mobilePhoneNumber, CancellationToken cancellationToken) { return RequestMobilePhoneVerifyAsync(mobilePhoneNumber, null, cancellationToken); } @@ -1270,15 +1253,13 @@ namespace LeanCloud /// Validate token. /// CancellationToken /// - public static Task RequestMobilePhoneVerifyAsync(string mobilePhoneNumber, string validateToken, CancellationToken cancellationToken) + public static Task RequestMobilePhoneVerifyAsync(string mobilePhoneNumber, string validateToken, CancellationToken cancellationToken) { string currentSessionToken = AVUser.CurrentSessionToken; - Dictionary strs = new Dictionary() - { + Dictionary strs = new Dictionary { { "mobilePhoneNumber", mobilePhoneNumber } }; - if (String.IsNullOrEmpty(validateToken)) - { + if (!string.IsNullOrEmpty(validateToken)) { strs.Add("validate_token", validateToken); } var command = new AVCommand { @@ -1286,10 +1267,7 @@ namespace LeanCloud Method = HttpMethod.Post, Content = strs }; - return AVPlugins.Instance.CommandRunner.RunCommandAsync>(command).ContinueWith(t => - { - return AVClient.IsSuccessStatusCode(t.Result.Item1); - }); + return AVPlugins.Instance.CommandRunner.RunCommandAsync>(command); } /// @@ -1298,9 +1276,9 @@ namespace LeanCloud /// 手机收到的验证码 /// 手机号 /// - public static Task 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); } /// @@ -1310,16 +1288,13 @@ namespace LeanCloud /// 手机号,可选 /// /// - public static Task VerifyMobilePhoneAsync(string code, string mobilePhoneNumber, CancellationToken cancellationToken) + public static Task VerifyMobilePhoneAsync(string code, string mobilePhoneNumber, CancellationToken cancellationToken) { var command = new AVCommand { Path = $"verifyMobilePhone/{code.Trim()}?mobilePhoneNumber={mobilePhoneNumber.Trim()}", Method = HttpMethod.Post }; - return AVPlugins.Instance.CommandRunner.RunCommandAsync>(command).ContinueWith(t => - { - return AVClient.IsSuccessStatusCode(t.Result.Item1); - }); + return AVPlugins.Instance.CommandRunner.RunCommandAsync>(command); } /// @@ -1327,16 +1302,13 @@ namespace LeanCloud /// /// 手机收到的验证码 /// - public static Task VerifyMobilePhoneAsync(string code) + public static Task VerifyMobilePhoneAsync(string code) { var command = new AVCommand { Path = $"verifyMobilePhone/{code.Trim()}", Method = HttpMethod.Post }; - return AVPlugins.Instance.CommandRunner.RunCommandAsync>(command).ContinueWith(t => - { - return AVClient.IsSuccessStatusCode(t.Result.Item1); - }); + return AVPlugins.Instance.CommandRunner.RunCommandAsync>(command); } /// @@ -1360,7 +1332,7 @@ namespace LeanCloud /// /// 邮箱地址 /// - public static Task RequestEmailVerifyAsync(string email) + public static Task RequestEmailVerifyAsync(string email) { Dictionary strs = new Dictionary() { @@ -1371,10 +1343,7 @@ namespace LeanCloud Method = HttpMethod.Post, Content = strs }; - return AVPlugins.Instance.CommandRunner.RunCommandAsync>(command).ContinueWith(t => - { - return AVClient.IsSuccessStatusCode(t.Result.Item1); - }); + return AVPlugins.Instance.CommandRunner.RunCommandAsync>(command); } #endregion