Skip to content

Commit b05aae9

Browse files
committed
Change all dialog in EDM to use DialogWindow
Also remove the Dialog class. Change-Id: Id1f50b2ef01d612e4c2b29412e1d02e51add16a8
1 parent eeb4800 commit b05aae9

File tree

10 files changed

+54
-232
lines changed

10 files changed

+54
-232
lines changed

source/AndroidResolver/src/AndroidSdkManager.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ public void InstallPackages(HashSet<AndroidSdkPackageNameVersion> packages,
937937
var packagesString = AndroidSdkPackageNameVersion.ListToString(packages);
938938
// TODO: Remove this dialog when the package manager provides feedback while
939939
// downloading.
940-
Dialog.Display(
940+
DialogWindow.Display(
941941
"Missing Android SDK packages",
942942
String.Format(
943943
"Android SDK packages need to be installed:\n" +
@@ -947,9 +947,9 @@ public void InstallPackages(HashSet<AndroidSdkPackageNameVersion> packages,
947947
"which may lead you to think Unity has hung / crashed. Would you like " +
948948
"to wait for these package to be installed?",
949949
packagesString),
950-
Dialog.Option.Selected0, "Yes", "No",
951-
(selectedOption) => {
952-
if (selectedOption == Dialog.Option.Selected0) {
950+
DialogWindow.Option.Selected0, "Yes", "No",
951+
complete: (selectedOption) => {
952+
if (selectedOption == DialogWindow.Option.Selected0) {
953953
PlayServicesResolver.Log(
954954
"User cancelled installation of Android SDK tools package.",
955955
level: LogLevel.Warning);

source/AndroidResolver/src/GradleResolver.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -740,17 +740,17 @@ private void FindAndResolveConflicts(Action complete) {
740740
// possibly clean up the old versions automatically.
741741
if (Dependency.versionComparer.Compare(conflictingVersions[0],
742742
currentVersion) >= 0) {
743-
Dialog.Display(
743+
DialogWindow.Display(
744744
"Resolve Conflict?",
745745
warningMessage +
746746
"\n" +
747747
"The conflicting libraries are older than the library managed by " +
748748
"the Android Resolver. Would you like to remove the old libraries " +
749749
"to resolve the conflict?",
750-
Dialog.Option.Selected0, "Yes", "No",
751-
(selectedOption) => {
750+
DialogWindow.Option.Selected0, "Yes", "No",
751+
complete: (selectedOption) => {
752752
bool deleted = false;
753-
if (selectedOption == Dialog.Option.Selected0) {
753+
if (selectedOption == DialogWindow.Option.Selected0) {
754754
var deleteFailures = new List<string>();
755755
foreach (var filename in conflict.Value) {
756756
deleteFailures.AddRange(

source/AndroidResolver/src/JavaUtilities.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,12 @@ private static string FindJavaTool(string javaTool)
142142
if (!String.IsNullOrEmpty(javaHome)) {
143143
toolPath = JavaHomeBinaryPath(javaTool);
144144
if (String.IsNullOrEmpty(toolPath)) {
145-
Dialog.Display(
145+
DialogWindow.Display(
146146
"Android Resolver",
147147
String.Format("{0} environment references a directory ({1}) that does " +
148148
"not contain {2} which is required to process Android " +
149149
"libraries.", JAVA_HOME, javaHome, javaTool),
150-
Dialog.Option.Selected0, "OK");
150+
DialogWindow.Option.Selected0, "OK");
151151
throw new ToolNotFoundException(
152152
String.Format("{0} not found, {1} references incomplete Java distribution.",
153153
javaTool, javaHome));
@@ -156,14 +156,14 @@ private static string FindJavaTool(string javaTool)
156156
} else {
157157
toolPath = CommandLine.FindExecutable(javaTool);
158158
if (!File.Exists(toolPath)) {
159-
Dialog.Display(
159+
DialogWindow.Display(
160160
"Android Resolver",
161161
String.Format("Unable to find {0} in the system path. This tool is " +
162162
"required to process Android libraries. Please configure " +
163163
"your JDK location under the " +
164164
"'Unity Preferences > External Tools' menu.",
165165
javaTool),
166-
Dialog.Option.Selected0, "OK");
166+
DialogWindow.Option.Selected0, "OK");
167167
throw new ToolNotFoundException(javaTool + " not found.");
168168
}
169169
}

source/AndroidResolver/src/PlayServicesResolver.cs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1724,7 +1724,7 @@ private static void ResolveUnsafeAfterPromptCheck(Action<bool> resolutionComplet
17241724
if (SettingsDialogObj.PromptBeforeAutoResolution &&
17251725
isAutoResolveJob &&
17261726
!ExecutionEnvironment.InBatchMode) {
1727-
Dialog.Display(
1727+
DialogWindow.Display(
17281728
"Enable Android Auto-resolution?",
17291729
"Android Resolver has detected a change " +
17301730
" and would to resolve conflicts and download Android dependencies." +
@@ -1736,15 +1736,15 @@ private static void ResolveUnsafeAfterPromptCheck(Action<bool> resolutionComplet
17361736
"\n\nEnable auto-resolution again via " +
17371737
"\"Assets > External Dependency Manager " +
17381738
"> Android Resolver > Settings.",
1739-
Dialog.Option.Selected0, "Enable", "Disable",
1740-
(selectedOption) => {
1739+
DialogWindow.Option.Selected0, "Enable", "Disable",
1740+
complete: (selectedOption) => {
17411741
bool shouldResolve = true;
17421742
switch (selectedOption) {
1743-
case Dialog.Option.Selected0: // Enable
1743+
case DialogWindow.Option.Selected0: // Enable
17441744
shouldResolve = true;
17451745
SettingsDialogObj.PromptBeforeAutoResolution = false;
17461746
break;
1747-
case Dialog.Option.Selected1: // Disable
1747+
case DialogWindow.Option.Selected1: // Disable
17481748
SettingsDialogObj.EnableAutoResolution = false;
17491749
SettingsDialogObj.PromptBeforeAutoResolution = false;
17501750
shouldResolve = false;
@@ -1867,9 +1867,9 @@ private static void ResolveUnsafe(Action<bool> resolutionComplete,
18671867
/// Display a dialog explaining that the resolver is disabled in the current configuration.
18681868
/// </summary>
18691869
private static void NotAvailableDialog() {
1870-
Dialog.Display("Android Resolver.",
1871-
"Resolver not enabled. Android platform must be selected.",
1872-
Dialog.Option.Selected0, "OK");
1870+
DialogWindow.Display("Android Resolver.",
1871+
"Resolver not enabled. Android platform must be selected.",
1872+
DialogWindow.Option.Selected0, "OK");
18731873

18741874
}
18751875

@@ -1903,12 +1903,12 @@ private static void ExecuteMenuResolve(bool forceResolution) {
19031903
}
19041904
ScheduleResolve(
19051905
forceResolution, false, (success) => {
1906-
Dialog.Display(
1906+
DialogWindow.Display(
19071907
"Android Dependencies",
19081908
String.Format("Resolution {0}", success ? "Succeeded" :
19091909
"Failed!\n\nYour application will not run, see " +
19101910
"the log for details."),
1911-
Dialog.Option.Selected0, "OK");
1911+
DialogWindow.Option.Selected0, "OK");
19121912
}, false);
19131913
}
19141914

@@ -2434,7 +2434,7 @@ private static void CheckGradleVersionForJetifier(bool useJetifier,
24342434
if ((new Dependency.VersionComparer()).Compare(
24352435
MinimumAndroidGradlePluginVersionForJetifier, version) < 0) {
24362436
displayedEnableJetifierDialog = true;
2437-
Dialog.Display(
2437+
DialogWindow.Display(
24382438
titlePrefix + "Enable Jetifier?",
24392439
String.Format(
24402440
"Jetifier for Jetpack (AndroidX) libraries is only " +
@@ -2446,16 +2446,16 @@ private static void CheckGradleVersionForJetifier(bool useJetifier,
24462446
"It's possible to use the Jetifier on Android Resolver managed " +
24472447
"dependencies by disabling mainTemplate.gradle patching.",
24482448
MinimumAndroidGradlePluginVersionForJetifier, version),
2449-
Dialog.Option.Selected1, "Disable Jetifier", "Ignore",
2449+
DialogWindow.Option.Selected1, "Disable Jetifier", "Ignore",
24502450
"Disable mainTemplate.gradle patching",
2451-
(selectedOption) => {
2451+
complete: (selectedOption) => {
24522452
switch (selectedOption) {
2453-
case Dialog.Option.Selected0: // Disable Jetifier
2453+
case DialogWindow.Option.Selected0: // Disable Jetifier
24542454
useJetifier = false;
24552455
break;
2456-
case Dialog.Option.Selected1: // Ignore
2456+
case DialogWindow.Option.Selected1: // Ignore
24572457
break;
2458-
case Dialog.Option.Selected2:
2458+
case DialogWindow.Option.Selected2:
24592459
// Disable mainTemplate.gradle patching
24602460
SettingsDialogObj.PatchMainTemplateGradle = false;
24612461
break;
@@ -2492,18 +2492,18 @@ private static void CheckApiLevelForJetifier(bool useJetifier,
24922492
const int MinimumApiLevelForJetpack = 28;
24932493
int apiLevel = UnityCompat.GetAndroidTargetSDKVersion();
24942494
if (useJetifier && apiLevel < MinimumApiLevelForJetpack) {
2495-
Dialog.Display(
2495+
DialogWindow.Display(
24962496
titlePrefix + "Enable Jetpack?",
24972497
String.Format(
24982498
"Jetpack (AndroidX) libraries are only supported when targeting Android " +
24992499
"API {0} and above. The currently selected target API level is {1}.\n\n" +
25002500
"Would you like to set the project's target API level to {0}?",
25012501
MinimumApiLevelForJetpack,
25022502
apiLevel > 0 ? apiLevel.ToString() : "auto (max. installed)"),
2503-
Dialog.Option.Selected1, "Yes", "No", "Disable Jetifier",
2504-
(selectedOption) => {
2503+
DialogWindow.Option.Selected1, "Yes", "No", "Disable Jetifier",
2504+
complete: (selectedOption) => {
25052505
switch (selectedOption) {
2506-
case Dialog.Option.Selected0: // Yes
2506+
case DialogWindow.Option.Selected0: // Yes
25072507
bool setSdkVersion = UnityCompat.SetAndroidTargetSDKVersion(
25082508
MinimumApiLevelForJetpack);
25092509
if (!setSdkVersion) {
@@ -2527,11 +2527,11 @@ private static void CheckApiLevelForJetifier(bool useJetifier,
25272527
complete(useJetifier ? ApiLevelJetifierResult.EnableAndSave :
25282528
ApiLevelJetifierResult.DisableAndSave);
25292529
break;
2530-
case Dialog.Option.Selected1: // No
2530+
case DialogWindow.Option.Selected1: // No
25312531
// Don't change the settings but report that AndroidX will not work.
25322532
complete(ApiLevelJetifierResult.EnableAndDoNotSave);
25332533
break;
2534-
case Dialog.Option.Selected2: // Disable Jetifier
2534+
case DialogWindow.Option.Selected2: // Disable Jetifier
25352535
complete(ApiLevelJetifierResult.DisableAndSave);
25362536
break;
25372537
}

source/IOSResolver/src/IOSResolver.cs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -700,22 +700,22 @@ exception is TypeInitializationException ||
700700
CocoapodsIntegrationUpgradeDefault) == CocoapodsIntegrationMethod.None &&
701701
!ExecutionEnvironment.InBatchMode && !UpgradeToWorkspaceWarningDisabled) {
702702

703-
Dialog.Display(
703+
DialogWindow.Display(
704704
"Warning: CocoaPods integration is disabled!",
705705
"Would you like to enable CocoaPods integration with workspaces?\n\n" +
706706
"Unity 5.6+ now supports loading workspaces generated from CocoaPods.\n" +
707707
"If you enable this, and still use Unity less than 5.6, it will fallback " +
708708
"to integrating CocoaPods with the .xcodeproj file.\n",
709-
Dialog.Option.Selected0, "Yes", "Not Now", "Silence Warning",
710-
(selectedOption) => {
709+
DialogWindow.Option.Selected0, "Yes", "Not Now", "Silence Warning",
710+
complete: (selectedOption) => {
711711
switch (selectedOption) {
712-
case Dialog.Option.Selected0: // Yes
712+
case DialogWindow.Option.Selected0: // Yes
713713
settings.SetInt(PREFERENCE_COCOAPODS_INTEGRATION_METHOD,
714714
(int)CocoapodsIntegrationMethod.Workspace);
715715
break;
716-
case Dialog.Option.Selected1: // Not now
716+
case DialogWindow.Option.Selected1: // Not now
717717
break;
718-
case Dialog.Option.Selected2: // Ignore
718+
case DialogWindow.Option.Selected2: // Ignore
719719
UpgradeToWorkspaceWarningDisabled = true;
720720
break;
721721
}
@@ -1018,7 +1018,9 @@ internal static void Log(string message, bool verbose = false,
10181018
/// </summary>
10191019
internal static void LogToDialog(string message, bool verbose = false,
10201020
LogLevel level = LogLevel.Info) {
1021-
if (!verbose) Dialog.Display("iOS Resolver", message, Dialog.Option.Selected0, "OK");
1021+
if (!verbose) {
1022+
DialogWindow.Display("iOS Resolver", message, DialogWindow.Option.Selected0, "OK");
1023+
}
10221024
Log(message, verbose: verbose, level: level);
10231025
}
10241026

@@ -1185,7 +1187,7 @@ public static void UpdateTargetSdk(bool runningBuild) {
11851187
if (minVersionAndPodNames.Value != null) {
11861188
var minVersionString =
11871189
TargetSdkVersionToString(minVersionAndPodNames.Key);
1188-
Dialog.Display(
1190+
DialogWindow.Display(
11891191
"Unsupported Target SDK",
11901192
String.Format(
11911193
"Target SDK selected in the iOS Player Settings ({0}) is not supported by " +
@@ -1194,21 +1196,21 @@ public static void UpdateTargetSdk(bool runningBuild) {
11941196
"Would you like to update the target SDK version?",
11951197
TargetSdk, minVersionString,
11961198
String.Join(", ", minVersionAndPodNames.Value.ToArray())),
1197-
Dialog.Option.Selected1 /* No */, "Yes", "No",
1198-
(selectedOption) => {
1199+
DialogWindow.Option.Selected1 /* No */, "Yes", "No",
1200+
complete: (selectedOption) => {
11991201
analytics.Report(
12001202
"updatetargetsdk/" +
1201-
(selectedOption == Dialog.Option.Selected0 ? "apply" : "cancel"),
1203+
(selectedOption == DialogWindow.Option.Selected0 ? "apply" : "cancel"),
12021204
"Update Target SDK");
1203-
if (selectedOption == Dialog.Option.Selected0) {
1205+
if (selectedOption == DialogWindow.Option.Selected0) {
12041206
TargetSdkVersion = minVersionAndPodNames.Key;
12051207
if (runningBuild) {
12061208
string errorString = String.Format(
12071209
"Target SDK has been updated from {0} to {1}. " +
12081210
"You must restart the build for this change to take effect.",
12091211
TargetSdk, minVersionString);
1210-
Dialog.Display("Target SDK updated.", errorString,
1211-
Dialog.Option.Selected0, "OK");
1212+
DialogWindow.Display("Target SDK updated.", errorString,
1213+
DialogWindow.Option.Selected0, "OK");
12121214
}
12131215
}
12141216
});

source/PackageManagerResolver/src/PackageMigrator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ public static void DisplaySelectionWindow(ICollection<PackageMap> packageMaps,
978978
/// <param name="error">Error message to display.</param>
979979
private static void DisplayError(string error) {
980980
Logger.Log(error, level: LogLevel.Error);
981-
Dialog.Display(WindowTitle, error, Dialog.Option.Selected0, "OK");
981+
DialogWindow.Display(WindowTitle, error, DialogWindow.Option.Selected0, "OK");
982982
}
983983

984984
/// <summary>

source/VersionHandlerImpl/VersionHandlerImpl.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
<Folder Include="Properties\" />
5454
</ItemGroup>
5555
<ItemGroup>
56-
<Compile Include="src\Dialog.cs" />
5756
<Compile Include="src\DialogWindow.cs" />
5857
<Compile Include="src\Logger.cs" />
5958
<Compile Include="src\ExecutionEnvironment.cs" />

0 commit comments

Comments
 (0)