Skip to content

Commit

Permalink
chore: fixed inputs from team review. (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
rawi-coding committed Jan 14, 2025
1 parent f451132 commit 83a2436
Show file tree
Hide file tree
Showing 24 changed files with 212 additions and 137 deletions.
2 changes: 2 additions & 0 deletions das_client/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
*.swp
.DS_Store
.atom/
.build/
.buildlog/
.history
.svn/
.swiftpm/
migrate_working_dir/

# IntelliJ related
Expand Down
2 changes: 0 additions & 2 deletions das_client/integration_test/app_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import 'package:integration_test/integration_test.dart';
import 'di.dart';
import 'test/train_journey_table_test.dart' as train_journey_table_tests;
import 'test/navigation_test.dart' as navigation_tests;
import 'test/train_journey_test.dart' as train_journey_tests;
import 'test/train_search_test.dart' as train_search_tests;

AppLocalizations l10n = AppLocalizationsDe();
Expand All @@ -18,7 +17,6 @@ void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Fimber.plantTree(DebugTree());

train_journey_tests.main();
train_journey_table_tests.main();
navigation_tests.main();
train_search_tests.main();
Expand Down
62 changes: 0 additions & 62 deletions das_client/integration_test/test/train_journey_test.dart

This file was deleted.

11 changes: 8 additions & 3 deletions das_client/integration_test/test/train_search_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void main() {
final yesterday = today.add(Duration(days: -1));

final todayDateTextFinder = find.text(Format.date(today));
final yesterdayDateTextFinder = find.text('${Format.date(yesterday)} ${l10n.p_train_selection_date_not_today_warning}');
final yesterdayDateTextFinder = find.text(Format.date(yesterday));

// Verify that today is preselected
expect(todayDateTextFinder, findsOneWidget);
Expand All @@ -90,6 +90,8 @@ void main() {

expect(todayDateTextFinder, findsNothing);
expect(yesterdayDateTextFinder, findsOneWidget);
final warningMessage = find.text(l10n.p_train_selection_date_not_today_warning);
expect(warningMessage, findsOneWidget);

});

Expand All @@ -102,7 +104,7 @@ void main() {
final dayBeforeYesterday = today.add(Duration(days: -2));

final todayDateTextFinder = find.text(Format.date(today));
final yesterdayDateTextFinder = find.text('${Format.date(yesterday)} ${l10n.p_train_selection_date_not_today_warning}');
final yesterdayDateTextFinder = find.text(Format.date(yesterday));
final dayBeforeYesterdayDateTextFinder = find.text(Format.date(dayBeforeYesterday));

// Verify that today is preselected
Expand All @@ -123,6 +125,8 @@ void main() {

expect(todayDateTextFinder, findsNothing);
expect(yesterdayDateTextFinder, findsOneWidget);
final warningMessage = find.text(l10n.p_train_selection_date_not_today_warning);
expect(warningMessage, findsOneWidget);
expect(dayBeforeYesterdayDateTextFinder, findsNothing);
});

Expand All @@ -147,7 +151,8 @@ void main() {

await tapElement(tester, primaryButton);

expect(find.text('${ErrorCode.sferaJpUnavailable.code}: ${l10n.c_error_sfera_jp_unavailable}'), findsOneWidget);
expect(find.text('${l10n.c_error_code}: ${ErrorCode.sferaJpUnavailable.code}'), findsOneWidget);
expect(find.text(l10n.c_error_sfera_jp_unavailable), findsOneWidget);
});

});
Expand Down
4 changes: 2 additions & 2 deletions das_client/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
AppAuth: 501c04eda8a8d11f179dbe8637b7a91bb7e5d2fa
device_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d
device_info_plus: bf2e3232933866d73fe290f2942f2156cdd10342
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_appauth: aef998cfbcc307dff7f2fbe1f59a50323748dc25
flutter_secure_storage: d33dac7ae2ea08509be337e775f6b59f1ff45f12
integration_test: 252f60fa39af5e17c3aa9899d35d908a0721b573
isar_flutter_libs: b69f437aeab9c521821c3f376198c4371fa21073
package_info_plus: 58f0028419748fad15bf008b270aaa8e54380b1c
package_info_plus: c0502532a26c7662a62a356cebe2692ec5fe4ec4
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46

PODFILE CHECKSUM: d9dad56c0cd0b4fd8b4fe3034a53fd42a0b990f6
Expand Down
5 changes: 4 additions & 1 deletion das_client/l10n/strings_de.arb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"p_train_selection_ru_description": "EVU",
"p_train_selection_date_description": "Datum",
"p_train_selection_choose_date": "Datum wählen",
"p_train_selection_date_not_today_warning": "(⚠\uFE0Fentspricht nicht dem aktuellen Datum)",
"p_train_selection_date_not_today_warning": "Das gewählte Datum entspricht nicht dem aktuellen Datum.",
"p_train_journey_header_button_dark_theme": "Nachtmodus",
"p_train_journey_header_button_pause": "Pause",
"p_train_journey_table_kilometre_label": "km",
Expand Down Expand Up @@ -32,12 +32,15 @@
"c_ru_bls_c": "BLS Cargo",
"c_ru_sob": "SOB",
"c_unknown": "Unbekannt",
"c_train_number": "Zugnummer",
"c_main_signal_function_entry": "Einfahrsignal",
"c_main_signal_function_exit": "Ausfahrsignal",
"c_main_signal_function_intermediate": "Abschnittsignal",
"c_main_signal_function_block": "Block",
"c_main_signal_function_protection": "Deckungssignal",
"c_main_signal_function_laneChange": "Spurwechsel",
"c_error_code": "Fehlercode",
"c_something_went_wrong": "Da ist was schiefgegangen.",
"c_error_connection_failed": "Verbindung fehlgeschlagen",
"c_error_sfera_validation_failed": "Validierung der Daten fehlgeschlagen",
"c_error_sfera_handshake_rejected": "Server hat die Verbindung abgelehnt",
Expand Down
3 changes: 2 additions & 1 deletion das_client/lib/app/nav/das_navigation_drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:auto_route/auto_route.dart';
import 'package:das_client/app/i18n/i18n.dart';
import 'package:das_client/app/nav/app_router.dart';
import 'package:das_client/app/widgets/app_version_text.dart';
import 'package:das_client/app/widgets/das_text_styles.dart';
import 'package:das_client/app/widgets/device_id_text.dart';
import 'package:sbb_design_system_mobile/sbb_design_system_mobile.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -55,7 +56,7 @@ class DASNavigationDrawer extends StatelessWidget {

return ListTile(
leading: isActiveRoute ? _activeIcon(icon) : _inactiveIcon(icon),
title: Text(title, style: isActiveRoute ? SBBTextStyles.mediumBold : SBBTextStyles.mediumLight),
title: Text(title, style: isActiveRoute ? DASTextStyles.mediumBold : DASTextStyles.mediumLight),
onTap: () {
Navigator.pop(context);
context.router.replace(route);
Expand Down
61 changes: 44 additions & 17 deletions das_client/lib/app/pages/journey/journey_page.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import 'package:auto_route/auto_route.dart';
import 'package:das_client/app/bloc/train_journey_cubit.dart';
import 'package:das_client/app/i18n/i18n.dart';
import 'package:das_client/app/model/ru.dart';
import 'package:das_client/app/nav/app_router.dart';
import 'package:das_client/app/nav/das_navigation_drawer.dart';
import 'package:das_client/app/pages/journey/train_journey/train_journey_overview.dart';
import 'package:das_client/app/pages/journey/train_selection/train_selection.dart';
import 'package:das_client/auth/authentication_component.dart';
import 'package:das_client/di.dart';
import 'package:sbb_design_system_mobile/sbb_design_system_mobile.dart';
import 'package:das_client/util/format.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:sbb_design_system_mobile/sbb_design_system_mobile.dart';

@RoutePage()
class JourneyPage extends StatelessWidget {
Expand All @@ -36,22 +38,20 @@ class JourneyPageContent extends StatelessWidget {
);
}

SBBHeader _appBar(BuildContext context) {
return SBBHeader(
title: context.l10n.c_app_name,
actions: [
IconButton(
icon: const Icon(SBBIcons.exit_small),
onPressed: () {
if (context.trainJourneyCubit.state is SelectingTrainJourneyState) {
context.authCubit.logout();
context.router.replace(const LoginRoute());
} else {
context.trainJourneyCubit.reset();
}
},
)
],
PreferredSizeWidget _appBar(BuildContext context) {
return PreferredSize(
preferredSize: const Size.fromHeight(kToolbarHeight),
child: BlocBuilder<TrainJourneyCubit, TrainJourneyState>(
builder: (context, state) {
return SBBHeader(
title: _headerTitle(context, state),
actions: [
if (state is SelectingTrainJourneyState) _logoutButton(context),
if (state is! SelectingTrainJourneyState) _trainSelectionButton(context)
],
);
},
),
);
}

Expand All @@ -76,4 +76,31 @@ class JourneyPageContent extends StatelessWidget {
},
);
}

IconButton _logoutButton(BuildContext context) {
return IconButton(
icon: const Icon(SBBIcons.exit_small),
onPressed: () {
context.authCubit.logout();
context.router.replace(const LoginRoute());
},
);
}

IconButton _trainSelectionButton(BuildContext context) {
return IconButton(
icon: const Icon(SBBIcons.train_small),
onPressed: () => context.trainJourneyCubit.reset(),
);
}

String _headerTitle(BuildContext context, TrainJourneyState state) {
if (state is TrainJourneyLoadedState) {
final trainNumber = '${context.l10n.c_train_number} ${state.trainNumber}';
final ru = state.ru.displayText(context);
final date = Format.dateWithAbbreviatedDay(state.date);
return '$trainNumber - $ru - $date';
}
return context.l10n.c_app_name;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:auto_route/auto_route.dart';
import 'package:das_client/app/i18n/i18n.dart';
import 'package:das_client/app/pages/journey/train_journey/widgets/break_series_selection_button.dart';
import 'package:das_client/app/widgets/das_text_styles.dart';
import 'package:das_client/model/journey/break_series.dart';
import 'package:das_client/model/journey/train_series.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -86,7 +87,7 @@ class _BreakSeriesSelectionState extends State<BreakSeriesSelection> {
padding: const EdgeInsets.fromLTRB(0, sbbDefaultSpacing, 0, sbbDefaultSpacing),
child: Text(
trainSeries.name,
style: SBBTextStyles.mediumBold,
style: DASTextStyles.mediumBold,
),
),
Padding(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:das_client/app/widgets/assets.dart';
import 'package:das_client/app/widgets/das_text_styles.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:sbb_design_system_mobile/sbb_design_system_mobile.dart';
Expand Down Expand Up @@ -28,7 +29,7 @@ class BreakSeriesSelectionButton extends StatelessWidget {
child: Center(
child: Text(
label,
style: SBBTextStyles.mediumBold.copyWith(color: currentlySelected ? SBBColors.white : SBBColors.black),
style: DASTextStyles.mediumBold.copyWith(color: currentlySelected ? SBBColors.white : SBBColors.black),
),
),
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:das_client/app/i18n/i18n.dart';
import 'package:das_client/app/widgets/das_text_styles.dart';
import 'package:sbb_design_system_mobile/sbb_design_system_mobile.dart';
import 'package:flutter/material.dart';

Expand All @@ -25,7 +26,7 @@ class ADLNotification extends StatelessWidget {
const SizedBox(width: sbbDefaultSpacing * 0.5),
Text(
'${context.l10n.w_adl_notification_title}: $message',
style: SBBTextStyles.mediumBold.copyWith(color: fontColor),
style: DASTextStyles.mediumBold.copyWith(color: fontColor),
),
],
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:das_client/app/widgets/das_text_styles.dart';
import 'package:sbb_design_system_mobile/sbb_design_system_mobile.dart';
import 'package:flutter/material.dart';

Expand All @@ -10,7 +11,7 @@ class DepartureAuthorization extends StatelessWidget {
children: [
const Icon(SBBIcons.circle_tick_small),
const SizedBox(width: sbbDefaultSpacing * 0.5),
Text('SMS', style: SBBTextStyles.largeLight.copyWith(fontSize: 24.0)),
Text('SMS', style: DASTextStyles.largeRoman),
],
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:das_client/app/i18n/i18n.dart';
import 'package:das_client/app/pages/journey/train_journey/widgets/header/departure_authorization.dart';
import 'package:das_client/app/pages/journey/train_journey/widgets/header/radio_channel.dart';
import 'package:das_client/app/widgets/assets.dart';
import 'package:das_client/app/widgets/das_text_styles.dart';
import 'package:das_client/app/widgets/widget_extensions.dart';
import 'package:sbb_design_system_mobile/sbb_design_system_mobile.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -77,8 +78,10 @@ class MainContainer extends StatelessWidget {
Expanded(
child: Padding(
padding: const EdgeInsets.only(left: sbbDefaultSpacing * 0.5),
child: Text(journey.metadata.nextStop?.name.localized ?? context.l10n.c_unknown,
style: SBBTextStyles.largeLight.copyWith(fontSize: 24.0)),
child: Text(
journey.metadata.nextStop?.name.localized ?? context.l10n.c_unknown,
style: DASTextStyles.xLargeLight,
),
),
),
_buttonArea(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:das_client/app/widgets/das_text_styles.dart';
import 'package:sbb_design_system_mobile/sbb_design_system_mobile.dart';
import 'package:flutter/material.dart';

Expand All @@ -12,7 +13,7 @@ class RadioChannel extends StatelessWidget {
children: [
const Icon(SBBIcons.telephone_gsm_small),
const SizedBox(width: sbbDefaultSpacing * 0.5),
Text('1311', style: SBBTextStyles.largeLight.copyWith(fontSize: 24.0)),
Text('1311', style: DASTextStyles.largeRoman),
],
),
);
Expand Down
Loading

0 comments on commit 83a2436

Please sign in to comment.