Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,9 @@ private void RepositoryOnLocalAndRemoteBranchListChanged(CacheUpdateEvent cacheU
{
if (!lastLocalAndRemoteBranchListChangedEvent.Equals(cacheUpdateEvent))
{
new ActionTask(TaskManager.Token, () =>
{
lastLocalAndRemoteBranchListChangedEvent = cacheUpdateEvent;
localAndRemoteBranchListHasUpdate = true;
Redraw();
})
{ Affinity = TaskAffinity.UI }.Start();
lastLocalAndRemoteBranchListChangedEvent = cacheUpdateEvent;
localAndRemoteBranchListHasUpdate = true;
Redraw();
}
}

Expand All @@ -114,16 +110,11 @@ private void MaybeUpdateData()

private void AttachHandlers(IRepository repository)
{
if (repository == null)
return;

repository.LocalAndRemoteBranchListChanged += RepositoryOnLocalAndRemoteBranchListChanged;
}

private void DetachHandlers(IRepository repository)
{
if (repository == null)
return;

repository.LocalAndRemoteBranchListChanged -= RepositoryOnLocalAndRemoteBranchListChanged;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,8 @@ public override void OnEnable()
userSettingsView.OnEnable();
AttachHandlers(Repository);

if (Repository != null)
{
Repository.CheckCurrentRemoteChangedEvent(lastCurrentRemoteChangedEvent);
Repository.CheckLocksChangedEvent(lastLocksChangedEvent);
}

Repository.CheckCurrentRemoteChangedEvent(lastCurrentRemoteChangedEvent);
Repository.CheckLocksChangedEvent(lastLocksChangedEvent);
metricsHasChanged = true;
}

Expand Down
12 changes: 6 additions & 6 deletions src/UnityExtension/Assets/Editor/GitHub.Unity/UI/Window.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,8 @@ public override void OnRepositoryChanged(IRepository oldRepository)
if (Repository != null && activeTab == SubTab.InitProject)
{
changeTab = SubTab.History;
UpdateActiveTab();
}

UpdateActiveTab();
}

public override void OnSelectionChange()
Expand Down Expand Up @@ -317,7 +316,6 @@ private void DoToolbarGUI()
// Subtabs & toolbar
GUILayout.BeginHorizontal(EditorStyles.toolbar);
{
changeTab = activeTab;
EditorGUI.BeginChangeCheck();
{
if (HasRepository)
Expand Down Expand Up @@ -352,7 +350,8 @@ private void UpdateActiveTab()
{
var fromView = ActiveView;
activeTab = changeTab;
SwitchView(fromView, ActiveView);
var toView = ActiveView;
SwitchView(fromView, toView);
}
}

Expand All @@ -363,6 +362,7 @@ private void SwitchView(Subview fromView, Subview toView)
if (fromView != null)
fromView.OnDisable();
toView.OnEnable();
toView.OnDataUpdate();

// this triggers a repaint
Repaint();
Expand Down Expand Up @@ -424,9 +424,9 @@ public void ShowNotification(GUIContent content, float timeout)
base.ShowNotification(content);
}

private static SubTab TabButton(SubTab tab, string title, SubTab activeTab)
private static SubTab TabButton(SubTab tab, string title, SubTab currentTab)
{
return GUILayout.Toggle(activeTab == tab, title, EditorStyles.toolbarButton) ? tab : activeTab;
return GUILayout.Toggle(currentTab == tab, title, EditorStyles.toolbarButton) ? tab : currentTab;
}

private Subview ToView(SubTab tab)
Expand Down