39 lines
1.3 KiB
C#
39 lines
1.3 KiB
C#
using CommunityToolkit.Maui;
|
|
using Microsoft.AspNetCore.Components.Authorization;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace Neighbourhood.omg.lol {
|
|
public static class MauiProgram {
|
|
public static MauiApp CreateMauiApp() {
|
|
var builder = MauiApp.CreateBuilder();
|
|
builder
|
|
.UseMauiApp<App>()
|
|
.UseMauiCommunityToolkit(options => {
|
|
options.SetShouldEnableSnackbarOnWindows(true);
|
|
});
|
|
|
|
builder.Services.AddMauiBlazorWebView();
|
|
builder.Services.AddTransient<LoginWebViewPage>();
|
|
|
|
builder.Services.AddSingleton<ApiService>();
|
|
builder.Services.AddSingleton<State>();
|
|
builder.Services.AddSingleton<NavigatorService>();
|
|
|
|
using Stream stream = App.Assembly.GetManifestResourceStream($"{App.Name}.appsettings.json")!;
|
|
var config = new ConfigurationBuilder().AddJsonStream(stream).Build();
|
|
builder.Configuration.AddConfiguration(config);
|
|
|
|
builder.Services.AddAuthorizationCore();
|
|
builder.Services.AddScoped<CustomAuthenticationStateProvider>();
|
|
builder.Services.AddScoped<AuthenticationStateProvider>(s => s.GetRequiredService<CustomAuthenticationStateProvider>());
|
|
|
|
#if DEBUG
|
|
builder.Services.AddBlazorWebViewDeveloperTools();
|
|
builder.Logging.AddDebug();
|
|
#endif
|
|
|
|
return builder.Build();
|
|
}
|
|
}
|
|
}
|