feat: session content sync trigger and newest-season selection

Add seasonRefreshProvider (once-per-session FutureProvider) and activeSeason()
helper; HomeScreen listens and invalidates seasonsProvider when new packs arrive;
season_map_screen and season_title_screen switch from list.first to activeSeason.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-12 13:28:39 +09:00
parent 73a56aeeb1
commit 4fa5564975
5 changed files with 76 additions and 2 deletions
+5
View File
@@ -21,6 +21,11 @@ class HomeScreen extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
ref.listen(seasonRefreshProvider, (_, next) {
if (next is AsyncData<bool> && next.value == true) {
ref.invalidate(seasonsProvider);
}
});
final l10n = AppLocalizations.of(context)!;
final streak = ref.watch(streakProvider);
final best = ref.watch(endlessBestProvider);
+1 -1
View File
@@ -21,7 +21,7 @@ class SeasonMapScreen extends ConsumerWidget {
loading: () =>
const Scaffold(body: Center(child: CircularProgressIndicator())),
error: (e, _) => Scaffold(body: Center(child: Text('$e'))),
data: (list) => _JourneyMap(pack: list.first),
data: (list) => _JourneyMap(pack: activeSeason(list)),
);
}
}
+1 -1
View File
@@ -63,7 +63,7 @@ class _SeasonTitleScreenState extends ConsumerState<SeasonTitleScreen> {
_auto?.cancel();
_auto = Timer(const Duration(milliseconds: 1600), _go);
}
final pack = list.first;
final pack = activeSeason(list);
final locale = Localizations.localeOf(context).languageCode;
final number = int.tryParse(pack.seasonId.split('_').last) ?? 1;
return GestureDetector(