public void OnTaskSuccess(string successMessage)
        {
            var message = JsonUtility.FromJson <OnTaskSuccessMessage>(successMessage);

            if (String.IsNullOrEmpty(message.CallbackUuid))
            {
                Debug.Log("CallbackID not provided, aborting OnTaskSuccess callback");
                return;
            }

            if (String.IsNullOrEmpty(message.Mpid))
            {
                Debug.Log("Success MPID not found, aborting OnTaskSuccess callback");
                return;
            }
            BaseTask task;

            if (!_taskCallbacks.TryGetValue(message.CallbackUuid, out task))
            {
                Debug.Log("Task with CallbackID not found, aborting OnTaskSuccess callback");
                return;
            }
            task.setResult(new IdentityApiResult()
            {
                User = MParticleUserImpl.GetUserInstance(message.Mpid)
            });
        }
        public void OnUserIdentified(string userIdentified)
        {
            MpidDto body       = JsonUtility.FromJson <MpidDto>(userIdentified);
            string  mpidString = body.Mpid;
            long    mpid       = toUtils.ToLong(mpidString, 0);

            if (mpid != 0)
            {
                MParticleUser           user = MParticleUserImpl.GetUserInstance(mpid);
                List <OnUserIdentified> identityStateHandlersCopy = new List <OnUserIdentified>(_identityStateHandlers);
                foreach (OnUserIdentified handler in identityStateHandlersCopy)
                {
                    if (handler != null)
                    {
                        handler.Invoke(user);
                    }
                }
            }
        }
        public void OnUserAlias(string usersMessage)
        {
            var message = JsonUtility.FromJson <OnUserAliasMessage>(usersMessage);

            if (message.CallbackUuid == null)
            {
                Debug.Log("CallbackID not provided, aborting OnUserAlias callback");
                return;
            }
            if (message.PreviousMpid == null || message.NewMpid == null)
            {
                Debug.Log("PreviousMpid and NewMpid not provided, aborting OnUserAlias callback");
                return;
            }
            OnUserAlias userAliasDelegate;

            if (!_onUserAliasCallbacks.TryGetValue(message.CallbackUuid, out userAliasDelegate))
            {
                Debug.Log("OnUserAlias with CallbackId not found, aborting OnUserAlias callback");
                return;
            }
            userAliasDelegate.Invoke(MParticleUserImpl.GetUserInstance(message.PreviousMpid), MParticleUserImpl.GetUserInstance(message.NewMpid));
        }
 public MParticleUser GetUser(long mpid)
 {
     return(MParticleUserImpl.GetUserInstance(mpid));
 }