|
|
|
@ -23,7 +23,7 @@ public class GoogleSignInManager : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
WebClientId = GameConstants.Web_ClientID,
|
|
|
|
|
RequestEmail = true,
|
|
|
|
|
RequestAuthCode = true
|
|
|
|
|
RequestAuthCode = true,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
GoogleSignIn.Configuration = configuration;
|
|
|
|
@ -141,28 +141,43 @@ public class GoogleSignInManager : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
Debug.Log("Attempting Google Silent Sign-In...");
|
|
|
|
|
|
|
|
|
|
GoogleSignIn.DefaultInstance.SignIn().ContinueWith(OnGoogleSignIn);
|
|
|
|
|
configuration = new GoogleSignInConfiguration
|
|
|
|
|
{
|
|
|
|
|
WebClientId = GameConstants.Web_ClientID,
|
|
|
|
|
RequestEmail = true,
|
|
|
|
|
RequestAuthCode = true,
|
|
|
|
|
ForceTokenRefresh = true
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// GoogleSignIn.DefaultInstance.SignIn().ContinueWith(OnGoogleSignIn);
|
|
|
|
|
|
|
|
|
|
GoogleSignIn.DefaultInstance.SignInSilently().ContinueWith(task =>
|
|
|
|
|
{
|
|
|
|
|
if (task.IsFaulted || task.IsCanceled)
|
|
|
|
|
{
|
|
|
|
|
Debug.LogWarning("Silent Sign-In failed. Showing login buttons.");
|
|
|
|
|
googleSignInButton.gameObject.SetActive(true);
|
|
|
|
|
googleSignInButton.interactable = true;
|
|
|
|
|
|
|
|
|
|
// GoogleSignIn.DefaultInstance.SignInSilently().ContinueWith(task =>
|
|
|
|
|
// {
|
|
|
|
|
// if (task.IsFaulted || task.IsCanceled)
|
|
|
|
|
// {
|
|
|
|
|
// Debug.LogWarning("Silent Sign-In failed. Showing login buttons.");
|
|
|
|
|
// googleSignInButton.gameObject.SetActive(true);
|
|
|
|
|
// googleSignInButton.interactable = true;
|
|
|
|
|
//
|
|
|
|
|
// guestLoginButton.gameObject.SetActive(true);
|
|
|
|
|
// guestLoginButton.interactable = true;
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// GoogleSignInUser user = task.Result;
|
|
|
|
|
// string authCode = user.AuthCode;
|
|
|
|
|
// SafePlayerPrefs.SetString("GoogleAuthCode", authCode);
|
|
|
|
|
// PlayerPrefs.Save();
|
|
|
|
|
//
|
|
|
|
|
// LoginToPlayFab(authCode);
|
|
|
|
|
// });
|
|
|
|
|
guestLoginButton.gameObject.SetActive(true);
|
|
|
|
|
guestLoginButton.interactable = true;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string authCode = task.Result.AuthCode;
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(authCode))
|
|
|
|
|
{
|
|
|
|
|
Debug.LogError("Silent Sign-In succeeded but authCode is NULL!");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Debug.Log("[Silent Sign-In] AuthCode: " + authCode);
|
|
|
|
|
SafePlayerPrefs.SetString("GoogleAuthCode", authCode);
|
|
|
|
|
PlayerPrefs.Save();
|
|
|
|
|
LoginToPlayFab(authCode);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void LoginToPlayFab(string authCode)
|
|
|
|
|