Update GoogleSignInManager.cs

iOS
TG9six 1 month ago
parent 5be830c1f3
commit daaa423b2d

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

Loading…
Cancel
Save