Refactor: Remove GlobalVar and replace with IAppSettings; restructure affected infrastructure, services, and view models for dependency injection.

This commit is contained in:
2025-12-26 11:43:20 +01:00
parent 1ee0fc61f6
commit 4d5b093ea0
15 changed files with 103 additions and 463 deletions

View File

@@ -0,0 +1,41 @@
using Jugenddienst_Stunden.Interfaces;
using Jugenddienst_Stunden.Types;
namespace Jugenddienst_Stunden.Infrastructure;
/// <summary>
/// Represents the application settings and provides access to user preferences
/// such as API URL, API key, employee ID, and personal details.
/// </summary>
/// <remarks>
/// The <c>AppSettings</c> class implements the <c>IAppSettings</c> interface and manages
/// persistent configuration settings needed for the application.
/// These settings include preferences like API configuration and user identification details.
/// </remarks>
internal sealed class AppSettings : IAppSettings {
public string ApiUrl {
get => Preferences.Default.Get("apiUrl", "");
set => Preferences.Default.Set("apiUrl", value);
}
public string ApiKey {
get => Preferences.Default.Get("apiKey", "");
set => Preferences.Default.Set("apiKey", value);
}
public int EmployeeId {
get => Preferences.Default.Get("EmployeeId", 0);
set => Preferences.Default.Set("EmployeeId", value);
}
public string Name {
get => Preferences.Default.Get("name", "Nicht");
set => Preferences.Default.Set("name", value);
}
public string Surname {
get => Preferences.Default.Get("surname", "Eingeloggt");
set => Preferences.Default.Set("surname", value);
}
public Settings? Settings { get; set; }
}