private static void UnityHelpshiftDelegateCallbackImpl(string methodName, string parametersJson)
        {
            IHelpshiftEventsListener externalDelegate = GetInstance().externalDelegate;

            if (externalDelegate == null)
            {
                return;
            }

            if (methodName == HelpshiftEventConstants.HandleHelpshiftEvent)
            {
                Dictionary <string, object> eventJson = (Dictionary <string, object>)Json.Deserialize(parametersJson);
                string eventName = "";
                if (eventJson.ContainsKey("eventName"))
                {
                    eventName = (string)eventJson["eventName"];
                }

                object eventData = null;
                if (eventJson.ContainsKey("eventData"))
                {
                    eventData = eventJson["eventData"];
                }

                Dictionary <string, object> eventDataJson = null;
                if (eventData != null)
                {
                    eventDataJson = (Dictionary <string, object>)eventData;
                }

                externalDelegate.HandleHelpshiftEvent(eventName, eventDataJson);
            }
            else if (methodName == HelpshiftEventConstants.AuthenticationFailed)
            {
                Dictionary <string, object> failureReasonJson = (Dictionary <string, object>)Json.Deserialize(parametersJson);
                object failureReasonObject = failureReasonJson["reason"];
                int    failureReason       = System.Convert.ToInt32(failureReasonObject);

                HelpshiftAuthenticationFailureReason authFailureReason = HelpshiftAuthenticationFailureReason.UNKNOWN;

                if (failureReason == 0) // Auth token not provided
                {
                    authFailureReason = HelpshiftAuthenticationFailureReason.AUTH_TOKEN_NOT_PROVIDED;
                }
                else if (failureReason == 1) // Invalid auth token
                {
                    authFailureReason = HelpshiftAuthenticationFailureReason.INVALID_AUTH_TOKEN;
                }


                externalDelegate.AuthenticationFailedForUser(authFailureReason);
            }
        }
Esempio n. 2
0
        void onUserAuthenticationFailure(int reason)
        {
            HelpshiftAuthenticationFailureReason reasonValue = HelpshiftAuthenticationFailureReason.UNKNOWN;

            if (reason == 0)
            {
                reasonValue = HelpshiftAuthenticationFailureReason.AUTH_TOKEN_NOT_PROVIDED;
            }
            else if (reason == 1)
            {
                reasonValue = HelpshiftAuthenticationFailureReason.INVALID_AUTH_TOKEN;
            }

            externalHelpshiftEventsListener.AuthenticationFailedForUser(reasonValue);
        }
 public void AuthenticationFailedForUser(HelpshiftAuthenticationFailureReason reason)
 {
     Debug.Log("Helpshift - Authentication Failed for reason " + reason.ToString());
 }