2025-06-19 21:50:35 +02:00
|
|
|
|
using Microsoft.Extensions.Logging;
|
2025-06-23 15:07:13 +02:00
|
|
|
|
using MudBlazor.Services;
|
2025-06-19 21:50:35 +02:00
|
|
|
|
|
|
|
|
|
|
namespace Bimix.UI.Mobile;
|
|
|
|
|
|
|
|
|
|
|
|
public static class MauiProgram
|
|
|
|
|
|
{
|
|
|
|
|
|
public static MauiApp CreateMauiApp()
|
|
|
|
|
|
{
|
|
|
|
|
|
var builder = MauiApp.CreateBuilder();
|
|
|
|
|
|
builder
|
|
|
|
|
|
.UseMauiApp<App>()
|
|
|
|
|
|
.ConfigureFonts(fonts => { fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); });
|
|
|
|
|
|
|
|
|
|
|
|
builder.Services.AddMauiBlazorWebView();
|
2025-06-23 15:53:46 +02:00
|
|
|
|
|
|
|
|
|
|
builder.Services.AddMudServices();
|
|
|
|
|
|
|
|
|
|
|
|
var baseUrl = GetApiBaseUrl();
|
|
|
|
|
|
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(baseUrl) });
|
2025-06-19 21:50:35 +02:00
|
|
|
|
|
|
|
|
|
|
#if DEBUG
|
|
|
|
|
|
builder.Services.AddBlazorWebViewDeveloperTools();
|
|
|
|
|
|
builder.Logging.AddDebug();
|
|
|
|
|
|
#endif
|
|
|
|
|
|
return builder.Build();
|
|
|
|
|
|
}
|
2025-06-23 15:53:46 +02:00
|
|
|
|
|
|
|
|
|
|
private static string GetApiBaseUrl()
|
|
|
|
|
|
{
|
|
|
|
|
|
#if IOS
|
|
|
|
|
|
// iOS symulator - użyj swojego IP
|
|
|
|
|
|
return "http://192.168.1.100:5015/"; // Zastąp swoim IP
|
|
|
|
|
|
#else
|
|
|
|
|
|
return "https://localhost:7015/";
|
|
|
|
|
|
#endif
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-06-19 21:50:35 +02:00
|
|
|
|
}
|