diff --git a/iap/lib/src/data/films_storage_service.dart b/iap/lib/src/data/films_storage_service.dart index f49a5d9..985d0e8 100644 --- a/iap/lib/src/data/films_storage_service.dart +++ b/iap/lib/src/data/films_storage_service.dart @@ -22,11 +22,11 @@ class FilmsStorageService { Future deleteFilm(FilmExponential _) async {} - Future>> getPredefinedFilms() async { + Future> getPredefinedFilms() async { return const {}; } - Future>> getCustomFilms() async { + Future> getCustomFilms() async { return const {}; } } diff --git a/integration_test/e2e_test.dart b/integration_test/e2e_test.dart index 8b36491..cb76bc9 100644 --- a/integration_test/e2e_test.dart +++ b/integration_test/e2e_test.dart @@ -50,7 +50,7 @@ void testE2E(String description) { (tester) async { await tester.pumpApplication( equipmentProfiles: {}, - predefinedFilms: mockFilms.toSelectableMap(), + predefinedFilms: mockFilms.toTogglableMap(), customFilms: {}, ); diff --git a/integration_test/mocks/paid_features_mock.dart b/integration_test/mocks/paid_features_mock.dart index a2d99dc..b139ef1 100644 --- a/integration_test/mocks/paid_features_mock.dart +++ b/integration_test/mocks/paid_features_mock.dart @@ -10,24 +10,24 @@ class _MockEquipmentProfilesStorageService extends Mock implements EquipmentProf class _MockFilmsStorageService extends Mock implements FilmsStorageService {} class MockIAPProviders extends StatefulWidget { - final SelectableMap equipmentProfiles; + final TogglableMap equipmentProfiles; final String selectedEquipmentProfileId; - final Map> predefinedFilms; - final Map> customFilms; + final TogglableMap predefinedFilms; + final TogglableMap customFilms; final String selectedFilmId; final Widget child; MockIAPProviders({ - SelectableMap? equipmentProfiles, + TogglableMap? equipmentProfiles, this.selectedEquipmentProfileId = '', - Map>? predefinedFilms, - Map>? customFilms, + TogglableMap? predefinedFilms, + TogglableMap? customFilms, String? selectedFilmId, required this.child, super.key, - }) : equipmentProfiles = equipmentProfiles ?? mockEquipmentProfiles.toSelectableMap(), - predefinedFilms = predefinedFilms ?? mockFilms.toSelectableMap(), - customFilms = customFilms ?? mockFilms.toSelectableMap(), + }) : equipmentProfiles = equipmentProfiles ?? mockEquipmentProfiles.toTogglableMap(), + predefinedFilms = predefinedFilms ?? mockFilms.toTogglableMap(), + customFilms = customFilms ?? mockFilms.toTogglableMap(), selectedFilmId = selectedFilmId ?? const FilmStub().id; @override diff --git a/integration_test/utils/widget_tester_actions.dart b/integration_test/utils/widget_tester_actions.dart index 2d8b8f6..72c0e55 100644 --- a/integration_test/utils/widget_tester_actions.dart +++ b/integration_test/utils/widget_tester_actions.dart @@ -20,10 +20,10 @@ const mockPhotoEv100 = 8.3; extension WidgetTesterCommonActions on WidgetTester { Future pumpApplication({ IAPProductStatus productStatus = IAPProductStatus.purchased, - SelectableMap? equipmentProfiles, + TogglableMap? equipmentProfiles, String selectedEquipmentProfileId = '', - Map>? predefinedFilms, - Map>? customFilms, + TogglableMap? predefinedFilms, + TogglableMap? customFilms, String selectedFilmId = '', }) async { await pumpWidget( diff --git a/lib/providers/equipment_profile_provider.dart b/lib/providers/equipment_profile_provider.dart index ceef97e..5ebcd8c 100644 --- a/lib/providers/equipment_profile_provider.dart +++ b/lib/providers/equipment_profile_provider.dart @@ -34,7 +34,7 @@ class EquipmentProfilesProvider extends StatefulWidget { } class EquipmentProfilesProviderState extends State { - final SelectableMap _customProfiles = {}; + final TogglableMap _customProfiles = {}; String _selectedId = ''; EquipmentProfile get _selectedProfile => @@ -135,7 +135,7 @@ enum _EquipmentProfilesModelAspect { } class EquipmentProfiles extends InheritedModel<_EquipmentProfilesModelAspect> { - final SelectableMap profiles; + final TogglableMap profiles; final EquipmentProfile selected; const EquipmentProfiles({ diff --git a/lib/providers/films_provider.dart b/lib/providers/films_provider.dart index 4e0cce7..6f804ed 100644 --- a/lib/providers/films_provider.dart +++ b/lib/providers/films_provider.dart @@ -25,8 +25,8 @@ class FilmsProvider extends StatefulWidget { } class FilmsProviderState extends State { - final Map> predefinedFilms = {}; - final Map> customFilms = {}; + final TogglableMap predefinedFilms = {}; + final TogglableMap customFilms = {}; String _selectedId = ''; Film get _selectedFilm => customFilms[_selectedId]?.value ?? predefinedFilms[_selectedId]?.value ?? const FilmStub(); @@ -121,10 +121,10 @@ enum _FilmsModelAspect { } class Films extends InheritedModel<_FilmsModelAspect> { - final Map> predefinedFilms; + final TogglableMap predefinedFilms; @protected - final Map> customFilms; + final TogglableMap customFilms; final Film selected; const Films({ diff --git a/screenshots/generate_screenshots.dart b/screenshots/generate_screenshots.dart index 7683649..71ce474 100644 --- a/screenshots/generate_screenshots.dart +++ b/screenshots/generate_screenshots.dart @@ -93,7 +93,7 @@ void main() { testWidgets('Generate light theme screenshots', (tester) async { await mockSharedPrefs(theme: ThemeType.light, color: _lightThemeColor); await tester.pumpApplication( - predefinedFilms: [_mockFilm].toSelectableMap(), + predefinedFilms: [_mockFilm].toTogglableMap(), customFilms: {}, selectedFilmId: _mockFilm.id, ); @@ -133,7 +133,7 @@ void main() { (tester) async { await mockSharedPrefs(theme: ThemeType.dark, color: _darkThemeColor); await tester.pumpApplication( - predefinedFilms: [_mockFilm].toSelectableMap(), + predefinedFilms: [_mockFilm].toTogglableMap(), customFilms: {}, selectedFilmId: _mockFilm.id, ); @@ -158,7 +158,7 @@ void main() { color: _lightThemeColor, ); await tester.pumpApplication( - predefinedFilms: [_mockFilm].toSelectableMap(), + predefinedFilms: [_mockFilm].toTogglableMap(), customFilms: {}, selectedFilmId: _mockFilm.id, ); diff --git a/test/providers/equipment_profile_provider_test.dart b/test/providers/equipment_profile_provider_test.dart index 908833f..1b57171 100644 --- a/test/providers/equipment_profile_provider_test.dart +++ b/test/providers/equipment_profile_provider_test.dart @@ -26,7 +26,7 @@ void main() { ), ).thenAnswer((_) async {}); when(() => storageService.deleteProfile(any())).thenAnswer((_) async {}); - when(() => storageService.getProfiles()).thenAnswer((_) => Future.value(_customProfiles.toSelectableMap())); + when(() => storageService.getProfiles()).thenAnswer((_) => Future.value(_customProfiles.toTogglableMap())); }); tearDown(() { @@ -69,7 +69,7 @@ void main() { () { setUp(() { when(() => storageService.selectedEquipmentProfileId).thenReturn(_customProfiles.first.id); - when(() => storageService.getProfiles()).thenAnswer((_) => Future.value(_customProfiles.toSelectableMap())); + when(() => storageService.getProfiles()).thenAnswer((_) => Future.value(_customProfiles.toTogglableMap())); }); testWidgets( diff --git a/test/screens/metering/components/shared/readings_container/equipment_profile_picker_test.dart b/test/screens/metering/components/shared/readings_container/equipment_profile_picker_test.dart index 6576273..bf97fea 100644 --- a/test/screens/metering/components/shared/readings_container/equipment_profile_picker_test.dart +++ b/test/screens/metering/components/shared/readings_container/equipment_profile_picker_test.dart @@ -17,7 +17,7 @@ void main() { setUpAll(() { storageService = _MockEquipmentProfilesStorageService(); - when(() => storageService.getProfiles()).thenAnswer((_) async => _mockEquipmentProfiles.toSelectableMap()); + when(() => storageService.getProfiles()).thenAnswer((_) async => _mockEquipmentProfiles.toTogglableMap()); when(() => storageService.selectedEquipmentProfileId).thenReturn(''); }); @@ -84,7 +84,7 @@ void main() { 'Equipment profile picker shows only profiles in use', (tester) async { when(() => storageService.getProfiles()) - .thenAnswer((_) async => _mockEquipmentProfiles.skip(1).toList().toSelectableMap()); + .thenAnswer((_) async => _mockEquipmentProfiles.skip(1).toList().toTogglableMap()); await pumpApplication(tester); await tester.openAnimatedPicker(); expectRadioListTile(S.current.none, isSelected: true); diff --git a/test/screens/metering/utils/listener_equipment_profiles_test.dart b/test/screens/metering/utils/listener_equipment_profiles_test.dart index ea07a4f..488eb0d 100644 --- a/test/screens/metering/utils/listener_equipment_profiles_test.dart +++ b/test/screens/metering/utils/listener_equipment_profiles_test.dart @@ -25,7 +25,7 @@ void main() { ), ).thenAnswer((_) async {}); when(() => storageService.deleteProfile(any())).thenAnswer((_) async {}); - when(() => storageService.getProfiles()).thenAnswer((_) => Future.value(_customProfiles.toSelectableMap())); + when(() => storageService.getProfiles()).thenAnswer((_) => Future.value(_customProfiles.toTogglableMap())); }); tearDown(() {