fix(boosters): address final-review findings

- daily claim: record the claim before granting boosters, so a crash
  mid-claim forfeits at most one reward instead of allowing a re-claim
  (booster farming) on next launch.
- game screen: disarm the booster target synchronously before awaiting,
  so a rapid second board tap can't double-fire a use or stack a dialog.
- new players: seed one of each booster once (idempotent persisted flag),
  fulfilling the spec's starting inventory. Wired in main().

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-18 19:36:24 +09:00
parent 412cc08167
commit fa2784519b
5 changed files with 44 additions and 4 deletions
+4 -1
View File
@@ -25,11 +25,14 @@ class DailyRewardNotifier extends Notifier<DailyResolution> {
final r = state;
if (!r.claimable) return;
final reward = _cal.rewardFor(r.day);
// Record the claim BEFORE granting, so a crash mid-claim forfeits at most
// one reward rather than leaving the day unrecorded (which would let the
// player re-claim and farm boosters on the next launch).
await _save.recordDailyClaim(_cal.ymd(_now()), r.day);
final inv = ref.read(boosterInventoryProvider.notifier);
for (final entry in reward.entries) {
await inv.grant(entry.key, entry.value * (doubled ? 2 : 1));
}
await _save.recordDailyClaim(_cal.ymd(_now()), r.day);
ref.read(analyticsProvider).dailyRewardClaimed(day: r.day, doubled: doubled);
for (final e in reward.entries) {
ref.read(analyticsProvider).boosterGranted(