public Task ExecuteParseInstallationSaveHookAsync(ParseInstallation installation) { return getToastUriTask.Value.ContinueWith(t => { installation.SetIfDifferent("deviceUris", t.Result == null ? null : new Dictionary<string, string> { { toastChannelTag, t.Result } }); }); }
public void TestAppNameGetterSetter() { IObjectState state = new MutableObjectState { ServerData = new Dictionary <string, object>() { { "appName", "parseApp" } } }; ParseInstallation installation = ParseObjectExtensions.FromState <ParseInstallation>(state, "_Installation"); Assert.IsNotNull(installation); Assert.AreEqual("parseApp", installation.AppName); Assert.ThrowsException <InvalidOperationException>(() => installation["appName"] = "gogoApp"); installation.SetIfDifferent("appName", "gogoApp"); Assert.AreEqual("gogoApp", installation.AppName); }
public Task <ParseInstallation> GetAsync(CancellationToken cancellationToken) { ParseInstallation cachedCurrent; cachedCurrent = CurrentInstallation; if (cachedCurrent != null) { return(Task <ParseInstallation> .FromResult(cachedCurrent)); } return(taskQueue.Enqueue(toAwait => { return toAwait.ContinueWith(_ => { return storageController.LoadAsync().OnSuccess(stroage => { Task fetchTask; object temp; stroage.Result.TryGetValue(ParseInstallationKey, out temp); var installationDataString = temp as string; ParseInstallation installation = null; if (installationDataString != null) { var installationData = JsonProcessor.Parse(installationDataString) as IDictionary <string, object>; installation = installationCoder.Decode(installationData); fetchTask = Task.FromResult <object>(null); } else { installation = ParseObject.Create <ParseInstallation>(); fetchTask = installationIdController.GetAsync().ContinueWith(t => { installation.SetIfDifferent("installationId", t.Result.ToString()); }); } CurrentInstallation = installation; return fetchTask.ContinueWith(t => installation); }); }).Unwrap().Unwrap(); }, cancellationToken)); }
public void TestInstallationIdGetterSetter() { Guid guid = Guid.NewGuid(); ParseInstallation installation = Client.GenerateObjectFromState <ParseInstallation>(new MutableObjectState { ServerData = new Dictionary <string, object> { ["installationId"] = guid.ToString() } }, "_Installation"); Assert.IsNotNull(installation); Assert.AreEqual(guid, installation.InstallationId); Guid newGuid = Guid.NewGuid(); Assert.ThrowsException <InvalidOperationException>(() => installation["installationId"] = newGuid); installation.SetIfDifferent("installationId", newGuid.ToString()); Assert.AreEqual(newGuid, installation.InstallationId); }
public void TestInstallationIdGetterSetter() { var guid = Guid.NewGuid(); IObjectState state = new MutableObjectState { ServerData = new Dictionary <string, object>() { { "installationId", guid.ToString() } } }; ParseInstallation installation = ParseObject.FromState <ParseInstallation>(state, "_Installation"); Assert.NotNull(installation); Assert.AreEqual(guid, installation.InstallationId); var newGuid = Guid.NewGuid(); Assert.Throws <InvalidOperationException>(() => installation.InstallationId = newGuid); installation.SetIfDifferent <string>("installationId", newGuid.ToString()); Assert.AreEqual(newGuid, installation.InstallationId); }
public Task ExecuteParseInstallationSaveHookAsync(ParseInstallation installation) { return(Task.Run(() => { installation.SetIfDifferent("badge", installation.Badge); })); }
public Task ExecuteParseInstallationSaveHookAsync(ParseInstallation installation) { return Task.Run(() => { installation.SetIfDifferent("badge", installation.Badge); }); }
public Task ExecuteParseInstallationSaveHookAsync(ParseInstallation installation) { return GetChannelTask.ContinueWith(t => { installation.SetIfDifferent("deviceUris", new Dictionary<string, string> { { defaultChannelTag, t.Result.Uri } }); }); }