Skip to content

Commit

Permalink
feat: Update Maui Embedding for .NET 8
Browse files Browse the repository at this point in the history
  • Loading branch information
dansiegel committed Jan 23, 2024
1 parent 4ae0aa8 commit 5f3daa9
Show file tree
Hide file tree
Showing 12 changed files with 202 additions and 328 deletions.
3 changes: 1 addition & 2 deletions samples/MauiEmbedding/MauiEmbedding/App.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
using MauiEmbedding.MauiControls;
using Uno.Extensions.Maui.Platform;

namespace MauiEmbedding;

public class App : EmbeddingApplication
public class App : Application
{
protected Window? MainWindow { get; private set; }
protected IHost? Host { get; private set; }
Expand Down
13 changes: 4 additions & 9 deletions src/Uno.Extensions.Maui.UI/MauiEmbedding.android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,10 @@ private static void InitializeMauiEmbeddingApp(this MauiApp mauiApp, Application
rootContext.InitializeScopedServices();

var iApp = mauiApp.Services.GetRequiredService<IApplication>();
if(app is not EmbeddingApplication embeddingApp)
{
throw new MauiEmbeddingException(Properties.Resources.TheApplicationMustInheritFromEmbeddingApplication);
}

embeddingApp.InitializeApplication(scope.ServiceProvider, iApp);

// Initializing with the Activity to set the current activity.
// The Bundle is not actually used by Maui
_ = new EmbeddedApplication(mauiApp.Services, iApp);

// Initializing with the Activity to set the current activity.
// The Bundle is not actually used by Maui
Microsoft.Maui.ApplicationModel.Platform.Init(activity, null);

androidApp.SetApplicationHandler(iApp, rootContext);
Expand Down
6 changes: 1 addition & 5 deletions src/Uno.Extensions.Maui.UI/MauiEmbedding.apple.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,9 @@ private static void InitializeMauiEmbeddingApp(this MauiApp mauiApp, Application
rootContext.InitializeScopedServices();

var iApp = mauiApp.Services.GetRequiredService<IApplication>();
if (app is not EmbeddingApplication embeddingApp)
{
throw new MauiEmbeddingException(Properties.Resources.TheApplicationMustInheritFromEmbeddingApplication);
}

Microsoft.Maui.ApplicationModel.Platform.Init(() => mauiApp.Services.GetRequiredService<UIWindow>().RootViewController!);
embeddingApp.InitializeApplication(mauiApp.Services, iApp);
_ = new EmbeddedApplication(mauiApp.Services, iApp);
app.SetApplicationHandler(iApp, rootContext);
InitializeApplicationMainPage(iApp);
}
Expand Down
Loading

0 comments on commit 5f3daa9

Please sign in to comment.