* AVCloudCodeController.cs: chore: 去掉多余的 SessionToken 参数

* AVFile.cs:
* AVCloud.cs:
* AVObject.cs:
* AVLeaderboard.cs:
* XamarinAttributes.cs:
* AVFileController.cs:
* AVQueryController.cs:
* AVObjectController.cs:
oneRain 2019-08-28 16:24:06 +08:00
parent 2a735cd89a
commit a951d8e6c5
9 changed files with 51 additions and 115 deletions

View File

@ -9,7 +9,6 @@ namespace LeanCloud.Storage.Internal {
public class AVCloudCodeController {
public Task<T> CallFunctionAsync<T>(string name,
IDictionary<string, object> parameters,
string sessionToken,
CancellationToken cancellationToken) {
var command = new EngineCommand {
Path = $"functions/{Uri.EscapeUriString(name)}",
@ -25,13 +24,13 @@ namespace LeanCloud.Storage.Internal {
});
}
public Task<T> RPCFunction<T>(string name, IDictionary<string, object> parameters, string sessionToken, CancellationToken cancellationToken) {
public Task<T> RPCFunction<T>(string name, IDictionary<string, object> parameters, CancellationToken cancellationToken) {
var command = new EngineCommand {
Path = $"call/{Uri.EscapeUriString(name)}",
Method = HttpMethod.Post,
Content = parameters
};
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command, cancellationToken: cancellationToken).OnSuccess(t => {
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command, cancellationToken).OnSuccess(t => {
var decoded = AVDecoder.Instance.Decode(t.Result.Item2) as IDictionary<string, object>;
if (!decoded.ContainsKey("result")) {
return default;

View File

@ -19,9 +19,8 @@ namespace LeanCloud.Storage.Internal {
public Task<FileState> SaveAsync(FileState state,
Stream dataStream,
String sessionToken,
IProgress<AVUploadProgressEventArgs> progress,
CancellationToken cancellationToken = default(CancellationToken)) {
CancellationToken cancellationToken = default) {
if (state.Url != null) {
// !isDirty
return Task<FileState>.FromResult(state);
@ -43,7 +42,7 @@ namespace LeanCloud.Storage.Internal {
}).Unwrap();
}
public Task DeleteAsync(FileState state, string sessionToken, CancellationToken cancellationToken) {
public Task DeleteAsync(FileState state, CancellationToken cancellationToken) {
var command = new AVCommand {
Path = $"files/{state.ObjectId}",
Method = HttpMethod.Delete
@ -68,7 +67,7 @@ namespace LeanCloud.Storage.Internal {
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command);
}
public Task<FileState> GetAsync(string objectId, string sessionToken, CancellationToken cancellationToken) {
public Task<FileState> GetAsync(string objectId, CancellationToken cancellationToken) {
var command = new AVCommand {
Path = $"files/{objectId}",
Method = HttpMethod.Get

View File

@ -8,21 +8,8 @@ using System.Net.Http;
namespace LeanCloud.Storage.Internal {
public class AVObjectController {
public Task<IObjectState> FetchAsync(IObjectState state,
string sessionToken,
CancellationToken cancellationToken) {
var command = new AVCommand {
Path = $"classes/{Uri.EscapeDataString(state.ClassName)}/{Uri.EscapeDataString(state.ObjectId)}",
Method = HttpMethod.Get
};
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command, cancellationToken: cancellationToken).OnSuccess(t => {
return AVObjectCoder.Instance.Decode(t.Result.Item2, AVDecoder.Instance);
});
}
public Task<IObjectState> FetchAsync(IObjectState state,
IDictionary<string, object> queryString,
string sessionToken,
CancellationToken cancellationToken) {
var command = new AVCommand {
Path = $"classes/{Uri.EscapeDataString(state.ClassName)}/{Uri.EscapeDataString(state.ObjectId)}?{AVClient.BuildQueryString(queryString)}",
@ -37,7 +24,6 @@ namespace LeanCloud.Storage.Internal {
IDictionary<string, IAVFieldOperation> operations,
bool fetchWhenSave,
AVQuery<AVObject> query,
string sessionToken,
CancellationToken cancellationToken) {
var objectJSON = AVObject.ToJSONObjectForSaving(operations);
@ -69,7 +55,6 @@ namespace LeanCloud.Storage.Internal {
public IList<Task<IObjectState>> SaveAllAsync(IList<IObjectState> states,
IList<IDictionary<string, IAVFieldOperation>> operationsList,
string sessionToken,
CancellationToken cancellationToken) {
var requests = states
@ -80,7 +65,7 @@ namespace LeanCloud.Storage.Internal {
})
.ToList();
var batchTasks = ExecuteBatchRequests(requests, sessionToken, cancellationToken);
var batchTasks = ExecuteBatchRequests(requests, cancellationToken);
var stateTasks = new List<Task<IObjectState>>();
foreach (var task in batchTasks) {
stateTasks.Add(task.OnSuccess(t => {
@ -92,7 +77,6 @@ namespace LeanCloud.Storage.Internal {
}
public Task DeleteAsync(IObjectState state,
string sessionToken,
CancellationToken cancellationToken) {
var command = new AVCommand {
Path = $"classes/{state.ClassName}/{state.ObjectId}",
@ -102,7 +86,6 @@ namespace LeanCloud.Storage.Internal {
}
public IList<Task> DeleteAllAsync(IList<IObjectState> states,
string sessionToken,
CancellationToken cancellationToken) {
var requests = states
.Where(item => item.ObjectId != null)
@ -111,13 +94,12 @@ namespace LeanCloud.Storage.Internal {
Method = HttpMethod.Delete
})
.ToList();
return ExecuteBatchRequests(requests, sessionToken, cancellationToken).Cast<Task>().ToList();
return ExecuteBatchRequests(requests, cancellationToken).Cast<Task>().ToList();
}
// TODO (hallucinogen): move this out to a class to be used by Analytics
private const int MaximumBatchSize = 50;
internal IList<Task<IDictionary<string, object>>> ExecuteBatchRequests(IList<AVCommand> requests,
string sessionToken,
CancellationToken cancellationToken) {
var tasks = new List<Task<IDictionary<string, object>>>();
int batchSize = requests.Count;
@ -127,17 +109,16 @@ namespace LeanCloud.Storage.Internal {
var process = remaining.Take(MaximumBatchSize).ToList();
remaining = remaining.Skip(MaximumBatchSize);
tasks.AddRange(ExecuteBatchRequest(process, sessionToken, cancellationToken));
tasks.AddRange(ExecuteBatchRequest(process, cancellationToken));
batchSize = remaining.Count();
}
tasks.AddRange(ExecuteBatchRequest(remaining.ToList(), sessionToken, cancellationToken));
tasks.AddRange(ExecuteBatchRequest(remaining.ToList(), cancellationToken));
return tasks;
}
private IList<Task<IDictionary<string, object>>> ExecuteBatchRequest(IList<AVCommand> requests,
string sessionToken,
CancellationToken cancellationToken) {
var tasks = new List<Task<IDictionary<string, object>>>();
int batchSize = requests.Count;

View File

@ -27,7 +27,6 @@ namespace LeanCloud.Storage.Internal {
public async Task<IObjectState> FirstAsync<T>(AVQuery<T> query,
AVUser user,
CancellationToken cancellationToken) where T : AVObject {
string sessionToken = user?.SessionToken;
var parameters = query.BuildParameters();
parameters["limit"] = 1;
IList<object> items = await FindAsync<IList<object>>(query.Path, query.BuildParameters(), "results", cancellationToken);

View File

@ -400,21 +400,21 @@ namespace LeanCloud.Storage.Internal {
typeof(FlexibleDictionaryWrapper<object, DateTime>),
typeof(FlexibleDictionaryWrapper<DateTime, object>),
(Action)(() => AVCloud.CallFunctionAsync<object>(null, null, null,CancellationToken.None)),
(Action)(() => AVCloud.CallFunctionAsync<bool>(null, null,null, CancellationToken.None)),
(Action)(() => AVCloud.CallFunctionAsync<byte>(null, null,null, CancellationToken.None)),
(Action)(() => AVCloud.CallFunctionAsync<sbyte>(null, null,null ,CancellationToken.None)),
(Action)(() => AVCloud.CallFunctionAsync<short>(null, null,null, CancellationToken.None)),
(Action)(() => AVCloud.CallFunctionAsync<ushort>(null, null,null, CancellationToken.None)),
(Action)(() => AVCloud.CallFunctionAsync<int>(null, null,null, CancellationToken.None)),
(Action)(() => AVCloud.CallFunctionAsync<uint>(null, null,null, CancellationToken.None)),
(Action)(() => AVCloud.CallFunctionAsync<long>(null, null, null,CancellationToken.None)),
(Action)(() => AVCloud.CallFunctionAsync<ulong>(null, null,null ,CancellationToken.None)),
(Action)(() => AVCloud.CallFunctionAsync<char>(null, null,null, CancellationToken.None)),
(Action)(() => AVCloud.CallFunctionAsync<double>(null, null,null, CancellationToken.None)),
(Action)(() => AVCloud.CallFunctionAsync<float>(null, null,null, CancellationToken.None)),
(Action)(() => AVCloud.CallFunctionAsync<IDictionary<string, object>>(null, null,null, CancellationToken.None)),
(Action)(() => AVCloud.CallFunctionAsync<IList<object>>(null, null,null, CancellationToken.None)),
(Action)(() => AVCloud.CallFunctionAsync<object>(null, null, CancellationToken.None)),
(Action)(() => AVCloud.CallFunctionAsync<bool>(null, null, CancellationToken.None)),
(Action)(() => AVCloud.CallFunctionAsync<byte>(null, null, CancellationToken.None)),
(Action)(() => AVCloud.CallFunctionAsync<sbyte>(null, null ,CancellationToken.None)),
(Action)(() => AVCloud.CallFunctionAsync<short>(null, null, CancellationToken.None)),
(Action)(() => AVCloud.CallFunctionAsync<ushort>(null, null, CancellationToken.None)),
(Action)(() => AVCloud.CallFunctionAsync<int>(null, null, CancellationToken.None)),
(Action)(() => AVCloud.CallFunctionAsync<uint>(null, null, CancellationToken.None)),
(Action)(() => AVCloud.CallFunctionAsync<long>(null, null,CancellationToken.None)),
(Action)(() => AVCloud.CallFunctionAsync<ulong>(null, null, CancellationToken.None)),
(Action)(() => AVCloud.CallFunctionAsync<char>(null, null, CancellationToken.None)),
(Action)(() => AVCloud.CallFunctionAsync<double>(null, null, CancellationToken.None)),
(Action)(() => AVCloud.CallFunctionAsync<float>(null, null, CancellationToken.None)),
(Action)(() => AVCloud.CallFunctionAsync<IDictionary<string, object>>(null, null, CancellationToken.None)),
(Action)(() => AVCloud.CallFunctionAsync<IList<object>>(null, null, CancellationToken.None)),
typeof(FlexibleListWrapper<object, AVGeoPoint>),
typeof(FlexibleListWrapper<AVGeoPoint, object>),

View File

@ -1,11 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using LeanCloud.Storage.Internal;
using System.Net.Http;
using Newtonsoft.Json;
namespace LeanCloud {
/// <summary>
@ -38,13 +36,10 @@ namespace LeanCloud {
/// <param name="parameters">The parameters to send to the cloud function. This
/// dictionary can contain anything that could be passed into a AVObject except for
/// AVObjects themselves.</param>
/// <param name="sesstionToken"></param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the cloud call.</returns>
public static Task<T> CallFunctionAsync<T>(String name, IDictionary<string, object> parameters = null, string sesstionToken = null, CancellationToken cancellationToken = default(CancellationToken)) {
return CloudCodeController.CallFunctionAsync<T>(name,
parameters, AVUser.CurrentUser?.SessionToken,
cancellationToken);
public static Task<T> CallFunctionAsync<T>(String name, IDictionary<string, object> parameters = null, CancellationToken cancellationToken = default) {
return CloudCodeController.CallFunctionAsync<T>(name, parameters, cancellationToken);
}
/// <summary>
@ -53,28 +48,12 @@ namespace LeanCloud {
/// <typeparam name="T"></typeparam>
/// <param name="name"></param>
/// <param name="parameters"></param>
/// <param name="sesstionToken"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static Task<T> RPCFunctionAsync<T>(String name, IDictionary<string, object> parameters = null, string sesstionToken = null, CancellationToken cancellationToken = default(CancellationToken)) {
return CloudCodeController.RPCFunction<T>(name,
parameters, AVUser.CurrentUser?.SessionToken,
cancellationToken);
public static Task<T> RPCFunctionAsync<T>(String name, IDictionary<string, object> parameters = null, CancellationToken cancellationToken = default) {
return CloudCodeController.RPCFunction<T>(name, parameters, cancellationToken);
}
/// <summary>
/// 请求短信认证。
/// </summary>
/// <param name="mobilePhoneNumber">手机号。</param>
/// <param name="name">应用名称。</param>
/// <param name="op">进行的操作名称。</param>
/// <param name="ttl">验证码失效时间。</param>
/// <returns></returns>
public static Task RequestSMSCodeAsync(string mobilePhoneNumber, string name, string op, int ttl = 10) {
return RequestSMSCodeAsync(mobilePhoneNumber, name, op, ttl, CancellationToken.None);
}
/// <summary>
/// 请求发送验证码。
/// </summary>
@ -84,7 +63,7 @@ namespace LeanCloud {
/// <param name="op">进行的操作名称。</param>
/// <param name="ttl">验证码失效时间。</param>
/// <param name="cancellationToken">Cancellation token。</param>
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) {
if (string.IsNullOrEmpty(mobilePhoneNumber)) {
throw new AVException(AVException.ErrorCode.MobilePhoneInvalid, "Moblie Phone number is invalid.", null);
}
@ -107,7 +86,7 @@ namespace LeanCloud {
Method = HttpMethod.Post,
Content = strs
};
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command, cancellationToken: cancellationToken);
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command, cancellationToken);
}
/// <summary>
@ -139,15 +118,13 @@ namespace LeanCloud {
/// <param name="template">Sms's template</param>
/// <param name="env">Template variables env.</param>
/// <param name="sign">Sms's sign.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns></returns>
public static Task RequestSMSCodeAsync(
string mobilePhoneNumber,
string template,
IDictionary<string, object> env,
string sign = "",
string validateToken = "",
CancellationToken cancellationToken = default(CancellationToken)) {
string validateToken = "") {
if (string.IsNullOrEmpty(mobilePhoneNumber)) {
throw new AVException(AVException.ErrorCode.MobilePhoneInvalid, "Moblie Phone number is invalid.", null);
@ -220,7 +197,7 @@ namespace LeanCloud {
var command = new AVCommand {
Path = $"verifySmsCode/{code.Trim()}?mobilePhoneNumber={mobilePhoneNumber.Trim()}",
};
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command, cancellationToken: cancellationToken);
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command, cancellationToken);
}
/// <summary>
@ -243,7 +220,7 @@ namespace LeanCloud {
/// <param name="code">User's input of this captcha.</param>
/// <param name="cancellationToken">CancellationToken.</param>
/// <returns></returns>
public Task VerifyAsync(string code, CancellationToken cancellationToken = default(CancellationToken)) {
public Task VerifyAsync(string code) {
return AVCloud.VerifyCaptchaAsync(code, Token);
}
}
@ -255,13 +232,13 @@ namespace LeanCloud {
/// <param name="height">captcha image height.</param>
/// <param name="cancellationToken">CancellationToken.</param>
/// <returns>an instance of Captcha.</returns>
public static Task<Captcha> RequestCaptchaAsync(int width = 85, int height = 30, CancellationToken cancellationToken = default(CancellationToken)) {
public static Task<Captcha> RequestCaptchaAsync(int width = 85, int height = 30, CancellationToken cancellationToken = default) {
var path = String.Format("requestCaptcha?width={0}&height={1}", width, height);
var command = new AVCommand {
Path = $"requestCaptcha?width={width}&height={height}",
Method = HttpMethod.Get
};
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command, cancellationToken: cancellationToken).OnSuccess(t => {
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command, cancellationToken).OnSuccess(t => {
var decoded = AVDecoder.Instance.Decode(t.Result.Item2) as IDictionary<string, object>;
return new Captcha() {
Token = decoded["captcha_token"] as string,
@ -277,7 +254,7 @@ namespace LeanCloud {
/// <param name="code">User's input of this captcha.</param>
/// <param name="cancellationToken">CancellationToken.</param>
/// <returns></returns>
public static Task<string> VerifyCaptchaAsync(string code, string token, CancellationToken cancellationToken = default(CancellationToken)) {
public static Task<string> VerifyCaptchaAsync(string code, string token, CancellationToken cancellationToken = default) {
var data = new Dictionary<string, object> {
{ "captcha_token", token },
{ "captcha_code", code },
@ -287,7 +264,7 @@ namespace LeanCloud {
Method = HttpMethod.Post,
Content = data
};
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command, cancellationToken: cancellationToken).ContinueWith(t => {
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command, cancellationToken).ContinueWith(t => {
if (!t.Result.Item2.ContainsKey("validate_token"))
throw new KeyNotFoundException("validate_token");
return t.Result.Item2["validate_token"] as string;
@ -299,12 +276,12 @@ namespace LeanCloud {
/// </summary>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static Task<IDictionary<string, object>> GetCustomParametersAsync(CancellationToken cancellationToken = default(CancellationToken)) {
public static Task<IDictionary<string, object>> GetCustomParametersAsync(CancellationToken cancellationToken = default) {
var command = new AVCommand {
Path = $"statistics/apps/{AVClient.CurrentConfiguration.ApplicationId}/sendPolicy",
Method = HttpMethod.Get
};
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command, cancellationToken: cancellationToken).OnSuccess(t => {
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command, cancellationToken).OnSuccess(t => {
var settings = t.Result.Item2;
var CloudParameters = settings["parameters"] as IDictionary<string, object>;
return CloudParameters;
@ -318,19 +295,15 @@ namespace LeanCloud {
public string Signature { internal set; get; }
}
public static Task<RealtimeSignature> RequestRealtimeSignatureAsync(CancellationToken cancellationToken = default(CancellationToken)) {
return RequestRealtimeSignatureAsync(AVUser.CurrentUser, cancellationToken);
}
public static Task<RealtimeSignature> RequestRealtimeSignatureAsync(AVUser user, CancellationToken cancellationToken = default(CancellationToken)) {
public static Task<RealtimeSignature> RequestRealtimeSignatureAsync(CancellationToken cancellationToken = default) {
var command = new AVCommand {
Path = "rtm/sign",
Method = HttpMethod.Post,
Content = new Dictionary<string, string> {
{ "session_token", user.SessionToken }
{ "session_token", AVUser.CurrentUser?.SessionToken }
}
};
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command, cancellationToken: cancellationToken).ContinueWith(t => {
return AVPlugins.Instance.CommandRunner.RunCommandAsync<IDictionary<string, object>>(command, cancellationToken).OnSuccess(t => {
var body = t.Result.Item2;
return new RealtimeSignature() {
Nonce = body["nonce"] as string,

View File

@ -306,7 +306,7 @@ namespace LeanCloud {
return this.SaveExternal();
return taskQueue.Enqueue(
toAwait => FileController.SaveAsync(state, dataStream, AVUser.CurrentUser?.SessionToken, progress, cancellationToken), cancellationToken)
toAwait => FileController.SaveAsync(state, dataStream, progress, cancellationToken), cancellationToken)
.OnSuccess(t => {
state = t.Result;
});
@ -593,8 +593,7 @@ namespace LeanCloud {
/// <remarks>获取之后并没有实际执行下载只是加载了文件的元信息以及物理地址Url
/// </remarks>
public static Task<AVFile> GetFileWithObjectIdAsync(string objectId, CancellationToken cancellationToken) {
string currentSessionToken = AVUser.CurrentUser?.SessionToken;
return FileController.GetAsync(objectId, currentSessionToken, cancellationToken).OnSuccess(_ => {
return FileController.GetAsync(objectId, cancellationToken).OnSuccess(_ => {
var filestate = _.Result;
return new AVFile(filestate);
});
@ -656,10 +655,8 @@ namespace LeanCloud {
return Task.FromResult(0);
}
string sessionToken = AVUser.CurrentUser?.SessionToken;
return toAwait.OnSuccess(_ => {
return FileController.DeleteAsync(state, sessionToken, cancellationToken);
return FileController.DeleteAsync(state, cancellationToken);
}).Unwrap().OnSuccess(_ => { });
}
#endregion

View File

@ -564,14 +564,10 @@ string propertyName
}
Task deepSaveTask;
string sessionToken;
lock (mutex) {
// Get the JSON representation of the object.
currentOperations = StartSave();
sessionToken = AVUser.CurrentUser?.SessionToken;
deepSaveTask = DeepSaveAsync(estimatedData, sessionToken, cancellationToken);
deepSaveTask = DeepSaveAsync(estimatedData, cancellationToken);
}
return deepSaveTask.OnSuccess(_ => {
@ -579,7 +575,6 @@ string propertyName
currentOperations,
FetchWhenSave || fetchWhenSave,
query,
sessionToken,
cancellationToken);
}).Unwrap().ContinueWith(t => {
if (t.IsFaulted || t.IsCanceled) {
@ -604,14 +599,14 @@ string propertyName
queryString = new Dictionary<string, object>();
}
return ObjectController.FetchAsync(state, queryString, AVUser.CurrentUser?.SessionToken, cancellationToken);
return ObjectController.FetchAsync(state, queryString, cancellationToken);
}).Unwrap().OnSuccess(t => {
HandleFetchResult(t.Result);
return this;
});
}
private static Task DeepSaveAsync(object obj, string sessionToken, CancellationToken cancellationToken) {
private static Task DeepSaveAsync(object obj, CancellationToken cancellationToken) {
var objects = new List<AVObject>();
CollectDirtyChildren(obj, objects);
@ -654,7 +649,6 @@ string propertyName
var saveTasks = ObjectController.SaveAllAsync(states,
operationsList,
sessionToken,
cancellationToken);
return Task.WhenAll(saveTasks).ContinueWith(t => {
@ -692,7 +686,7 @@ string propertyName
/// <param name="cancellationToken">The cancellation token.</param>
public static Task SaveAllAsync<T>(
IEnumerable<T> objects, CancellationToken cancellationToken) where T : AVObject {
return DeepSaveAsync(objects.ToList(), AVUser.CurrentUser?.SessionToken, cancellationToken);
return DeepSaveAsync(objects.ToList(), cancellationToken);
}
#endregion
@ -840,10 +834,8 @@ string propertyName
return Task.FromResult(0);
}
string sessionToken = AVUser.CurrentUser?.SessionToken;
return toAwait.OnSuccess(_ => {
return ObjectController.DeleteAsync(State, sessionToken, cancellationToken);
return ObjectController.DeleteAsync(State, cancellationToken);
}).Unwrap().OnSuccess(_ => IsDirty = true);
}
@ -884,10 +876,7 @@ string propertyName
return AVObject.EnqueueForAll<object>(uniqueObjects, toAwait => {
var states = uniqueObjects.Select(t => t.state).ToList();
return toAwait.OnSuccess(_ => {
var deleteTasks = ObjectController.DeleteAllAsync(states,
AVUser.CurrentUser?.SessionToken,
cancellationToken);
var deleteTasks = ObjectController.DeleteAllAsync(states, cancellationToken);
return Task.WhenAll(deleteTasks);
}).Unwrap().OnSuccess(t => {
// Dirty all objects in memory.

View File

@ -248,7 +248,6 @@ namespace LeanCloud {
var names = string.Join(",", statisticNames.ToArray());
path = string.Format("{0}?statistics={1}", path, names);
}
var sessionToken = AVUser.CurrentUser?.SessionToken;
var command = new AVCommand {
Path = path,
Method = HttpMethod.Post