Refactor: Remove GlobalVar and replace with IAppSettings; restructure affected infrastructure, services, and view models for dependency injection.
This commit is contained in:
41
Jugenddienst Stunden/Infrastructure/AppSettings.cs
Normal file
41
Jugenddienst Stunden/Infrastructure/AppSettings.cs
Normal 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; }
|
||||
}
|
||||
Reference in New Issue
Block a user