dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.26k stars 1.76k forks source link

Add support for async .NET methods #25967

Open mattleibow opened 3 days ago

mattleibow commented 3 days ago

Description of Change

This PR makes the call from JS into .NET be able to support async methods (return Task or Task<T>)

This PR has a fair bit of things moving around because of the async and the fact that I wanted to make the code flow the same on all the platforms. The code was getting a bit nested, so I broke things out into methods.

Issues Fixed

Fixes https://github.com/dotnet/maui/issues/25968

This pull request includes several changes to improve the handling of asynchronous operations and simplify the codebase for HybridWebView. The most important changes include the addition of new methods for handling asynchronous tasks, refactoring existing methods to use these new async methods, and updating the test cases accordingly.

Asynchronous Handling Improvements:

Test Case Updates:

Codebase Simplification: