Add Progress over time and a targets and reminders setup
Progress gives a Day/Week/Month view of routines held against a weekly target, compared with the same point of the previous period, with active time and the daily streak. Targets & reminders sets routines and minutes per week and schedules a heads-up before each routine. The runner's summary now shows today's held count and streak. Finished runs are mirrored to a device run log that feeds both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KhQh614DMeYoQEH9SoMRUw
This commit is contained in:
@@ -8,6 +8,8 @@ import '../about/external/data/ResponseState.dart';
|
||||
import '../about/external/data/SystemResponse.dart';
|
||||
import '../about/internal/application/CapacityProfile.dart';
|
||||
import '../about/internal/application/MeDescription.dart';
|
||||
import '../about/internal/application/ProgressTargets.dart';
|
||||
import '../about/internal/application/RoutineRunRecord.dart';
|
||||
import '../about/internal/application/TodoItem.dart';
|
||||
import '../about/internal/application/Token.dart';
|
||||
import '../about/internal/application/UserDetails.dart';
|
||||
@@ -42,6 +44,8 @@ class InternalMemory implements ConnectInternalMemory {
|
||||
static const String AMNESTY_SPENT = "AMNESTY_SPENT_Jr4xVh9KmT3gLc6B";
|
||||
|
||||
static const String TODOS = "TODOS_Wm3kRb8TqZ5nHc2F";
|
||||
static const String RUN_LOG = "RUN_LOG_p8Xq2LbV7nZr4KcT";
|
||||
static const String PROGRESS_TARGETS = "PROGRESS_TARGETS_Hd5sWm9JqR3vYx6B";
|
||||
|
||||
static const String SHOW_ONBOARDING = "SHOW_ONBOARDING_Nz6qGf2SdX7wPb4M";
|
||||
|
||||
@@ -275,6 +279,44 @@ class InternalMemory implements ConnectInternalMemory {
|
||||
value: jsonEncode(todos.map((item) => item.toJson()).toList()));
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<RoutineRunRecord>> getRunLog() async {
|
||||
String? value = await groundedStorage.read(key: RUN_LOG);
|
||||
|
||||
if (value != null) {
|
||||
return (jsonDecode(value) as List<dynamic>)
|
||||
.map((item) =>
|
||||
RoutineRunRecord.fromJson(item as Map<String, dynamic>))
|
||||
.toList();
|
||||
}
|
||||
|
||||
return <RoutineRunRecord>[];
|
||||
}
|
||||
|
||||
@override
|
||||
Future setRunLog(List<RoutineRunRecord> records) async {
|
||||
await groundedStorage.write(
|
||||
key: RUN_LOG,
|
||||
value: jsonEncode(records.map((item) => item.toJson()).toList()));
|
||||
}
|
||||
|
||||
@override
|
||||
Future<ProgressTargets> getProgressTargets() async {
|
||||
String? value = await groundedStorage.read(key: PROGRESS_TARGETS);
|
||||
|
||||
if (value != null) {
|
||||
return ProgressTargets.fromJson(jsonDecode(value));
|
||||
}
|
||||
|
||||
return ProgressTargets();
|
||||
}
|
||||
|
||||
@override
|
||||
Future setProgressTargets(ProgressTargets targets) async {
|
||||
await groundedStorage.write(
|
||||
key: PROGRESS_TARGETS, value: jsonEncode(targets.toJson()));
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> showOnboarding() async {
|
||||
String? value = await groundedStorage.read(key: SHOW_ONBOARDING);
|
||||
|
||||
Reference in New Issue
Block a user