Skip to content

Commit

Permalink
Merge pull request #107 from Flajt/fix-missing-translations
Browse files Browse the repository at this point in the history
Fix missing translations
  • Loading branch information
Flajt authored Dec 19, 2023
2 parents 70d75a4 + d7a62be commit 3195d3d
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 14 deletions.
2 changes: 1 addition & 1 deletion assets/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 2 additions & 1 deletion lib/features/metadata/uiblocks/EnableLocationWarning.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
);
Expand Down
4 changes: 3 additions & 1 deletion lib/features/metadata/uiblocks/LocationEmbeddingTile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<SettingsBloc>()
.add(ModifyLocationEmbeddingPermission(v ?? false))),
Expand Down
9 changes: 6 additions & 3 deletions lib/features/settings/bloc/SettingsBloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,22 @@ class SettingsBloc extends Bloc<SettingsBlocEvents, SettingsBlocStates> {
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);
Expand Down
4 changes: 3 additions & 1 deletion lib/features/settings/bloc/SettingsBlocStates.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ class SecretSavedState extends SettingsBlocStates {
}

class LocationEmbeddingPermissionModified extends SettingsBlocStates {
final bool permission;
LocationEmbeddingPermissionModified({required this.permission});
@override
List<Object?> get props => [];
List<Object?> get props => [permission];
}

class SecretEmbeddingPermissionModified extends SettingsBlocStates {
Expand Down
4 changes: 2 additions & 2 deletions lib/features/verification/uiblocks/CheckMarkTable.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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)
]),
);
Expand Down
4 changes: 2 additions & 2 deletions test/metadata/uiblocks/EnableLocationWarning_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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);
});
});
}
6 changes: 3 additions & 3 deletions test/settings/bloc/SettingsBloc_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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: () {
Expand Down Expand Up @@ -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: () {
Expand All @@ -135,7 +135,7 @@ void main() {
.thenAnswer((realInvocation) => Future.value());
},
act: (bloc) => bloc.add(ModifyLocationEmbeddingPermission(false)),
expect: () => [LocationEmbeddingPermissionModified()],
expect: () => [LocationEmbeddingPermissionModified(permission: false)],
build: () => SettingsBloc());
});
}

0 comments on commit 3195d3d

Please sign in to comment.