prepareChangelogOverlay method
- bool onlyIfUnseen = false,
Loads newest release entries and appearance for the What's-New overlay.
If onlyIfUnseen is true, returns null if the latest entry has already been marked seen.
Implementation
Future<({List<ChangelogEntry> entries, SdkAppearance appearance})?>
prepareChangelogOverlay({bool onlyIfUnseen = false}) async {
final appConfig = await fetchAppConfig();
if (!appConfig.sdk.features.changelog) return null;
final limit = appConfig.sdk.changelogOverlay.clampedEntryCount;
final all = await fetchChangelog();
final entries = all.take(limit).toList();
if (entries.isEmpty) return null;
if (onlyIfUnseen) {
final latest = entries.first;
final versionKey = latest.versionLabel ?? latest.id;
if (versionKey.isNotEmpty && await hasSeenChangelog(versionKey)) {
return null;
}
}
return (entries: entries, appearance: appConfig.sdk);
}