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

Commit 4d70a75

Browse files
authored
Merge pull request #770 from github-for-unity/fixes/error-message-popups
Using git errors in popup messages
2 parents f861fa5 + fb82f1d commit 4d70a75

File tree

5 files changed

+59
-9
lines changed

5 files changed

+59
-9
lines changed

src/GitHub.Api/Localization.Designer.cs

Lines changed: 20 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/GitHub.Api/Localization.resx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,4 +345,10 @@
345345
<data name="Window_RepoUrlTooltip" xml:space="preserve">
346346
<value>Url of the {0} remote</value>
347347
</data>
348+
<data name="ReleaseLockActionTitle" xml:space="preserve">
349+
<value>Release Lock</value>
350+
</data>
351+
<data name="RequestLockActionTitle" xml:space="preserve">
352+
<value>Request Lock</value>
353+
</data>
348354
</root>

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ private static void ContextMenu_Lock()
108108
{
109109
EntryPoint.ApplicationManager.TaskManager.Run(EntryPoint.ApplicationManager.UsageTracker.IncrementUnityProjectViewContextLfsLock);
110110
}
111+
else
112+
{
113+
EditorUtility.DisplayDialog(Localization.RequestLockActionTitle,
114+
ex.Message,
115+
Localization.Ok);
116+
}
111117

112118
isBusy = false;
113119
Selection.activeGameObject = null;
@@ -154,6 +160,13 @@ private static void ContextMenu_Unlock()
154160
{
155161
EntryPoint.ApplicationManager.TaskManager.Run(EntryPoint.ApplicationManager.UsageTracker.IncrementUnityProjectViewContextLfsUnlock);
156162
}
163+
else
164+
{
165+
EditorUtility.DisplayDialog(Localization.ReleaseLockActionTitle,
166+
ex.Message,
167+
Localization.Ok);
168+
}
169+
157170
isBusy = false;
158171
Selection.activeGameObject = null;
159172
EditorApplication.RepaintProjectWindow();

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,19 @@ private void OnGitLfsLocksGUI()
295295
if (GUILayout.Button("Unlock"))
296296
{
297297
Repository.ReleaseLock(lck.Path, true)
298-
.Then(UsageTracker.IncrementSettingsViewButtonLfsUnlock)
298+
.FinallyInUI((success, ex) =>
299+
{
300+
if (success)
301+
{
302+
TaskManager.Run(UsageTracker.IncrementSettingsViewButtonLfsUnlock);
303+
}
304+
else
305+
{
306+
EditorUtility.DisplayDialog(Localization.ReleaseLockActionTitle,
307+
ex.Message,
308+
Localization.Ok);
309+
}
310+
})
299311
.Start();
300312
}
301313
}

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ private void Pull()
566566
else
567567
{
568568
EditorUtility.DisplayDialog(Localization.PullActionTitle,
569-
Localization.PullFailureDescription,
569+
e.Message,
570570
Localization.Ok);
571571
}
572572
})
@@ -590,7 +590,7 @@ private void Push()
590590
else
591591
{
592592
EditorUtility.DisplayDialog(Localization.PushActionTitle,
593-
Localization.PushFailureDescription,
593+
e.Message,
594594
Localization.Ok);
595595
}
596596
})
@@ -602,12 +602,13 @@ private void Fetch()
602602
Repository
603603
.Fetch()
604604
.FinallyInUI((success, e) => {
605-
if (!success)
605+
if (success)
606606
{
607607
TaskManager.Run(EntryPoint.ApplicationManager.UsageTracker.IncrementHistoryViewToolbarFetch);
608-
609-
EditorUtility.DisplayDialog(Localization.FetchActionTitle, Localization.FetchFailureDescription,
610-
Localization.Ok);
608+
}
609+
else
610+
{
611+
EditorUtility.DisplayDialog(Localization.FetchActionTitle, e.Message, Localization.Ok);
611612
}
612613
})
613614
.Start();

0 commit comments

Comments
 (0)