/// <summary> /// Adds identity to the current user. /// /// If the identity you are trying to add already belongs to another user it will invoke <code>onConflict</code> callback passing /// information about current user, remote user the identity you are trying to add already belongs to, and action to finalize the callback. /// /// If you implement <code>onConflict</code> callback you MUST ALWAYS call finalize action pasing your conflict resolution strategy as a parameter. /// If you do not provide <code>onConflict</code> callback SDK will substitute the current user with the user identity already belongs to. /// /// After the finalized action is called you are guaranteed to receive either <code>onComplete</code> or <code>onFailure</code> callback. /// </summary> /// <param name="identity">Identity info to be added</param> /// <param name="onComplete">Invoked when adding identity is completed. The result describing how it completed will be passed as parameter <see cref="AddIdentityResult"/></param> /// <param name="onFailure">Invoked when adding identity failed</param> /// /// <param name="onConflict"> /// Invoked when the identity already belongs to another user and the conflict needs to be resolved. /// </param> public void AddUserIdentity(UserIdentity identity, Action <AddIdentityResult> onComplete, Action <string> onFailure, CurrentUser.OnAddIdentityConflictDelegate onConflict = null) { Check.Argument.IsNotNull(identity, "identity", "Identity cannot be null"); Check.Argument.IsNotNull(onComplete, "onComplete", "Complete callback cannot be null"); Check.Argument.IsNotNull(onFailure, "onFailure", "Failure callback cannot be null"); nativeBridge.AddUserIdentity(identity.Serialize().ToString(), onComplete, onFailure, onConflict); }