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

Commit f627aa5

Browse files
Properly controlling the activeView while the git path is loading on first run
1 parent c0ee280 commit f627aa5

File tree

4 files changed

+39
-7
lines changed

4 files changed

+39
-7
lines changed

src/GitHub.Api/Extensions/FileSystemExtensions.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public static string CalculateFolderMD5(this IFileSystem fileSystem, string path
4141
{
4242
//https://stackoverflow.com/questions/3625658/creating-hash-for-folder
4343

44+
Logging.Trace("Calculating MD5 for folder: {0}", path);
45+
4446
var filePaths = fileSystem.GetFiles(path, "*", SearchOption.AllDirectories)
4547
.OrderBy(p => p)
4648
.ToArray();
@@ -62,6 +64,8 @@ public static string CalculateFolderMD5(this IFileSystem fileSystem, string path
6264
//Handles empty filePaths case
6365
md5.TransformFinalBlock(new byte[0], 0, 0);
6466

67+
Logging.Trace("Completed Calculating MD5 for folder: {0}", path);
68+
6569
return BitConverter.ToString(md5.Hash).Replace("-", "").ToLower();
6670
}
6771
}

src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public override void InitializeView(IView parent)
2323
{
2424
base.InitializeView(parent);
2525
gitExecutableIsSet = Environment.GitExecutablePath != null;
26+
Redraw();
2627
}
2728

2829
public override void OnEnable()

src/UnityExtension/Assets/Editor/GitHub.Unity/UI/LoadingView.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,19 @@ public override void InitializeView(IView parent)
1818

1919
public override void OnGUI()
2020
{
21-
21+
GUILayout.BeginVertical();
22+
{
23+
GUILayout.FlexibleSpace();
24+
GUILayout.BeginHorizontal();
25+
{
26+
GUILayout.FlexibleSpace();
27+
GUILayout.Label(WindowTitle);
28+
GUILayout.FlexibleSpace();
29+
}
30+
GUILayout.EndHorizontal();
31+
GUILayout.FlexibleSpace();
32+
}
33+
GUILayout.EndVertical();
2234
}
2335

2436
public override bool IsBusy

src/UnityExtension/Assets/Editor/GitHub.Unity/UI/Window.cs

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ class Window : BaseWindow
2323
private const string Window_RepoBranchTooltip = "Active branch";
2424

2525
[NonSerialized] private double notificationClearTime = -1;
26-
[SerializeField] private SubTab changeTab = SubTab.History;
27-
[SerializeField] private SubTab activeTab = SubTab.History;
26+
[SerializeField] private SubTab changeTab = SubTab.None;
27+
[SerializeField] private SubTab activeTab = SubTab.None;
2828
[SerializeField] private InitProjectView initProjectView = new InitProjectView();
2929
[SerializeField] private LoadingView loadingView = new LoadingView();
3030
[SerializeField] private BranchesView branchesView = new BranchesView();
@@ -88,13 +88,27 @@ public override void Initialize(IApplicationManager applicationManager)
8888

8989
gitExecutableIsSet = Environment.GitExecutablePath != null;
9090

91-
if (!gitExecutableIsSet && activeTab != SubTab.Loading)
91+
if (ApplicationCache.Instance.FirstRun && !gitExecutableIsSet && activeTab != SubTab.Loading)
9292
{
9393
changeTab = activeTab = SubTab.Loading;
9494
}
95-
else if (!HasRepository && activeTab != SubTab.InitProject && activeTab != SubTab.Settings)
95+
else if(gitExecutableIsSet)
9696
{
97-
changeTab = activeTab = SubTab.InitProject;
97+
if (HasRepository)
98+
{
99+
if (activeTab == SubTab.Loading)
100+
{
101+
changeTab = SubTab.Changes;
102+
UpdateActiveTab();
103+
}
104+
}
105+
else
106+
{
107+
if (activeTab != SubTab.InitProject && activeTab != SubTab.Settings)
108+
{
109+
changeTab = activeTab = SubTab.InitProject;
110+
}
111+
}
98112
}
99113

100114
LoadingView.InitializeView(this);
@@ -176,7 +190,7 @@ public override void OnUI()
176190
{
177191
base.OnUI();
178192

179-
if(gitExecutableIsSet)
193+
if(ApplicationCache.Instance.FirstRun && gitExecutableIsSet || !ApplicationCache.Instance.FirstRun)
180194
{
181195
if (HasRepository)
182196
{
@@ -384,6 +398,7 @@ private void SwitchView(Subview fromView, Subview toView)
384398

385399
if (fromView != null)
386400
fromView.OnDisable();
401+
387402
toView.OnEnable();
388403
toView.OnDataUpdate();
389404

0 commit comments

Comments
 (0)