Routines: workout, meditation and must-do routines with timed, rep and tick steps, sets and rest. A library screen, a builder with templates and drag-to-reorder steps, and a full-screen player that auto-advances timed phases, counts backgrounding and logs broken chains as partial. Goals: a goal editor (deadline, colour, category, default class, archive), routines linked to goals, and a goal field on tasks and routines. Tasks added from inside a goal are now actually attached to it via parentId. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KhQh614DMeYoQEH9SoMRUw
38 lines
1.1 KiB
Dart
38 lines
1.1 KiB
Dart
import '../../about/external/data/RoutineChain.dart';
|
|
import '../../about/external/data/pages/request/HistoryRequest.dart';
|
|
import '../../about/external/data/pages/request/PageAndSort.dart';
|
|
import '../../about/external/data/pages/request/Pageable.dart';
|
|
import '../../about/external/data/pages/request/Sort.dart';
|
|
import '../../utils/ObjectConvertors.dart';
|
|
import '../parent/ParentViewModel.dart';
|
|
import 'ConnectRoutines.dart';
|
|
|
|
class ViewRoutines extends ParentViewModel {
|
|
ConnectRoutines connection;
|
|
|
|
ViewRoutines(super.context, this.connection);
|
|
|
|
void loadRoutines() async {
|
|
if (!await hasNetwork(() => loadRoutines())) return;
|
|
|
|
showLoading("Loading your routines");
|
|
|
|
try {
|
|
final response = await getDataManager().getMyRoutines(HistoryRequest(
|
|
query: PageAndSort(
|
|
sort: Sort('asc', 'startMinute'),
|
|
page: Pageable(0, 0, 50, 0),
|
|
),
|
|
));
|
|
|
|
final List<RoutineChain> routines = getRoutineChainList(response.data);
|
|
|
|
closeLoading();
|
|
|
|
connection.onRoutinesLoaded(routines);
|
|
} catch (e) {
|
|
handleError(e, () => loadRoutines(), () => dismissError(), "Retry");
|
|
}
|
|
}
|
|
}
|