Farbpalette vorladen lassen
Bootstraper läd jetzt die farbeinstellung sofort und nicht nachträglich cleanup and rework PDF switch to HTML export fix Colorsystem Farben für knöpfe hinzugefügt als anpassung button color button color primary and secondary change
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
using cfs_tracker.Data;
|
||||
|
||||
namespace cfs_tracker.Services;
|
||||
|
||||
public class AppBootstrapService
|
||||
{
|
||||
private readonly AppDatabase _database;
|
||||
private readonly ActivityRepository _activityRepository;
|
||||
private readonly SymptomRepository _symptomRepository;
|
||||
private readonly AppearanceRepository _appearanceRepository;
|
||||
private readonly AppearanceService _appearanceService;
|
||||
private readonly INotificationScheduler _notificationScheduler;
|
||||
|
||||
private bool _initialized;
|
||||
|
||||
public AppBootstrapService(
|
||||
AppDatabase database,
|
||||
ActivityRepository activityRepository,
|
||||
SymptomRepository symptomRepository,
|
||||
AppearanceRepository appearanceRepository,
|
||||
AppearanceService appearanceService,
|
||||
INotificationScheduler notificationScheduler)
|
||||
{
|
||||
_database = database;
|
||||
_activityRepository = activityRepository;
|
||||
_symptomRepository = symptomRepository;
|
||||
_appearanceRepository = appearanceRepository;
|
||||
_appearanceService = appearanceService;
|
||||
_notificationScheduler = notificationScheduler;
|
||||
}
|
||||
|
||||
public async Task InitializeAsync()
|
||||
{
|
||||
if (_initialized)
|
||||
return;
|
||||
|
||||
await _database.InitAsync();
|
||||
await _activityRepository.EnsureDefaultsAsync();
|
||||
await _symptomRepository.EnsureDefaultsAsync();
|
||||
await _appearanceRepository.EnsureDefaultsAsync();
|
||||
|
||||
// Wichtig: gespeicherte Appearance-Werte direkt beim Start
|
||||
// auf die App-Ressourcen anwenden.
|
||||
await _appearanceService.ApplyAsync();
|
||||
|
||||
await _notificationScheduler.SyncAsync();
|
||||
|
||||
_initialized = true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user