Esempio n. 1
0
    private void SignInNoSilent()
    {
        AN_GoogleSignInOptions.Builder builder = new AN_GoogleSignInOptions.Builder(AN_GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN);
        builder.RequestId();
        builder.RequestEmail();
        builder.RequestProfile();

        AN_GoogleSignInOptions gso    = builder.Build();
        AN_GoogleSignInClient  client = AN_GoogleSignIn.GetClient(gso);

        AN_Logger.Log("SignInNoSilent Start ");

        client.SignIn((signInResult) => {
            AN_Logger.Log("Sign In StatusCode: " + signInResult.StatusCode);
            if (signInResult.IsSucceeded)
            {
                AN_Logger.Log("SignIn Succeeded");
                UpdateUIWithAccount(signInResult.Account);
            }
            else
            {
                AN_Logger.Log("SignIn filed: " + signInResult.Error.FullMessage);
            }
        });
    }
 public void GoogleSignInClient_SignOut(AN_GoogleSignInClient client, Action <SA_Result> callback)
 {
     SA_Coroutine.WaitForSeconds(1, () => {
         m_alreadySignedIn = false;
         callback.Invoke(new SA_Result());
     });
 }
Esempio n. 3
0
    private void SignOutFlow()
    {
        AN_GoogleSignInOptions gso    = new AN_GoogleSignInOptions.Builder(AN_GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN).Build();
        AN_GoogleSignInClient  client = AN_GoogleSignIn.GetClient(gso);

        client.SignOut(() => {});
    }
        //--------------------------------------
        // AN_GoogleSignInClient
        //--------------------------------------


        public void GoogleSignInClient_SignIn(AN_GoogleSignInClient client, Action <AN_GoogleSignInResult> callback)
        {
            SA_Coroutine.WaitForSeconds(1, () => {
                m_alreadySignedIn     = true;
                m_canDoSilentSignedIn = true;
                callback.Invoke(new AN_GoogleSignInResult(new AN_GoogleSignInAccount()));
            });
        }
Esempio n. 5
0
    private void SignInFlow()
    {
        AN_Logger.Log("Play Services Sign In started....");
        AN_GoogleSignInOptions.Builder builder = new AN_GoogleSignInOptions.Builder(AN_GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN);

        //Google play documentation syas that
        // you don't need to use this, however, we recommend you still
        // add those option to your Sing In builder. Some version of play service lib
        // may retirn a signed account with all fileds empty if you will not add this.
        // However according to the google documentation this step isn't required
        // So the decision is up to you.
        builder.RequestId();
        builder.RequestEmail();
        builder.RequestProfile();

        // Add the APPFOLDER scope for Snapshot support.
        builder.RequestScope(AN_Drive.SCOPE_APPFOLDER);

        AN_GoogleSignInOptions gso    = builder.Build();
        AN_GoogleSignInClient  client = AN_GoogleSignIn.GetClient(gso);

        AN_Logger.Log("Let's try Silent SignIn first");
        client.SilentSignIn((result) => {
            if (result.IsSucceeded)
            {
                AN_Logger.Log("SilentSignIn Succeeded");
                UpdateUIWithAccount(result.Account);
            }
            else
            {
                // Player will need to sign-in explicitly using via UI

                AN_Logger.Log("SilentSignIn Failed with code: " + result.Error.Code);
                AN_Logger.Log("Starting the default Sign in flow");

                //Starting the interactive sign-in
                client.SignIn((signInResult) => {
                    AN_Logger.Log("Sign In StatusCode: " + signInResult.StatusCode);
                    if (signInResult.IsSucceeded)
                    {
                        AN_Logger.Log("SignIn Succeeded");
                        UpdateUIWithAccount(signInResult.Account);
                    }
                    else
                    {
                        AN_Logger.Log("SignIn filed: " + signInResult.Error.FullMessage);
                    }
                });
            }
        });
    }
 public void GoogleSignInClient_SilentSignIn(AN_GoogleSignInClient client, Action <AN_GoogleSignInResult> callback)
 {
     SA_Coroutine.WaitForSeconds(1, () => {
         if (m_canDoSilentSignedIn)
         {
             m_alreadySignedIn = true;
             callback.Invoke(new AN_GoogleSignInResult(new AN_GoogleSignInAccount()));
         }
         else
         {
             var error = new SA_Error((int)AN_CommonStatusCodes.SIGN_IN_REQUIRED, "SIGN_IN_REQUIRED");
             callback.Invoke(new AN_GoogleSignInResult(error));
         }
     });
 }
Esempio n. 7
0
 public void GoogleSignInClient_RevokeAccess(AN_GoogleSignInClient client, Action <SA_Result> callback)
 {
     AN_Java.Bridge.CallStaticWithCallback(AN_GoogleSignInClient, "RevokeAccess", callback, client.HashCode);
 }
Esempio n. 8
0
 public void GoogleSignInClient_SignOut(AN_GoogleSignInClient client, Action <SA_Result> callback)
 {
     AN_Java.Bridge.CallStaticWithCallback(AN_GoogleSignInClient, "SignOut", callback, client.HashCode);
 }