Add daily streak system and normalize bundle id to com.airkjw.blockseasons

Pure advanceStreak (1-day grace none, milestone flags at 3/7/14/30),
persisted in the save blob; StreakNotifier advances on every finished
attempt; home screen flame chip and milestone snackbar. Fix flutter
create's camelCased iOS bundle id and underscored Android application
id to the agreed lowercase form before any store registration.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-11 17:25:39 +09:00
parent 7bc26447f7
commit 607278928b
14 changed files with 271 additions and 15 deletions
+23
View File
@@ -2,6 +2,8 @@ import 'dart:convert';
import 'package:shared_preferences/shared_preferences.dart';
import 'streak.dart';
class StageProgress {
const StageProgress({required this.stars, required this.bestScore});
@@ -24,6 +26,14 @@ class SaveRepository {
bestScore: value['bestScore'] as int,
);
}
final streak = json['streak'] as Map<String, dynamic>?;
if (streak != null) {
_streak = StreakState(
current: streak['current'] as int,
best: streak['best'] as int,
lastYmd: streak['lastYmd'] as String?,
);
}
}
}
@@ -34,6 +44,14 @@ class SaveRepository {
final SharedPreferences _prefs;
final Map<String, StageProgress> _progress = {};
StreakState _streak = StreakState.initial;
StreakState get streak => _streak;
Future<void> saveStreak(StreakState streak) {
_streak = streak;
return _flush();
}
static String _id(String seasonId, String stageId) => '$seasonId/$stageId';
@@ -88,6 +106,11 @@ class SaveRepository {
'bestScore': entry.value.bestScore,
},
},
'streak': {
'current': _streak.current,
'best': _streak.best,
'lastYmd': _streak.lastYmd,
},
}),
);
}