forked from firka/firka
fix: load settings on startup and set lesson cache createdAt
This commit is contained in:
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,6 +244,7 @@ Future<void> initializeApp() async {
|
||||
);
|
||||
initData.settings.cubit = initData.settingsCubit;
|
||||
Settings = initData.settings;
|
||||
await Settings.loadAll();
|
||||
registerSettingsEffects(initData.settings, initData);
|
||||
|
||||
try {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user