fix: load settings on startup and set lesson cache createdAt

This commit is contained in:
2026-09-08 07:20:37 +02:00
parent 95b6af52c2
commit 394b7bfd70
4 changed files with 10 additions and 2 deletions

View File

@@ -32,7 +32,7 @@ class TimetableWidgetReceiver : HomeWidgetGlanceWidgetReceiver<TimetableWidget>(
} catch (e: Exception) {
Log.e("TimetableWidget", "Failed glanceAppWidget.updateAll from onReceive", e)
} finally {
pendingResult.finish()
pendingResult?.finish()
}
}
}
@@ -51,7 +51,7 @@ class TimetableWidgetReceiver : HomeWidgetGlanceWidgetReceiver<TimetableWidget>(
val glanceId = GlanceAppWidgetManager(context).getGlanceIdBy(appWidgetId)
glanceAppWidget.update(context, glanceId)
} finally {
pendingResult.finish()
pendingResult?.finish()
}
}
}

View File

@@ -244,6 +244,7 @@ Future<void> initializeApp() async {
);
initData.settings.cubit = initData.settingsCubit;
Settings = initData.settings;
await Settings.loadAll();
registerSettingsEffects(initData.settings, initData);
try {

View File

@@ -208,6 +208,12 @@ class NotificationDiffService {
body: body(newItems),
);
}
} else {
// First run: seed baseline silently without spamming backlog.
// If there are no items yet, record current time so subsequent items notify.
final baseline = LastSeen.newestOf(items) ?? LastSeen(DateTime.now(), 0);
await LastSeenHelper.set(accountKey, kind, baseline);
return;
}
final newest = LastSeen.newestOf(items);

View File

@@ -50,6 +50,7 @@ class LessonCacheModel extends GenericCacheModel<Lesson> {
..topic = ctx.data.theme
..roomName = ctx.data.roomName
..type = ctx.data.type.name
..createdAt = ctx.data.lastModifiedAt
..classGroup.init(ctx.cacheManager, ctx.data.classGroup)
..subject.init(ctx.cacheManager, ctx.data.subject);