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:
@@ -42,6 +42,7 @@ import '../../utils/ToneEngine.dart';
|
||||
import '../commitment/NewCommitment.dart';
|
||||
import '../excuse/ExcuseReport.dart';
|
||||
import '../goal/Goals.dart';
|
||||
import '../progress/Progress.dart';
|
||||
import '../group/GroupChat.dart';
|
||||
import '../group/GroupEditor.dart';
|
||||
import '../group/Groups.dart';
|
||||
@@ -182,6 +183,10 @@ class HomeState extends State<Home> implements ConnectHome {
|
||||
_model?.tick(item);
|
||||
}
|
||||
|
||||
void _onOpenProgress() {
|
||||
GroundedNavigation().navigateToPageWithData(const Progress(), context);
|
||||
}
|
||||
|
||||
void _onOpenReportCard() {
|
||||
GroundedNavigation().navigateToPage(
|
||||
NavigatorType.justOpen, const ReportCardScreen(), context);
|
||||
@@ -445,8 +450,8 @@ class HomeState extends State<Home> implements ConnectHome {
|
||||
),
|
||||
(
|
||||
icon: CupertinoIcons.chart_bar_alt_fill,
|
||||
label: "Insights",
|
||||
onTap: _onOpenReportCard
|
||||
label: "Progress",
|
||||
onTap: _onOpenProgress
|
||||
),
|
||||
],
|
||||
).animate().fadeIn(duration: 400.ms, delay: 250.ms).slideY(
|
||||
|
||||
@@ -12,9 +12,11 @@ import '../../about/external/data/pages/response/CommitmentPage.dart';
|
||||
import '../../about/external/initial/CompletionRequest.dart';
|
||||
import '../../about/external/initial/ReportCardRequest.dart';
|
||||
import '../../about/internal/application/CommitmentClass.dart';
|
||||
import '../../about/internal/application/ProgressTargets.dart';
|
||||
import '../../about/internal/application/Standing.dart';
|
||||
import '../../about/internal/application/TodoItem.dart';
|
||||
import '../../about/internal/application/UserDetails.dart';
|
||||
import '../../configs/NotificationServiceConfig.dart';
|
||||
import '../../utils/DebtEngine.dart';
|
||||
import '../../utils/GuardrailEngine.dart';
|
||||
import '../../utils/ObjectConvertors.dart';
|
||||
@@ -125,12 +127,27 @@ class ViewHome extends ParentViewModel {
|
||||
),
|
||||
));
|
||||
|
||||
connection.onRoutinesLoaded(getRoutineChainList(response.data));
|
||||
final List<RoutineChain> routines = getRoutineChainList(response.data);
|
||||
|
||||
connection.onRoutinesLoaded(routines);
|
||||
|
||||
_placeReminders(routines);
|
||||
} catch (e) {
|
||||
connection.onRoutinesLoaded(<RoutineChain>[]);
|
||||
}
|
||||
}
|
||||
|
||||
/// Reminders are one-shots for the coming week, so they are re-placed
|
||||
/// whenever the schedule is read.
|
||||
void _placeReminders(List<RoutineChain> routines) async {
|
||||
final ProgressTargets targets =
|
||||
await getDataManager().getProgressTargets();
|
||||
if (targets.reminders) {
|
||||
await LocalNotificationEngine.scheduleRoutineReminders(
|
||||
routines, targets.reminderLead);
|
||||
}
|
||||
}
|
||||
|
||||
void loadOverdue() async {
|
||||
try {
|
||||
final response = await getDataManager().getOverdueQueue(HistoryRequest(
|
||||
|
||||
Reference in New Issue
Block a user