6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit 11eea3d1

AuthorEdmir Suljic<esu@dwarf.dk>
Date2025-05-07 15:27:52 +0200
Added new state to check in state

Changed files

comwell_key_app/lib/check_in/bloc/check_in_cubit.dart | 5 +++--
 comwell_key_app/lib/check_in/bloc/check_in_state.dart | 7 +++++++
 comwell_key_app/lib/services/api.dart                 | 6 ++++--
 3 files changed, 14 insertions(+), 4 deletions(-)

Diff

diff --git a/comwell_key_app/lib/check_in/bloc/check_in_cubit.dart b/comwell_key_app/lib/check_in/bloc/check_in_cubit.dart
index 0c2dc92c..8c5e20e7 100644
--- a/comwell_key_app/lib/check_in/bloc/check_in_cubit.dart
+++ b/comwell_key_app/lib/check_in/bloc/check_in_cubit.dart
@@ -17,7 +17,8 @@ class CheckInCubit extends Cubit<CheckInState> {
try {
await Future<void>.delayed(const Duration(milliseconds: 500));
emit(state.checkInStatusLoading());
- await _checkInRepository.checkIfSetup();
+ await _checkInRepository.checkIn(booking.confirmationId);
+ //await _checkInRepository.checkIfSetup();
await tryGetKeys();
emit(state.checkInStatusRoomFound(roomNumber: booking.roomNumber));
await Future<void>.delayed(const Duration(milliseconds: 1000));
@@ -32,7 +33,7 @@ class CheckInCubit extends Cubit<CheckInState> {
Future<void> onDonePressed() async {
emit(state.checkInStatusLoading());
try {
- await _checkInRepository.checkIn(booking.confirmationId);
+
// emit(state.checkInStatusDone());
} catch (err, st) {
if (kDebugMode) print("qqq err=$err, $st");
diff --git a/comwell_key_app/lib/check_in/bloc/check_in_state.dart b/comwell_key_app/lib/check_in/bloc/check_in_state.dart
index 04ed5cfe..272f5ef3 100644
--- a/comwell_key_app/lib/check_in/bloc/check_in_state.dart
+++ b/comwell_key_app/lib/check_in/bloc/check_in_state.dart
@@ -25,6 +25,8 @@ class CheckInState {
return "check_in_room_found_title";
case CheckInStatusYourDigitalCard _:
return "check_in_your_digital_card_title";
+ case CheckInStatusRoomNotFound _:
+ return "check_in_room_not_found_title";
case CheckInStatusError _:
return "check_in_error_title";
}
@@ -54,6 +56,9 @@ class CheckInState {
_copyWith(
checkInStatus: CheckInStatusYourDigitalCard(roomNumber: roomNumber));
+ CheckInState checkInStatusRoomNotFound() =>
+ _copyWith(checkInStatus: CheckInStatusRoomNotFound());
+
CheckInState checkInStatusError(Exception exception) =>
_copyWith(checkInStatus: CheckInStatusError(exception: exception), loading: false);
@@ -84,6 +89,8 @@ final class CheckInStatusRoomFound extends CheckInStatus {
CheckInStatusRoomFound({required this.roomNumber});
}
+final class CheckInStatusRoomNotFound extends CheckInStatus {}
+
final class CheckInStatusYourDigitalCard extends CheckInStatus {
final String roomNumber;
diff --git a/comwell_key_app/lib/services/api.dart b/comwell_key_app/lib/services/api.dart
index 05c419bb..38984e99 100644
--- a/comwell_key_app/lib/services/api.dart
+++ b/comwell_key_app/lib/services/api.dart
@@ -157,9 +157,11 @@ class Api {
return response;
}
- Future<void> checkIn(String confirmationId) async {
- await dio.post<void>(ApiEndpoints.checkIn,
+ Future<dynamic> checkIn(String confirmationId) async {
+ final response = await dio.post<void>(ApiEndpoints.checkIn,
data: {"confirmationId": confirmationId});
+ print("response in api: $response");
+ return response;
}
Future<void> sendContact(String hotelCode) async {}