Ejemplo n.º 1
0
        private void GetCredentialStateInternal(string userID)
        {
#if (UNITY_IOS || UNITY_TVOS) && !UNITY_EDITOR
            IntPtr cback = IntPtr.Zero;
            GetCredentialStateCompleted d = GetCredentialStateCallback;
            cback = Marshal.GetFunctionPointerForDelegate(d);

            UnitySignInWithApple_GetCredentialState(userID, cback);
#endif
        }
Ejemplo n.º 2
0
        /*
         *  get credential state of SIWA id.
         */
        public static void GetCredentialState(string siwaId, Action <CredentialState> onSucceeded, Action <string> onFailed)
        {
            switch (state)
            {
            case State.None:
                break;

            default:
                onFailed("another process running. waiting for end of:" + state);
                return;
            }

            if (string.IsNullOrEmpty(siwaId))
            {
                onFailed("siwaId is null or empty. please set valid value.");
                return;
            }

            state = State.GettingCredential;
            credentialStateCallback = args =>
            {
                state = State.None;
                var credentialStateValue = args.credentialState;
                var credState            = (CredentialState)Enum.ToObject(typeof(CredentialState), credentialStateValue);
                onSucceeded(credState);
            };

#if UNITY_EDITOR
            state = State.None;
            onSucceeded(CredentialState.CredentialAuthorized);
#elif UNITY_IOS
            GetCredentialStateCompleted d = GetCredentialStateCallback;
            IntPtr cback = Marshal.GetFunctionPointerForDelegate(d);

            SignInWithApple_GetCredentialState(siwaId, cback);
#endif
        }