/// <summary> /// Gets the Identity Id corresponding to the credentials retrieved from Cognito. /// Note: this setting may change during execution. To be notified of its /// new value, attach a listener to IdentityChangedEvent /// </summary> /// <param name="callback">The callback which is executed when the asynchronous operations is completed</param> /// <param name="options">Options for executing asynchronous operation</param> public void GetIdentityIdAsync(AmazonCognitoIdentityCallback <string> callback, AsyncOptions options = null) { options = options == null ? new AsyncOptions() : options; CognitoIdentityAsyncExecutor.ExecuteAsync <string>(() => { return(GetIdentityId()); }, options, callback); }
/// <summary> /// Returns an instance of ImmutableCredentials for this instance /// </summary> /// <param name="callback">The callback which is executed when the asynchronous operations is completed</param> /// <param name="options">Options for executing asynchronous operation</param> public void GetCredentialsAsync(AmazonCognitoIdentityCallback <ImmutableCredentials> callback, AsyncOptions options = null) { options = options == null ? new AsyncOptions() : options; CognitoIdentityAsyncExecutor.ExecuteAsync <ImmutableCredentials>(() => { return(GetCredentials()); }, options, callback); }
public static void ExecuteAsync <T>(Func <T> function, AsyncOptions options, AmazonCognitoIdentityCallback <T> callback) { ThreadPool.QueueUserWorkItem((state) => { T result = default(T); Exception exception = null; try { result = function(); } catch (Exception ex) { exception = ex; } if (callback != null) { if (options.ExecuteCallbackOnMainThread) { UnityRequestQueue.Instance.ExecuteOnMainThread(() => { callback(new AmazonCognitoIdentityResult <T>(result, exception, options.State)); }); } else { try { callback(new AmazonCognitoIdentityResult <T>(result, exception, options.State)); } catch (Exception callbackException) { // Catch any unhandled exceptions from the user callback // and log it. Logger.Error(callbackException, "An unhandled exception was thrown from the callback method {0}.", callback.Method.Name); } } } }); }
/// <summary> /// Returns an instance of ImmutableCredentials for this instance /// </summary> /// <param name="callback">The callback which is executed when the asynchronous operations is completed</param> /// <param name="options">Options for executing asynchronous operation</param> public void GetCredentialsAsync(AmazonCognitoIdentityCallback <ImmutableCredentials> callback, AsyncOptions options = null) { if (UnityEngine.Application.platform == UnityEngine.RuntimePlatform.WebGLPlayer) { GetCredentialsWebGL(credentials => { var result = new AmazonCognitoIdentityResult <ImmutableCredentials>(credentials); callback(result); }); } else { options = options == null ? new AsyncOptions() : options; CognitoIdentityAsyncExecutor.ExecuteAsync <ImmutableCredentials>(() => { return(GetCredentials()); }, options, callback); } }
public static void ExecuteAsync <T>(Func <T> function, AsyncOptions options, AmazonCognitoIdentityCallback <T> callback) { ThreadPool.QueueUserWorkItem(delegate { T result = (T)default(T); Exception exception = null; try { result = (T)function(); } catch (Exception ex) { Exception ex2 = exception = ex; } if (callback != null) { if (options.ExecuteCallbackOnMainThread) { UnityRequestQueue.Instance.ExecuteOnMainThread(delegate { callback(new AmazonCognitoIdentityResult <T>((T)result, exception, options.State)); }); } else { try { callback(new AmazonCognitoIdentityResult <T>((T)result, exception, options.State)); } catch (Exception exception2) { Logger.Error(exception2, "An unhandled exception was thrown from the callback method {0}.", callback.Method.Name); } } } }); }
/// <summary> /// Returns an instance of ImmutableCredentials for this instance /// </summary> /// <param name="callback">The callback which is executed when the asynchronous operations is completed</param> /// <param name="options">Options for executing asynchronous operation</param> public void GetCredentialsAsync(AmazonCognitoIdentityCallback<ImmutableCredentials> callback, AsyncOptions options = null) { options = options == null ? new AsyncOptions() : options; CognitoIdentityAsyncExecutor.ExecuteAsync<ImmutableCredentials>(() => { return GetCredentials(); }, options, callback); }
/// <summary> /// Gets the Identity Id corresponding to the credentials retrieved from Cognito. /// Note: this setting may change during execution. To be notified of its /// new value, attach a listener to IdentityChangedEvent /// </summary> /// <param name="callback">The callback which is executed when the asynchronous operations is completed</param> /// <param name="options">Options for executing asynchronous operation</param> public void GetIdentityIdAsync(AmazonCognitoIdentityCallback<string> callback, AsyncOptions options = null) { options = options == null ? new AsyncOptions() : options; CognitoIdentityAsyncExecutor.ExecuteAsync<string>(() => { return GetIdentityId(); }, options, callback); }
public void GetCredentialsAsync(AmazonCognitoIdentityCallback <ImmutableCredentials> callback, AsyncOptions options = null) { options = ((options == null) ? new AsyncOptions() : options); CognitoIdentityAsyncExecutor.ExecuteAsync(() => GetCredentials(), options, callback); }
public void GetIdentityIdAsync(AmazonCognitoIdentityCallback <string> callback, AsyncOptions options = null) { options = ((options == null) ? new AsyncOptions() : options); CognitoIdentityAsyncExecutor.ExecuteAsync(() => GetIdentityId(), options, callback); }