internal void OnAuthenticationFinished(Task <GoogleSignInUser> task) { if (task.IsFaulted) { using (IEnumerator <System.Exception> enumerator = task.Exception.InnerExceptions.GetEnumerator()) { if (enumerator.MoveNext()) { GoogleSignIn.SignInException error = (GoogleSignIn.SignInException)enumerator.Current; AddStatusText("Got Error: " + error.Status + " " + error.Message); } else { AddStatusText("Got Unexpected Exception?!?" + task.Exception); } } } else if (task.IsCanceled) { AddStatusText("Canceled"); } else { _userData = new GoogleSignInUser(); _userData = task.Result; AddStatusText("Welcome: " + task.Result.DisplayName + "!"); } }
public async Task <User> SignInAsync() { GoogleSignIn.Configuration = _configuration; GoogleSignInUser googleUser = await GoogleSignIn.DefaultInstance.SignIn(); return(new User { Email = googleUser.Email, Name = googleUser.DisplayName }); }
public void DisplayUserName(bool completed, GoogleSignInUser result) { string user; if (cnt == 0) { user = result.DisplayName.ToString(); } else { user = FirebaseInit.playerInfo.userName; } if (completed) { TextMeshProUGUI userName = DialogUserName.GetComponent <TextMeshProUGUI>(); userName.text = "Hi there \n" + user; Debug.Log(userName.text.ToString()); } }
public IEnumerator DisplayUserProfilePic(bool completed, GoogleSignInUser result) { string url; if (cnt == 0) { url = result.ImageUrl.ToString(); } else { url = FirebaseInit.playerInfo.profileURL; } if (completed) { yield return(DownloadImage(url)); Image pic = DialogProfilePic.GetComponent <Image>(); pic.sprite = Sprite.Create(profilePic, new Rect(0, 0, profilePic.width, profilePic.height), new Vector2()); Debug.Log(url); } }