2024-07-25 03:59:57 +00:00
|
|
|
|
using CommunityToolkit.Maui;
|
|
|
|
|
using Microsoft.AspNetCore.Components.Authorization;
|
2024-06-05 12:41:08 +00:00
|
|
|
|
using Microsoft.Extensions.Configuration;
|
2024-05-31 13:16:09 +00:00
|
|
|
|
using Microsoft.Extensions.Logging;
|
2024-05-30 01:06:08 +00:00
|
|
|
|
|
|
|
|
|
namespace Neighbourhood.omg.lol {
|
|
|
|
|
public static class MauiProgram {
|
|
|
|
|
public static MauiApp CreateMauiApp() {
|
|
|
|
|
var builder = MauiApp.CreateBuilder();
|
|
|
|
|
builder
|
2024-07-25 03:59:57 +00:00
|
|
|
|
.UseMauiApp<App>()
|
|
|
|
|
.UseMauiCommunityToolkit(options => {
|
|
|
|
|
options.SetShouldEnableSnackbarOnWindows(true);
|
|
|
|
|
});
|
2024-05-30 01:06:08 +00:00
|
|
|
|
|
|
|
|
|
builder.Services.AddMauiBlazorWebView();
|
2024-05-31 13:16:09 +00:00
|
|
|
|
builder.Services.AddTransient<LoginWebViewPage>();
|
|
|
|
|
|
2024-07-16 00:45:33 +00:00
|
|
|
|
builder.Services.AddSingleton<ApiService>();
|
2024-06-01 04:38:12 +00:00
|
|
|
|
builder.Services.AddSingleton<State>();
|
|
|
|
|
builder.Services.AddSingleton<NavigatorService>();
|
|
|
|
|
|
2024-07-01 23:19:37 +00:00
|
|
|
|
using Stream stream = App.Assembly.GetManifestResourceStream($"{App.Name}.appsettings.json")!;
|
2024-06-24 04:51:48 +00:00
|
|
|
|
var config = new ConfigurationBuilder().AddJsonStream(stream).Build();
|
|
|
|
|
builder.Configuration.AddConfiguration(config);
|
2024-06-05 12:41:08 +00:00
|
|
|
|
|
2024-05-31 13:16:09 +00:00
|
|
|
|
builder.Services.AddAuthorizationCore();
|
|
|
|
|
builder.Services.AddScoped<CustomAuthenticationStateProvider>();
|
|
|
|
|
builder.Services.AddScoped<AuthenticationStateProvider>(s => s.GetRequiredService<CustomAuthenticationStateProvider>());
|
2024-05-30 01:06:08 +00:00
|
|
|
|
|
|
|
|
|
#if DEBUG
|
2024-05-31 13:16:09 +00:00
|
|
|
|
builder.Services.AddBlazorWebViewDeveloperTools();
|
2024-05-30 01:06:08 +00:00
|
|
|
|
builder.Logging.AddDebug();
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
return builder.Build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|