Skip to content

Conversation

@mattleibow
Copy link
Member

Backport of #27183 to net10.0

@mattleibow mattleibow changed the base branch from main to net10.0 June 2, 2025 18:20
@mattleibow mattleibow marked this pull request as ready for review June 3, 2025 11:54
Copilot AI review requested due to automatic review settings June 3, 2025 11:54
@mattleibow mattleibow requested a review from a team as a code owner June 3, 2025 11:54
@mattleibow mattleibow merged commit e106339 into net10.0 Jun 3, 2025
129 checks passed
@mattleibow mattleibow deleted the dev/hybridwebview-backport-ts branch June 3, 2025 11:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the HybridWebView implementation by converting the JavaScript file into a TypeScript file and backporting the changes to net10.0.

  • Converted HybridWebView.js to HybridWebView.ts with strong typing and modern async functions.
  • Updated the build configuration (csproj and Directory.Build.targets) to support TypeScript and embed the generated JavaScript.
  • Removed the legacy HybridWebView.js assets in test and sample projects, updating asset references accordingly.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Core/src/Handlers/HybridWebView/HybridWebView.ts New TypeScript implementation with message dispatch and .NET invocation methods.
src/Core/src/Handlers/HybridWebView/HybridWebView.js Generated file updated based on the new TypeScript source.
src/Core/src/Core.csproj Added TypeScript compilation settings and updated Resource embedding for HybridWebView.js.
src/Controls/tests/DeviceTests/Resources/Raw/HybridWebView.js Removal of legacy implementation to prevent duplication.
src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj Updated asset reference for HybridWebView.js.
src/Controls/samples/Controls.Sample/Resources/Raw/HybridSamplePage/scripts/HybridWebView.js Removal of obsolete JavaScript file.
src/Controls/samples/Controls.Sample/Maui.Controls.Sample.csproj Revised asset inclusion pointing to the new HybridWebView.js file.
Directory.Build.targets Added a target override to prevent deletion of TypeScript output files between configurations.


const requestUrl = `${window.location.origin}/__hwvInvokeDotNet?data=${encodeURIComponent(message)}`;

const rawResponse = await fetch(requestUrl, {
Copy link

Copilot AI Jun 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider checking rawResponse.ok before processing the response JSON to handle non-2xx HTTP responses gracefully. For example, if (!rawResponse.ok) { /* handle error */ }.

Copilot uses AI. Check for mistakes.
@mattleibow
Copy link
Member Author

/backport to release/10.0.1xx-preview5

@github-actions
Copy link
Contributor

github-actions bot commented Jun 3, 2025

Started backporting to release/10.0.1xx-preview5: https://github.com/dotnet/maui/actions/runs/15420527971

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants