Skip to content
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
2 changes: 1 addition & 1 deletion src/MauiSherpa.Core/Services/DoctorService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ private async Task CheckJdkAsync(VersionDependency jdkDep, List<DependencyStatus
var status = installedVersion != null ? DependencyStatusType.Ok : DependencyStatusType.Error;
var message = installedVersion != null
? $"JDK {installedVersion} found"
: "JDK not found. Required for Android development.";
: "JDK not found. Download and run the Microsoft OpenJDK installer, then run Doctor again.";

dependencies.Add(new DependencyStatus(
"JDK",
Expand Down
5 changes: 5 additions & 0 deletions src/MauiSherpa/Components/BackgroundTaskCenter.razor
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,11 @@
catch (JSDisconnectedException)
{
}
catch (JSException ex) when (ex.Message.Contains(
"does not exist (has it been disposed?)",
StringComparison.Ordinal))
{
}

_dotNetReference?.Dispose();
}
Expand Down
5 changes: 5 additions & 0 deletions src/MauiSherpa/Components/SecretProviderPicker.razor
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,11 @@
catch (JSDisconnectedException)
{
}
catch (JSException ex) when (ex.Message.Contains(
"does not exist (has it been disposed?)",
StringComparison.Ordinal))
{
}

_dotNetReference?.Dispose();
}
Expand Down
25 changes: 23 additions & 2 deletions src/MauiSherpa/Pages/Doctor.razor
Original file line number Diff line number Diff line change
Expand Up @@ -375,10 +375,19 @@
<span class="dep-message">@dep.Message</span>
}
</div>
@if (dep.IsFixable)
@if (IsMissingJdk(dep))
{
<button class="btn btn-sm btn-fix"
@onclick="DownloadMicrosoftOpenJdk"
disabled="@isLoading">
<i class="fas fa-download"></i>
Download Microsoft OpenJDK
</button>
}
else if (dep.IsFixable)
{
<button class="btn btn-sm btn-fix" @onclick="@(() => FixDependency(dep))" disabled="@isLoading">
Fix
@GetDependencyActionLabel(dep)
</button>
}
</div>
Expand Down Expand Up @@ -1182,6 +1191,18 @@ else
_ => "status-unknown"
};

private static bool IsMissingJdk(DependencyStatus dependency) =>
dependency.Category == DependencyCategory.Jdk &&
dependency.Status == DependencyStatusType.Error;

private static string GetDependencyActionLabel(DependencyStatus dependency) =>
dependency.FixAction == "install-android-sdk"
? "Install Android SDK"
: "Fix";

private Task DownloadMicrosoftOpenJdk() =>
OpenUrl("https://learn.microsoft.com/java/openjdk/download");

private string GetCategoryName(DependencyCategory category) => category switch
{
DependencyCategory.DotNetSdk => ".NET SDK",
Expand Down
Loading