示例#1
0
 public override void SetUser(IAuthenticatedUserProfile user)
 {
     if (user != null)
     {
         HockeyClient.Current.UpdateContactInfo(user.DisplayName, user.Email);
     }
 }
示例#2
0
 /// <summary>
 /// Sets the user to the analytics providers.
 /// </summary>
 /// <param name="user">User object representing the current user.</param>
 public virtual void SetUser(IAuthenticatedUserProfile user)
 {
     if (user != null)
     {
         this.SetUser(user.UserID);
     }
 }
        /// <summary>
        /// Sets the current user of the app.
        /// </summary>
        /// <param name="userInformation"></param>
        public override async Task <bool> SetUserAsync(IAuthenticatedUserProfile userInformation)
        {
            var user = userInformation as UserResponse;

            if (string.IsNullOrEmpty(user?.AccessToken))
            {
                await this.SignoutAsync();

                return(false);
            }
            else
            {
                this.IsReauthenticationNeeded = false;

                // Log user
                Platform.Current.Analytics.SetUser(user);

                // Store user data
                await Platform.Current.Storage.SaveFileAsync(CREDENTIAL_USER_KEYNAME, user, ApplicationData.Current.RoamingFolder, SerializerTypes.Json);

                Platform.Current.Storage.SaveCredential(CREDENTIAL_USER_KEYNAME, CREDENTIAL_ACCESSTOKEN_KEYNAME, user.AccessToken);
                Platform.Current.Storage.SaveCredential(CREDENTIAL_USER_KEYNAME, CREDENTIAL_REFRESHTOKEN_KEYNAME, user.RefreshToken);

                // Set properties
                this.CurrentUser  = user;
                this.AccessToken  = user.AccessToken;
                this.RefreshToken = user.RefreshToken;

                // Notify any subscribers that authentication status has changed
                this.NotifyUserAuthenticated();
                return(this.IsAuthenticated());
            }
        }
示例#4
0
 /// <summary>
 /// Sets the current user of the app.
 /// </summary>
 /// <param name="user"></param>
 public abstract Task <bool> SetUserAsync(IAuthenticatedUserProfile user);