6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit 6f1a6013
Changed files
comwell_key_app/assets/translations/da-DK.json | 11 +++++++- comwell_key_app/assets/translations/en-US.json | 11 +++++++- .../payment_cards/components/edit_card_dialog.dart | 12 ++++----- comwell_key_app/lib/routing/app_router.dart | 29 +++++++++++++++------- .../interceptors/response_handle_interceptor.dart | 1 - .../lib/share/cubit/share_booking_cubit.dart | 10 ++++---- comwell_key_app/lib/utils/secure_storage.dart | 7 +----- 7 files changed, 52 insertions(+), 29 deletions(-)
Diff
diff --git a/comwell_key_app/assets/translations/da-DK.json b/comwell_key_app/assets/translations/da-DK.json
index f091e497..aff410eb 100644
--- a/comwell_key_app/assets/translations/da-DK.json
+++ b/comwell_key_app/assets/translations/da-DK.json
@@ -184,6 +184,15 @@
"share_booking_page_title": "Del ophold",
"share_booking_page_subtitle": "Her kan du dele dit ophold med en anden gæst og give dem adgang til bookinginformation, nøglekort og Concierge",
"share_booking_page_share_button": "Del dit ophold",
+ "check_out_my_booking": "Check ud af mit ophold",
+ "dates": "Datoer",
+ "guests": "Gæster",
+ "view_booking": "Se booking",
+ "comwell_booking": "Comwell Ophold",
"handle_guests_title": "Håndter gæster",
- "cancel_sharing": "Fortryd deling"
+ "cancel_sharing": "Fortryd deling",
+ "name_on_card_hint": "Navn på kort",
+ "card_number_hint": "Kortnummer",
+ "expiry_date_hint": "Udløbsdato",
+ "cvc_hint": "CVC"
}
\ No newline at end of file
diff --git a/comwell_key_app/assets/translations/en-US.json b/comwell_key_app/assets/translations/en-US.json
index 6c866832..831df6e6 100644
--- a/comwell_key_app/assets/translations/en-US.json
+++ b/comwell_key_app/assets/translations/en-US.json
@@ -185,5 +185,14 @@
"share_booking_page_subtitle": "Here you can share your booking with another guest and give them access to booking information, keycard and Concierge",
"share_booking_page_share_button": "Share your booking",
"handle_guests_title": "Handle guests",
- "cancel_sharing": "Cancel sharing"
+ "cancel_sharing": "Cancel sharing",
+ "check_out_my_booking": "Check out my booking",
+ "dates": "Dates",
+ "guests": "Guests",
+ "view_booking": "View booking",
+ "comwell_booking": "Comwell Booking",
+ "name_on_card_hint": "Name on card",
+ "card_number_hint": "Card number",
+ "expiry_date_hint": "Expiry date",
+ "cvc_hint": "CVC"
}
\ No newline at end of file
diff --git a/comwell_key_app/lib/payment_cards/components/edit_card_dialog.dart b/comwell_key_app/lib/payment_cards/components/edit_card_dialog.dart
index 3b7c6857..f1529736 100644
--- a/comwell_key_app/lib/payment_cards/components/edit_card_dialog.dart
+++ b/comwell_key_app/lib/payment_cards/components/edit_card_dialog.dart
@@ -37,8 +37,8 @@ class EditCardDialog extends StatelessWidget {
const SizedBox(height: 4),
TextField(
style: Theme.of(context).textTheme.bodySmall,
- decoration: const InputDecoration(
- hintText: "Card number",
+ decoration: InputDecoration(
+ hintText: "card_number_hint".tr(),
border:
OutlineInputBorder(borderSide: BorderSide(color: colorDivider)),
),
@@ -50,8 +50,8 @@ class EditCardDialog extends StatelessWidget {
Expanded(
child: TextField(
style: Theme.of(context).textTheme.bodySmall,
- decoration: const InputDecoration(
- hintText: "Expiry date",
+ decoration: InputDecoration(
+ hintText: "expiry_date_hint".tr(),
border: OutlineInputBorder(
borderSide: BorderSide(color: colorDivider)),
),
@@ -61,8 +61,8 @@ class EditCardDialog extends StatelessWidget {
Expanded(
child: TextField(
style: Theme.of(context).textTheme.bodySmall,
- decoration: const InputDecoration(
- hintText: "CVC",
+ decoration: InputDecoration(
+ hintText: "cvc_hint".tr(),
border: OutlineInputBorder(
borderSide: BorderSide(color: colorDivider)),
),
diff --git a/comwell_key_app/lib/routing/app_router.dart b/comwell_key_app/lib/routing/app_router.dart
index fec22331..5b31d687 100644
--- a/comwell_key_app/lib/routing/app_router.dart
+++ b/comwell_key_app/lib/routing/app_router.dart
@@ -29,6 +29,7 @@ import 'package:comwell_key_app/profile_settings/profile_settings_page.dart';
import 'package:comwell_key_app/redeem_debug/redeem_page.dart';
import 'package:comwell_key_app/routing/app_routes.dart';
import 'package:comwell_key_app/routing/go_router_observer.dart';
+import 'package:comwell_key_app/share/cubit/share_booking_cubit.dart';
import 'package:comwell_key_app/share/share_booking_page.dart';
import 'package:comwell_key_app/utils/stream_to_listenable.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -147,11 +148,8 @@ GoRouter goRouter(AuthenticationBloc authBloc) {
name: AppRoutes.shareBooking.name,
builder: (context, state) {
final booking = state.extra as Booking;
- return BlocProvider<BookingDetailsBloc>(
- create: (BuildContext context) => BookingDetailsBloc(
- booking,
- bookingDetailsRepository: locator<BookingDetailsRepository>(),
- ),
+ return BlocProvider(
+ create: (BuildContext context) => ShareBookingCubit(),
child: ShareBookingPage(booking: booking),
);
},
@@ -167,13 +165,26 @@ GoRouter goRouter(AuthenticationBloc authBloc) {
child: BlocListener<OverviewCubit, OverviewState>(
listener: (context, state) {
if (state is OverviewLoaded) {
- final booking = state.bookings.current.firstWhere(
+ Booking? booking;
+ try {
+ booking = state.bookings.current.firstWhere(
(b) => b.id == bookingId,
orElse: () => state.bookings.past.firstWhere(
+ (b) => b.id == bookingId,
+ orElse: () => state.bookings.cancelled.firstWhere(
(b) => b.id == bookingId,
- orElse: () => state.bookings.cancelled
- .firstWhere((b) => b.id == bookingId)));
- if (context.mounted) {
+ orElse: () => throw Exception('Booking not found'),
+ ),
+ ),
+ );
+ } catch (e) {
+ if (context.mounted) {
+ context.pushNamed(AppRoutes.findBooking.name);
+ return;
+ }
+ }
+
+ if (booking != null && context.mounted) {
context.pushNamed(AppRoutes.bookingDetails.name,
extra: booking);
}
diff --git a/comwell_key_app/lib/services/interceptors/response_handle_interceptor.dart b/comwell_key_app/lib/services/interceptors/response_handle_interceptor.dart
index 3e8e9ba0..2107488f 100644
--- a/comwell_key_app/lib/services/interceptors/response_handle_interceptor.dart
+++ b/comwell_key_app/lib/services/interceptors/response_handle_interceptor.dart
@@ -45,7 +45,6 @@ class ResponseHandleInterceptor extends Interceptor {
ErrorInterceptorHandler handler,
) async {
final response = err.response;
- print("qqq err=$err");
if (response == null) {
return handler.next(DioException(
message: "Missing response",
diff --git a/comwell_key_app/lib/share/cubit/share_booking_cubit.dart b/comwell_key_app/lib/share/cubit/share_booking_cubit.dart
index 8346648f..adede48a 100644
--- a/comwell_key_app/lib/share/cubit/share_booking_cubit.dart
+++ b/comwell_key_app/lib/share/cubit/share_booking_cubit.dart
@@ -16,11 +16,11 @@ class ShareBookingCubit extends Cubit<ShareBookingState> {
Future<void> shareBooking(Booking booking) async {
// TODO: Implement actual sharing logic here
Share.share(
- 'Check out my booking at ${booking.hotelName}!\n\n'
- 'Dates: ${DateFormat('d. MMM').format(booking.startDate)} - ${DateFormat('d. MMM').format(booking.endDate)}\n'
- 'Guests: ${booking.adults} ${booking.adults > 1 ? 'adults'.tr() : 'adult'.tr()}${booking.children > 0 ? ' | ${booking.children} ${booking.children > 1 ? 'children'.tr() : 'child'.tr()}' : ''}\n\n'
- 'View booking: https://comwell.app/booking/${booking.id}',
- subject: 'Comwell Booking',
+ '${booking.hotelName}\n\n'
+ '${'dates'.tr()}: ${DateFormat('d. MMM').format(booking.startDate)} - ${DateFormat('d. MMM').format(booking.endDate)}\n'
+ '${'guests'.tr()}: ${booking.adults} ${booking.adults > 1 ? 'adults'.tr() : 'adult'.tr()}${booking.children > 0 ? ' | ${booking.children} ${booking.children > 1 ? 'children'.tr() : 'child'.tr()}' : ''}\n\n'
+ '${'view_booking'.tr()}: https://comwell.app/booking/${booking.id}',
+ subject: 'comwell_booking'.tr(),
);
}
diff --git a/comwell_key_app/lib/utils/secure_storage.dart b/comwell_key_app/lib/utils/secure_storage.dart
index 08e678e6..2091d759 100644
--- a/comwell_key_app/lib/utils/secure_storage.dart
+++ b/comwell_key_app/lib/utils/secure_storage.dart
@@ -1,12 +1,7 @@
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
class SecureStorage {
- final FlutterSecureStorage _storage = const FlutterSecureStorage(
- iOptions: IOSOptions(
- accessibility: KeychainAccessibility.first_unlock,
- synchronizable: true,
- ),
- );
+ final FlutterSecureStorage _storage = const FlutterSecureStorage();
Future<String?> read(String key) async {
return await _storage.read(key: key);