From fc1d2d0987758e079636136cfe0b9b41cd1ecff6 Mon Sep 17 00:00:00 2001 From: Flajt Date: Mon, 18 Dec 2023 13:42:28 +0100 Subject: [PATCH 1/2] Fix: Add missing locations --- assets/translations/de.json | 2 +- lib/features/metadata/uiblocks/EnableLocationWarning.dart | 3 ++- lib/features/verification/uiblocks/CheckMarkTable.dart | 4 ++-- test/metadata/uiblocks/EnableLocationWarning_test.dart | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/assets/translations/de.json b/assets/translations/de.json index f710258..85dca4d 100644 --- a/assets/translations/de.json +++ b/assets/translations/de.json @@ -4,7 +4,7 @@ "imageVideo": "Bild/Video", "audio": "Audio", "verify": "Verifizieren", - "locationWarning": "Du hast Standort speicher aktiviert, aber den GPS Service deaktiviert!" + "locationWarning": "Du hast Standort einbetten aktiviert, aber den GPS Service deaktiviert!" } }, "introPage": { diff --git a/lib/features/metadata/uiblocks/EnableLocationWarning.dart b/lib/features/metadata/uiblocks/EnableLocationWarning.dart index af51a9f..ed2fd8a 100644 --- a/lib/features/metadata/uiblocks/EnableLocationWarning.dart +++ b/lib/features/metadata/uiblocks/EnableLocationWarning.dart @@ -27,7 +27,8 @@ class EnableLocationWarning extends StatelessWidget { border: Border.all(color: Colors.black), color: Colors.redAccent), child: Center( child: Text( - "homePage.locationWarning", + "homePage.options.locationWarning", + textAlign: TextAlign.center, style: Theme.of(context).textTheme.titleMedium, ).tr()), ); diff --git a/lib/features/verification/uiblocks/CheckMarkTable.dart b/lib/features/verification/uiblocks/CheckMarkTable.dart index 3c9efe1..9efabc1 100644 --- a/lib/features/verification/uiblocks/CheckMarkTable.dart +++ b/lib/features/verification/uiblocks/CheckMarkTable.dart @@ -22,10 +22,10 @@ class CheckMarkTable extends StatelessWidget { title: "verificationPage.hashMatching".tr(), value: statusModel.matchingHashes), CheckMarkTile( - title: "verificationpage.signatureVerified".tr(), + title: "verificationPage.signatureVerified".tr(), value: statusModel.verifiedSignature), CheckMarkTile( - title: "verificationPagelocationStored".tr(), + title: "verificationPage.locationStored".tr(), value: statusModel.metaDataModel?.location != null) ]), ); diff --git a/test/metadata/uiblocks/EnableLocationWarning_test.dart b/test/metadata/uiblocks/EnableLocationWarning_test.dart index 57db6f6..07a730f 100644 --- a/test/metadata/uiblocks/EnableLocationWarning_test.dart +++ b/test/metadata/uiblocks/EnableLocationWarning_test.dart @@ -33,7 +33,7 @@ void main() { home: Scaffold( body: EnableLocationWarning(width: 400, height: 200))))); await widgetTester.pumpAndSettle(); - expect(find.text("homePage.locationWarning"), findsOneWidget); + expect(find.text("homePage.options.locationWarning"), findsOneWidget); }); testWidgets("show container if location is enabled", (widgetTester) async { @@ -51,7 +51,7 @@ void main() { body: EnableLocationWarning(width: 200, height: 200))))); await widgetTester.pumpAndSettle(); - expect(find.text("homePage.locationWarning"), findsNothing); + expect(find.text("homePage.options.locationWarning"), findsNothing); }); }); } From d7a62beb31d93af22c23fe4189965f6e8c497b50 Mon Sep 17 00:00:00 2001 From: Flajt Date: Mon, 18 Dec 2023 14:10:40 +0100 Subject: [PATCH 2/2] Fix: Unexpected display issue w. LocationEmedding checkmark + update tests --- .../metadata/uiblocks/LocationEmbeddingTile.dart | 4 +++- lib/features/settings/bloc/SettingsBloc.dart | 9 ++++++--- lib/features/settings/bloc/SettingsBlocStates.dart | 4 +++- test/settings/bloc/SettingsBloc_test.dart | 6 +++--- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/lib/features/metadata/uiblocks/LocationEmbeddingTile.dart b/lib/features/metadata/uiblocks/LocationEmbeddingTile.dart index 2311a53..3599d08 100644 --- a/lib/features/metadata/uiblocks/LocationEmbeddingTile.dart +++ b/lib/features/metadata/uiblocks/LocationEmbeddingTile.dart @@ -20,7 +20,9 @@ class LocationEmbeddingTile extends StatelessWidget { title: const Text("settingsPage.embedLocation").tr(), subtitle: const Text("settingsPage.embedLocationSubtitle").tr(), trailing: Checkbox.adaptive( - value: service.shouldEmbedLocation(), + value: state is LocationEmbeddingPermissionModified + ? state.permission + : service.shouldEmbedLocation(), onChanged: (v) => context .read() .add(ModifyLocationEmbeddingPermission(v ?? false))), diff --git a/lib/features/settings/bloc/SettingsBloc.dart b/lib/features/settings/bloc/SettingsBloc.dart index cc6ddbb..7e797bd 100644 --- a/lib/features/settings/bloc/SettingsBloc.dart +++ b/lib/features/settings/bloc/SettingsBloc.dart @@ -58,19 +58,22 @@ class SettingsBloc extends Bloc { if (gotPermission) { await metaDataPermissionService .allowLocationEmbedding(event.permission); - emit(LocationEmbeddingPermissionModified()); + emit(LocationEmbeddingPermissionModified( + permission: event.permission)); } else { emit(ErrorState("Location Permission Denied!")); } } else { await metaDataPermissionService .allowLocationEmbedding(event.permission); - emit(LocationEmbeddingPermissionModified()); + emit(LocationEmbeddingPermissionModified( + permission: event.permission)); } } else { await metaDataPermissionService .allowLocationEmbedding(event.permission); - emit(LocationEmbeddingPermissionModified()); + emit(LocationEmbeddingPermissionModified( + permission: event.permission)); } } catch (e, stackTrace) { addError(e, stackTrace); diff --git a/lib/features/settings/bloc/SettingsBlocStates.dart b/lib/features/settings/bloc/SettingsBlocStates.dart index 8069395..6969586 100644 --- a/lib/features/settings/bloc/SettingsBlocStates.dart +++ b/lib/features/settings/bloc/SettingsBlocStates.dart @@ -33,8 +33,10 @@ class SecretSavedState extends SettingsBlocStates { } class LocationEmbeddingPermissionModified extends SettingsBlocStates { + final bool permission; + LocationEmbeddingPermissionModified({required this.permission}); @override - List get props => []; + List get props => [permission]; } class SecretEmbeddingPermissionModified extends SettingsBlocStates { diff --git a/test/settings/bloc/SettingsBloc_test.dart b/test/settings/bloc/SettingsBloc_test.dart index 0d4f9e9..6ee89e9 100644 --- a/test/settings/bloc/SettingsBloc_test.dart +++ b/test/settings/bloc/SettingsBloc_test.dart @@ -74,7 +74,7 @@ void main() { .thenAnswer((realInvocation) => Future.value(true)); }, act: (bloc) => bloc.add(ModifyLocationEmbeddingPermission(true)), - expect: () => [LocationEmbeddingPermissionModified()], + expect: () => [LocationEmbeddingPermissionModified(permission: true)], build: () => SettingsBloc()); blocTest("fail, location permission denied", setUp: () { @@ -122,7 +122,7 @@ void main() { .thenAnswer((realInvocation) => Future.value(false)); }, act: (bloc) => bloc.add(ModifyLocationEmbeddingPermission(true)), - expect: () => [LocationEmbeddingPermissionModified()], + expect: () => [LocationEmbeddingPermissionModified(permission: true)], build: () => SettingsBloc()); blocTest("disable successfully", setUp: () { @@ -135,7 +135,7 @@ void main() { .thenAnswer((realInvocation) => Future.value()); }, act: (bloc) => bloc.add(ModifyLocationEmbeddingPermission(false)), - expect: () => [LocationEmbeddingPermissionModified()], + expect: () => [LocationEmbeddingPermissionModified(permission: false)], build: () => SettingsBloc()); }); }