-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorganised the solution to reduce unnecessary fragmentation
- Loading branch information
Showing
47 changed files
with
149 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:get_it/get_it.dart'; | ||
import 'package:logger/logger.dart'; | ||
import 'package:fitness_machine/hardware/services/fitness_machine_command_dispatcher.dart'; | ||
import 'package:fitness_machine/hardware/services/fitness_machine_provider.dart'; | ||
import 'package:fitness_machine/hardware/services/fitness_machine_query_dispatcher.dart'; | ||
import 'package:fitness_machine/hardware/widgets/pages/device_selection_screen.dart'; | ||
import 'package:fitness_machine/layouts/main_layout.dart'; | ||
import 'package:fitness_machine/layouts/page_definition.dart'; | ||
import 'package:fitness_machine/layouts/page_definition_provider.dart'; | ||
import 'package:fitness_machine/main.dart'; | ||
import 'package:fitness_machine/treadmill_control/widgets/pages/control_page.dart'; | ||
import 'package:fitness_machine/workout_management/widgets/pages/workout_history_page.dart'; | ||
|
||
class Bootstrap { | ||
static MyApp bootstrap() { | ||
_setupLogging(); | ||
_registerPages(); | ||
_registerLayouts(); | ||
_registerHardware(); | ||
_registerApp(); | ||
|
||
return GetIt.I<MyApp>(); | ||
} | ||
|
||
static void _setupLogging() { | ||
GetIt.I.registerSingleton(Logger()); | ||
} | ||
|
||
static void _registerLayouts() { | ||
GetIt.I.registerLazySingleton(() => MainLayout(GetIt.I<PageDefinitionProvider>())); | ||
} | ||
|
||
static void _registerPages() { | ||
GetIt.I.registerSingleton<ControlPage>(const ControlPage()); | ||
GetIt.I.registerSingleton<WorkoutHistoryPage>(const WorkoutHistoryPage()); | ||
|
||
GetIt.I.registerLazySingleton(() => PageDefinitionProvider({ | ||
PageDefinition(GetIt.I<ControlPage>(), "Control", const Icon(Icons.bluetooth), const Icon(Icons.bluetooth_outlined)), | ||
PageDefinition(GetIt.I<WorkoutHistoryPage>(), "Workout History", const Icon(Icons.history), const Icon(Icons.history_outlined)) | ||
})); | ||
} | ||
|
||
static void _registerApp() { | ||
GetIt.I.registerLazySingleton<MyApp>(() { | ||
return MyApp(GetIt.I<MainLayout>()); | ||
}); | ||
} | ||
|
||
static void _registerHardware() { | ||
// Use SafeDevice if we need to inject fakes for simulator | ||
WidgetsFlutterBinding.ensureInitialized(); | ||
|
||
GetIt.I.registerSingleton<FitnessMachineProvider>(FitnessMachineProvider()); | ||
GetIt.I.registerSingleton<FitnessMachineCommandDispatcher>((FitnessMachineCommandDispatcher())); | ||
GetIt.I.registerSingleton<FitnessMachineQueryDispatcher>((FitnessMachineQueryDispatcher())); | ||
GetIt.I.registerSingleton<DeviceSelectionScreen>(const DeviceSelectionScreen()); | ||
} | ||
} |
52 changes: 0 additions & 52 deletions
52
src/lib/common/dependency_injection/dependency_injection.dart
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions
10
...hardware/bt/constants/known_commands.dart → ...ardware/ble/constants/known_commands.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions
8
...es/hardware/services/fitness_machine.dart → ...ib/hardware/services/fitness_machine.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 4 additions & 3 deletions
7
...s/fitness_machine_command_dispatcher.dart → ...s/fitness_machine_command_dispatcher.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 5 additions & 4 deletions
9
...ces/fitness_machine_query_dispatcher.dart → ...ces/fitness_machine_query_dispatcher.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ers/ensure_bluetooth_enabled_wrapper.dart → ...ers/ensure_bluetooth_enabled_wrapper.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ontrols/bluetooth_scanning_indicator.dart → ...ontrols/bluetooth_scanning_indicator.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...idgets/controls/fitness_machine_list.dart → ...idgets/controls/fitness_machine_list.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
...idgets/pages/device_selection_screen.dart → ...idgets/pages/device_selection_screen.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/lib/common/layouts/main_layout.dart → src/lib/layouts/main_layout.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...mon/layouts/page_definition_provider.dart → ...lib/layouts/page_definition_provider.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 0 additions & 9 deletions
9
src/lib/modules/demo_ctrl/dependency_injection/demo_ctrl_di.dart
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
src/lib/modules/hardware/dependency_injection/hardware_di.dart
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
src/lib/modules/overview/dependency_injection/overview_di.dart
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
...trl/widgets/controls/speed_indicator.dart → ...rol/widgets/controls/speed_indicator.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
.../widgets/controls/treadmill_controls.dart → .../widgets/controls/treadmill_controls.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
6 changes: 3 additions & 3 deletions
6
...idgets/controls/workout_status_panel.dart → ...idgets/controls/workout_status_panel.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...cubits/speed_range_and_setting_cubit.dart → ...cubits/speed_range_and_setting_cubit.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.