- Streak computed from all complete Sessions: Grace Hour (00:00-01:00 counts for yesterday unless it is done), a Freeze per 7 Streak Days (max 2) spent automatically on a missed day (ADR 0006) - Top bar flame (grey until today is done) opening a panel with current and longest Streak, Freezes and a month calendar; 'Day N of your streak' on a fresh summary - History per Mode grouped by day, reopening each summary - Two adjustable Reminders (19:00, 22:30) scheduled 14 days ahead with flutter_local_notifications, none on a done day; permission asked after the first complete Session or from Settings - Settings: Reminders, the Player chime, exercise credits Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
45 lines
1.6 KiB
Dart
45 lines
1.6 KiB
Dart
import 'package:drift_flutter/drift_flutter.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'src/app.dart';
|
|
import 'src/database/database.dart';
|
|
import 'src/exercises/exercise_library.dart';
|
|
import 'src/history/session_repository.dart';
|
|
import 'src/plans/plan_repository.dart';
|
|
import 'src/player/player_effects.dart';
|
|
import 'src/settings/settings_controller.dart';
|
|
import 'src/streak/reminder_scheduler.dart';
|
|
|
|
void main() async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]);
|
|
|
|
final db = AppDatabase(driftDatabase(name: 'zenxercise'));
|
|
final library = await ExerciseLibrary.load(rootBundle);
|
|
final settings = SettingsController(SettingsService());
|
|
await settings.loadSettings();
|
|
final sessions = SessionRepository(db);
|
|
final notifier = LocalNotifier();
|
|
await notifier.init();
|
|
final reminders = ReminderScheduler(notifier, settings, sessions);
|
|
// Today may have been finished, or a day may have passed, since the last run.
|
|
reminders.sync();
|
|
|
|
runApp(
|
|
MultiProvider(
|
|
providers: [
|
|
ChangeNotifierProvider.value(value: settings),
|
|
Provider.value(value: library),
|
|
Provider.value(value: PlanRepository(db)),
|
|
Provider.value(value: sessions),
|
|
Provider<Notifier>.value(value: notifier),
|
|
Provider.value(value: reminders),
|
|
Provider<PlayerEffects>(create: (_) => DevicePlayerEffects()),
|
|
],
|
|
child: const ZenXerciseApp(),
|
|
),
|
|
);
|
|
}
|