Exemplo n.º 1
0
        /// <summary>
        /// Gets the user's email.
        /// </summary>
        /// <remarks>The email address returned is selected by the user from the accounts present
        /// on the device. There is no guarantee this uniquely identifies the player.
        /// For unique identification use the id property of the local player.
        /// The user can also choose to not select any email address, meaning it is not
        /// available.</remarks>
        /// <returns>The user email or null if not authenticated or the permission is
        /// not available.</returns>
        public string GetUserEmail()
        {
            if (!this.IsAuthenticated())
            {
                Debug.Log("Cannot get API client - not authenticated");
                return(null);
            }

            mTokenClient.SetRationale(rationale);
            return(mTokenClient.GetEmail());
        }
Exemplo n.º 2
0
 protected override void OnAppearing()
 {
     BindingContext = new SettingsViewModel
     {
         EmailAddress   = _tokenClient.GetEmail(),
         LastLogin      = _tokenClient.GetLogin().ToLongDateString(),
         LoginExpiresAt = _tokenClient.GetExpiry().ToLongDateString()
     };
 }
Exemplo n.º 3
0
 public string GetUserEmail()
 {
     if (!IsAuthenticated())
     {
         Debug.Log((object)"Cannot get API client - not authenticated");
         return(null);
     }
     return(mTokenClient.GetEmail());
 }
Exemplo n.º 4
0
        /// <summary>Gets the user email.</summary>
        /// <returns>The user email or null if not authenticated or the permission is
        /// not available.</returns>
        public string GetUserEmail()
        {
            if (!this.IsAuthenticated())
            {
                Debug.Log("Cannot get API client - not authenticated");
                return(null);
            }

            if (!GameInfo.WebClientIdInitialized())
            {
                //don't spam the log, only do this every so often
                if (noWebClientIdWarningCount++ % webclientWarningFreq == 0)
                {
                    Debug.LogError("Web client ID has not been set, cannot request email.");
                    // avoid int overflow
                    noWebClientIdWarningCount = (noWebClientIdWarningCount / webclientWarningFreq) + 1;
                }
                return(null);
            }
            mTokenClient.SetRationale(rationale);
            return(mTokenClient.GetEmail());
        }
Exemplo n.º 5
0
        /// <summary>Gets the user email.</summary>
        /// <returns>The user email or null if not authenticated or the permission is
        /// not available.</returns>
        public string GetUserEmail()
        {
            if (!this.IsAuthenticated())
            {
                Debug.Log("Cannot get API client - not authenticated");
                return(null);
            }

            if (!GameInfo.RequireGooglePlus())
            {
                //don't spam the log, only do this every so often
                if (needGPlusWarningCount++ % needGPlusWarningFreq == 0)
                {
                    Debug.LogError("RequiresGooglePlus not set, cannot request email.");
                    // avoid int overflow
                    needGPlusWarningCount = (needGPlusWarningCount / needGPlusWarningFreq) + 1;
                }
                return(null);
            }
            mTokenClient.SetRationale(rationale);
            return(mTokenClient.GetEmail());
        }