Skip to content

Commit

Permalink
Merge pull request #1841 from unoplatform/mergify/bp/release/stable/2…
Browse files Browse the repository at this point in the history
….5/pr-1838

chore: tidy up UseMauiEmbedding extension methods (backport #1838)
  • Loading branch information
jeromelaban authored Aug 31, 2023
2 parents b2fcfe9 + 9d2a1cc commit d248a99
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<PackageReference Include="Telerik.UI.for.Maui" Condition="$(_UseTelerik)"/>
<PackageReference Include="CommunityToolkit.Maui" />
<PackageReference Include="Uno.UI.Adapter.Microsoft.Extensions.Logging" />
<PackageReference Include="Uno.WinUI.RemoteControl" Condition="'$(Configuration)'=='Debug'" />
<!--<PackageReference Include="Uno.WinUI.RemoteControl" Condition="'$(Configuration)'=='Debug'" />-->
</ItemGroup>
<Choose>
<When Condition="$(IsAndroid)">
Expand Down
42 changes: 5 additions & 37 deletions src/Uno.Extensions.Maui.UI/MauiEmbedding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,6 @@ namespace Uno.Extensions.Maui;
/// </summary>
public static partial class MauiEmbedding
{
/// <summary>
/// Registers Maui embedding in the Uno Platform app builder.
/// </summary>
/// <returns>The updated app builder.</returns>
/// <param name="builder">The IHost builder.</param>
/// <param name="configure">Optional lambda to configure the Maui app builder.</param>
public static IApplicationBuilder UseMauiEmbedding(this IApplicationBuilder builder, Action<MauiAppBuilder>? configure = null) =>
builder.UseMauiEmbedding<MauiApplication>(configure);

/// <summary>
/// Registers Maui embedding in the Uno Platform app builder.
/// </summary>
Expand All @@ -26,21 +17,7 @@ public static IApplicationBuilder UseMauiEmbedding(this IApplicationBuilder buil
/// <param name="configure">Optional lambda to configure the Maui app builder.</param>
public static IApplicationBuilder UseMauiEmbedding<TApp>(this IApplicationBuilder builder, Action<MauiAppBuilder>? configure = null)
where TApp : MauiApplication
{
builder.App.UseMauiEmbedding<TApp>(builder.Window, configure);
return builder;
}

/// <summary>
/// Registers Maui embedding in the Uno Platform app builder.
/// </summary>
/// <returns>The updated app builder.</returns>
/// <param name="builder">The IHost builder.</param>
/// <param name="app">The Uno app.</param>
/// <param name="window">The Main Application Window.</param>
/// <param name="configure">Optional lambda to configure the Maui app builder.</param>
public static IHostBuilder UseMauiEmbedding(this IHostBuilder builder, Microsoft.UI.Xaml.Application app, Microsoft.UI.Xaml.Window window, Action<MauiAppBuilder>? configure = null) =>
builder.UseMauiEmbedding<MauiApplication>(app, window, configure);
=> builder.Configure(hostBuilder => hostBuilder.UseMauiEmbedding<TApp>(builder.App, builder.Window, configure));

/// <summary>
/// Registers Maui embedding in the Uno Platform app builder.
Expand All @@ -63,16 +40,7 @@ public static IHostBuilder UseMauiEmbedding<TApp>(this IHostBuilder builder, Mic
/// <param name="app">The Uno app.</param>
/// <param name="window">The Main Application Window.</param>
/// <param name="configure">Optional lambda to configure the Maui app builder.</param>
public static Microsoft.UI.Xaml.Application UseMauiEmbedding(this Microsoft.UI.Xaml.Application app, Microsoft.UI.Xaml.Window window, Action<MauiAppBuilder>? configure = null) =>
app.UseMauiEmbedding<MauiApplication>(window, configure);

/// <summary>
/// Registers Maui embedding with WinUI3 and WPF application builder.
/// </summary>
/// <param name="app">The Uno app.</param>
/// <param name="window">The Main Application Window.</param>
/// <param name="configure">Optional lambda to configure the Maui app builder.</param>
public static Microsoft.UI.Xaml.Application UseMauiEmbedding<TApp>(this Microsoft.UI.Xaml.Application app, Microsoft.UI.Xaml.Window window, Action<MauiAppBuilder>? configure = null)
public static MauiApp UseMauiEmbedding<TApp>(this Microsoft.UI.Xaml.Application app, Microsoft.UI.Xaml.Window window, Action<MauiAppBuilder>? configure = null)
where TApp : MauiApplication
{
#if MAUI_EMBEDDING
Expand All @@ -99,10 +67,10 @@ public static Microsoft.UI.Xaml.Application UseMauiEmbedding<TApp>(this Microsof
WindowStateManager.Default.OnActivated(window, args);
};
#endif


return mauiApp;
#else
return default!;
#endif
return app;
}

#if MAUI_EMBEDDING
Expand Down

0 comments on commit d248a99

Please sign in to comment.