Skip to content
This repository has been archived by the owner on Dec 5, 2024. It is now read-only.

Commit

Permalink
Removing redundant cachedUser field
Browse files Browse the repository at this point in the history
  • Loading branch information
StanleyGoldman committed Nov 9, 2017
1 parent 223e0bb commit fca75da
Showing 1 changed file with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class UserSettingsView : Subview
[SerializeField] private string gitEmail;
[SerializeField] private string newGitName;
[SerializeField] private string newGitEmail;
[SerializeField] private User cachedUser;

public override void InitializeView(IView parent)
{
Expand Down Expand Up @@ -63,15 +62,11 @@ public override void OnGUI()
{
if (Repository != null)
{
Repository.User.Name = newGitName;
Repository.User.Name = gitName = newGitName;
}
else
{
if (cachedUser == null)
{
cachedUser = new User();
}
cachedUser.Name = newGitName;
gitName = newGitName;
}
}
})
Expand All @@ -83,11 +78,11 @@ public override void OnGUI()
{
if (Repository != null)
{
Repository.User.Email = newGitEmail;
Repository.User.Email = gitEmail = newGitEmail;
}
else
{
cachedUser.Email = newGitEmail;
gitEmail = newGitEmail;
}

userDataHasChanged = true;
Expand Down Expand Up @@ -149,9 +144,8 @@ private void UpdateUserDataFromClient()
.ThenInUI((success, user) => {
if (success && !String.IsNullOrEmpty(user.Name) && !String.IsNullOrEmpty(user.Email))
{
cachedUser = user;
newGitName = gitName = cachedUser.Name;
newGitEmail = gitEmail = cachedUser.Email;
newGitName = gitName = user.Name;
newGitEmail = gitEmail = user.Email;
Redraw();
}
}).Start();
Expand Down

0 comments on commit fca75da

Please sign in to comment.