From 450683c45c59c9f0207293e441820981b1e5a476 Mon Sep 17 00:00:00 2001 From: Achintha Isuru Date: Tue, 27 Jan 2026 12:27:22 -0500 Subject: [PATCH] feat: implement emergency contact management with Firebase integration and relationship type handling --- apps/mobile/apps/client/pubspec.yaml | 4 +- .../lib/src/l10n/strings.g.dart | 2 +- .../src/mocks/profile_repository_mock.dart | 3 +- .../packages/domain/lib/krow_domain.dart | 4 + .../profile/emergency_contact_adapter.dart | 19 +++++ .../entities/profile/emergency_contact.dart | 57 ++++++++++++- .../entities/profile/relationship_type.dart | 6 ++ .../emergency_contact_repository_impl.dart | 80 ++++++++++++++--- .../get_emergency_contacts_arguments.dart | 7 +- .../save_emergency_contacts_arguments.dart | 6 +- .../emergency_contact_extensions.dart | 8 +- ...mergency_contact_repository_interface.dart | 4 +- .../get_emergency_contacts_usecase.dart | 2 +- .../save_emergency_contacts_usecase.dart | 2 +- .../blocs/emergency_contact_bloc.dart | 9 +- .../widgets/emergency_contact_form_item.dart | 85 +++++++++++-------- .../src/staff_emergency_contact_module.dart | 9 +- 17 files changed, 226 insertions(+), 81 deletions(-) create mode 100644 apps/mobile/packages/domain/lib/src/adapters/profile/emergency_contact_adapter.dart create mode 100644 apps/mobile/packages/domain/lib/src/entities/profile/relationship_type.dart diff --git a/apps/mobile/apps/client/pubspec.yaml b/apps/mobile/apps/client/pubspec.yaml index 7e5c4d5a..c2fa3bd1 100644 --- a/apps/mobile/apps/client/pubspec.yaml +++ b/apps/mobile/apps/client/pubspec.yaml @@ -1,7 +1,7 @@ name: krowwithus_client description: "Krow Client Application" -publish_to: 'none' -version: 0.0.1+M301 +publish_to: "none" +version: 0.0.1-M+301 resolution: workspace environment: diff --git a/apps/mobile/packages/core_localization/lib/src/l10n/strings.g.dart b/apps/mobile/packages/core_localization/lib/src/l10n/strings.g.dart index 23ea1d39..7cabeb39 100644 --- a/apps/mobile/packages/core_localization/lib/src/l10n/strings.g.dart +++ b/apps/mobile/packages/core_localization/lib/src/l10n/strings.g.dart @@ -6,7 +6,7 @@ /// Locales: 2 /// Strings: 1026 (513 per locale) /// -/// Built on 2026-01-27 at 00:15 UTC +/// Built on 2026-01-27 at 16:42 UTC // coverage:ignore-file // ignore_for_file: type=lint, unused_import diff --git a/apps/mobile/packages/data_connect/lib/src/mocks/profile_repository_mock.dart b/apps/mobile/packages/data_connect/lib/src/mocks/profile_repository_mock.dart index 103b1435..2bfd79c1 100644 --- a/apps/mobile/packages/data_connect/lib/src/mocks/profile_repository_mock.dart +++ b/apps/mobile/packages/data_connect/lib/src/mocks/profile_repository_mock.dart @@ -51,7 +51,8 @@ class ProfileRepositoryMock { const EmergencyContact( name: 'Jane Doe', phone: '555-987-6543', - relationship: 'Family', + relationship: RelationshipType.spouse, + id: 'contact_1', ), ]; } diff --git a/apps/mobile/packages/domain/lib/krow_domain.dart b/apps/mobile/packages/domain/lib/krow_domain.dart index 17d83564..4c9ffb47 100644 --- a/apps/mobile/packages/domain/lib/krow_domain.dart +++ b/apps/mobile/packages/domain/lib/krow_domain.dart @@ -52,6 +52,7 @@ export 'src/entities/financial/staff_payment.dart'; // Profile export 'src/entities/profile/staff_document.dart'; export 'src/entities/profile/attire_item.dart'; +export 'src/entities/profile/relationship_type.dart'; // Ratings & Penalties export 'src/entities/ratings/staff_rating.dart'; @@ -77,3 +78,6 @@ export 'src/entities/home/reorder_item.dart'; // Availability export 'src/entities/availability/availability_slot.dart'; export 'src/entities/availability/day_availability.dart'; + +// Adapters +export 'src/adapters/profile/emergency_contact_adapter.dart'; diff --git a/apps/mobile/packages/domain/lib/src/adapters/profile/emergency_contact_adapter.dart b/apps/mobile/packages/domain/lib/src/adapters/profile/emergency_contact_adapter.dart new file mode 100644 index 00000000..964f5735 --- /dev/null +++ b/apps/mobile/packages/domain/lib/src/adapters/profile/emergency_contact_adapter.dart @@ -0,0 +1,19 @@ +import '../../entities/profile/emergency_contact.dart'; + +/// Adapter for [EmergencyContact] to map data layer values to domain entity. +class EmergencyContactAdapter { + /// Maps primitive values to [EmergencyContact]. + static EmergencyContact fromPrimitives({ + required String id, + required String name, + required String phone, + String? relationship, + }) { + return EmergencyContact( + id: id, + name: name, + phone: phone, + relationship: EmergencyContact.stringToRelationshipType(relationship), + ); + } +} diff --git a/apps/mobile/packages/domain/lib/src/entities/profile/emergency_contact.dart b/apps/mobile/packages/domain/lib/src/entities/profile/emergency_contact.dart index d9e8fcd2..0ca41349 100644 --- a/apps/mobile/packages/domain/lib/src/entities/profile/emergency_contact.dart +++ b/apps/mobile/packages/domain/lib/src/entities/profile/emergency_contact.dart @@ -1,4 +1,5 @@ import 'package:equatable/equatable.dart'; +import 'relationship_type.dart'; /// Represents an emergency contact for a user. /// @@ -6,19 +7,69 @@ import 'package:equatable/equatable.dart'; class EmergencyContact extends Equatable { const EmergencyContact({ + required this.id, required this.name, required this.relationship, required this.phone, }); + + /// Unique identifier. + final String id; + /// Full name of the contact. final String name; /// Relationship to the user (e.g. "Spouse", "Parent"). - final String relationship; + final RelationshipType relationship; /// Phone number. final String phone; @override - List get props => [name, relationship, phone]; -} \ No newline at end of file + List get props => [id, name, relationship, phone]; + + /// Returns a copy of this [EmergencyContact] with the given fields replaced. + EmergencyContact copyWith({ + String? id, + String? name, + String? phone, + RelationshipType? relationship, + }) { + return EmergencyContact( + id: id ?? this.id, + name: name ?? this.name, + phone: phone ?? this.phone, + relationship: relationship ?? this.relationship, + ); + } + + /// Returns an empty [EmergencyContact]. + static EmergencyContact empty() { + return const EmergencyContact( + id: '', + name: '', + phone: '', + relationship: RelationshipType.family, + ); + } + + /// Converts a string value to a [RelationshipType]. + static RelationshipType stringToRelationshipType(String? value) { + if (value != null) { + final strVal = value.toUpperCase(); + switch (strVal) { + case 'FAMILY': + return RelationshipType.family; + case 'SPOUSE': + return RelationshipType.spouse; + case 'FRIEND': + return RelationshipType.friend; + case 'OTHER': + return RelationshipType.other; + default: + return RelationshipType.other; + } + } + return RelationshipType.other; + } +} diff --git a/apps/mobile/packages/domain/lib/src/entities/profile/relationship_type.dart b/apps/mobile/packages/domain/lib/src/entities/profile/relationship_type.dart new file mode 100644 index 00000000..2d4dde1a --- /dev/null +++ b/apps/mobile/packages/domain/lib/src/entities/profile/relationship_type.dart @@ -0,0 +1,6 @@ +enum RelationshipType { + family, + spouse, + friend, + other, +} diff --git a/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/data/repositories/emergency_contact_repository_impl.dart b/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/data/repositories/emergency_contact_repository_impl.dart index a69b4bf7..ccbb3be4 100644 --- a/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/data/repositories/emergency_contact_repository_impl.dart +++ b/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/data/repositories/emergency_contact_repository_impl.dart @@ -1,25 +1,83 @@ -import 'package:krow_data_connect/krow_data_connect.dart'; +import 'package:firebase_auth/firebase_auth.dart'; +import 'package:krow_data_connect/krow_data_connect.dart' as dc; import 'package:krow_domain/krow_domain.dart'; import '../../domain/repositories/emergency_contact_repository_interface.dart'; /// Implementation of [EmergencyContactRepositoryInterface]. /// -/// This repository delegates data operations to the [ProfileRepositoryMock] -/// (or real implementation) from the `data_connect` package. +/// This repository delegates data operations to Firebase Data Connect. class EmergencyContactRepositoryImpl implements EmergencyContactRepositoryInterface { - final ProfileRepositoryMock _profileRepository; + final dc.ExampleConnector _dataConnect; + final FirebaseAuth _firebaseAuth; /// Creates an [EmergencyContactRepositoryImpl]. - EmergencyContactRepositoryImpl(this._profileRepository); + EmergencyContactRepositoryImpl({ + required dc.ExampleConnector dataConnect, + required FirebaseAuth firebaseAuth, + }) : _dataConnect = dataConnect, + _firebaseAuth = firebaseAuth; - @override - Future> getContacts(String staffId) { - return _profileRepository.getEmergencyContacts(staffId); + Future _getStaffId() async { + final user = _firebaseAuth.currentUser; + if (user == null) throw Exception('User not authenticated'); + + final result = + await _dataConnect.getStaffByUserId(userId: user.uid).execute(); + if (result.data.staffs.isEmpty) { + throw Exception('Staff profile not found'); + } + return result.data.staffs.first.id; } @override - Future saveContacts(String staffId, List contacts) { - return _profileRepository.saveEmergencyContacts(staffId, contacts); + Future> getContacts() async { + final staffId = await _getStaffId(); + final result = + await _dataConnect.getEmergencyContactsByStaffId(staffId: staffId).execute(); + + return result.data.emergencyContacts.map((dto) { + return EmergencyContactAdapter.fromPrimitives( + id: dto.id, + name: dto.name, + phone: dto.phone, + relationship: dto.relationship.stringValue, + ); + }).toList(); } -} + + @override + Future saveContacts(List contacts) async { + final staffId = await _getStaffId(); + + // 1. Get existing to delete + final existingResult = + await _dataConnect.getEmergencyContactsByStaffId(staffId: staffId).execute(); + final existingIds = + existingResult.data.emergencyContacts.map((e) => e.id).toList(); + + // 2. Delete all existing + await Future.wait(existingIds.map( + (id) => _dataConnect.deleteEmergencyContact(id: id).execute())); + + // 3. Create new + await Future.wait(contacts.map((contact) { + dc.RelationshipType rel = dc.RelationshipType.OTHER; + switch(contact.relationship) { + case RelationshipType.family: rel = dc.RelationshipType.FAMILY; break; + case RelationshipType.spouse: rel = dc.RelationshipType.SPOUSE; break; + case RelationshipType.friend: rel = dc.RelationshipType.FRIEND; break; + case RelationshipType.other: rel = dc.RelationshipType.OTHER; break; + } + + return _dataConnect + .createEmergencyContact( + name: contact.name, + phone: contact.phone, + relationship: rel, + staffId: staffId, + ) + .execute(); + })); + } +} \ No newline at end of file diff --git a/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/domain/arguments/get_emergency_contacts_arguments.dart b/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/domain/arguments/get_emergency_contacts_arguments.dart index 8fe22839..af7e9328 100644 --- a/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/domain/arguments/get_emergency_contacts_arguments.dart +++ b/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/domain/arguments/get_emergency_contacts_arguments.dart @@ -2,12 +2,9 @@ import 'package:krow_core/core.dart'; /// Arguments for getting emergency contacts use case. class GetEmergencyContactsArguments extends UseCaseArgument { - /// The ID of the staff member. - final String staffId; - /// Creates a [GetEmergencyContactsArguments]. - const GetEmergencyContactsArguments({required this.staffId}); + const GetEmergencyContactsArguments(); @override - List get props => [staffId]; + List get props => []; } diff --git a/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/domain/arguments/save_emergency_contacts_arguments.dart b/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/domain/arguments/save_emergency_contacts_arguments.dart index 2aa195b5..1566d6c1 100644 --- a/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/domain/arguments/save_emergency_contacts_arguments.dart +++ b/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/domain/arguments/save_emergency_contacts_arguments.dart @@ -3,18 +3,14 @@ import 'package:krow_domain/krow_domain.dart'; /// Arguments for saving emergency contacts use case. class SaveEmergencyContactsArguments extends UseCaseArgument { - /// The ID of the staff member. - final String staffId; - /// The list of contacts to save. final List contacts; /// Creates a [SaveEmergencyContactsArguments]. const SaveEmergencyContactsArguments({ - required this.staffId, required this.contacts, }); @override - List get props => [staffId, contacts]; + List get props => [contacts]; } diff --git a/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/domain/extensions/emergency_contact_extensions.dart b/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/domain/extensions/emergency_contact_extensions.dart index d246a6c2..dce5ba36 100644 --- a/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/domain/extensions/emergency_contact_extensions.dart +++ b/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/domain/extensions/emergency_contact_extensions.dart @@ -4,11 +4,13 @@ import 'package:krow_domain/krow_domain.dart'; extension EmergencyContactExtensions on EmergencyContact { /// returns a copy of this [EmergencyContact] with the given fields replaced. EmergencyContact copyWith({ + String? id, String? name, String? phone, - String? relationship, + RelationshipType? relationship, }) { return EmergencyContact( + id: id ?? this.id, name: name ?? this.name, phone: phone ?? this.phone, relationship: relationship ?? this.relationship, @@ -18,9 +20,11 @@ extension EmergencyContactExtensions on EmergencyContact { /// Returns an empty [EmergencyContact]. static EmergencyContact empty() { return const EmergencyContact( + id: '', name: '', phone: '', - relationship: 'family', + relationship: RelationshipType.family, ); } } + diff --git a/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/domain/repositories/emergency_contact_repository_interface.dart b/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/domain/repositories/emergency_contact_repository_interface.dart index 3cd5792b..1f958052 100644 --- a/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/domain/repositories/emergency_contact_repository_interface.dart +++ b/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/domain/repositories/emergency_contact_repository_interface.dart @@ -6,8 +6,8 @@ import 'package:krow_domain/krow_domain.dart'; /// It must be implemented by the data layer. abstract class EmergencyContactRepositoryInterface { /// Retrieves the list of emergency contacts. - Future> getContacts(String staffId); + Future> getContacts(); /// Saves the list of emergency contacts. - Future saveContacts(String staffId, List contacts); + Future saveContacts(List contacts); } diff --git a/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/domain/usecases/get_emergency_contacts_usecase.dart b/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/domain/usecases/get_emergency_contacts_usecase.dart index 5c4faa1b..50f8387c 100644 --- a/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/domain/usecases/get_emergency_contacts_usecase.dart +++ b/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/domain/usecases/get_emergency_contacts_usecase.dart @@ -16,6 +16,6 @@ class GetEmergencyContactsUseCase @override Future> call(GetEmergencyContactsArguments params) { - return _repository.getContacts(params.staffId); + return _repository.getContacts(); } } diff --git a/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/domain/usecases/save_emergency_contacts_usecase.dart b/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/domain/usecases/save_emergency_contacts_usecase.dart index 49563678..9e0fabe7 100644 --- a/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/domain/usecases/save_emergency_contacts_usecase.dart +++ b/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/domain/usecases/save_emergency_contacts_usecase.dart @@ -15,6 +15,6 @@ class SaveEmergencyContactsUseCase @override Future call(SaveEmergencyContactsArguments params) { - return _repository.saveContacts(params.staffId, params.contacts); + return _repository.saveContacts(params.contacts); } } diff --git a/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/presentation/blocs/emergency_contact_bloc.dart b/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/presentation/blocs/emergency_contact_bloc.dart index 73478061..ae126661 100644 --- a/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/presentation/blocs/emergency_contact_bloc.dart +++ b/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/presentation/blocs/emergency_contact_bloc.dart @@ -81,12 +81,10 @@ class EmergencyContactBloc extends Bloc { final GetEmergencyContactsUseCase getEmergencyContacts; final SaveEmergencyContactsUseCase saveEmergencyContacts; - final String staffId; EmergencyContactBloc({ required this.getEmergencyContacts, required this.saveEmergencyContacts, - required this.staffId, }) : super(const EmergencyContactState()) { on(_onLoaded); on(_onAdded); @@ -102,13 +100,13 @@ class EmergencyContactBloc emit(state.copyWith(status: EmergencyContactStatus.loading)); try { final contacts = await getEmergencyContacts( - GetEmergencyContactsArguments(staffId: staffId), + const GetEmergencyContactsArguments(), ); emit(state.copyWith( status: EmergencyContactStatus.success, contacts: contacts.isNotEmpty ? contacts - : [const EmergencyContact(name: '', phone: '', relationship: 'family')], + : [EmergencyContact.empty()], )); } catch (e) { emit(state.copyWith( @@ -123,7 +121,7 @@ class EmergencyContactBloc Emitter emit, ) { final updatedContacts = List.from(state.contacts) - ..add(const EmergencyContact(name: '', phone: '', relationship: 'family')); + ..add(EmergencyContact.empty()); emit(state.copyWith(contacts: updatedContacts)); } @@ -153,7 +151,6 @@ class EmergencyContactBloc try { await saveEmergencyContacts( SaveEmergencyContactsArguments( - staffId: staffId, contacts: state.contacts, ), ); diff --git a/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/presentation/widgets/emergency_contact_form_item.dart b/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/presentation/widgets/emergency_contact_form_item.dart index b05c2783..8dbf2063 100644 --- a/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/presentation/widgets/emergency_contact_form_item.dart +++ b/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/presentation/widgets/emergency_contact_form_item.dart @@ -2,7 +2,6 @@ import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:krow_domain/krow_domain.dart'; -import '../../domain/extensions/emergency_contact_extensions.dart'; import '../blocs/emergency_contact_bloc.dart'; class EmergencyContactFormItem extends StatelessWidget { @@ -62,7 +61,7 @@ class EmergencyContactFormItem extends StatelessWidget { _buildDropdown( context, value: contact.relationship, - items: const ['family', 'friend', 'partner', 'other'], + items: RelationshipType.values, onChanged: (val) { if (val != null) { context.read().add( @@ -79,6 +78,52 @@ class EmergencyContactFormItem extends StatelessWidget { ); } + Widget _buildDropdown( + BuildContext context, { + required RelationshipType value, + required List items, + required ValueChanged onChanged, + }) { + return Container( + padding: EdgeInsets.symmetric( + horizontal: UiConstants.space4, + vertical: UiConstants.space2, + ), + decoration: BoxDecoration( + color: UiColors.bgPopup, + borderRadius: UiConstants.radiusLg, + border: Border.all(color: UiColors.border), + ), + child: DropdownButtonHideUnderline( + child: DropdownButton( + value: value, + isExpanded: true, + dropdownColor: UiColors.bgPopup, + icon: Icon(UiIcons.chevronDown, color: UiColors.iconSecondary), + items: items.map((type) { + return DropdownMenuItem( + value: type, + child: Text( + _formatRelationship(type), + style: UiTypography.body1r.copyWith(color: UiColors.textPrimary), + ), + ); + }).toList(), + onChanged: onChanged, + ), + ), + ); + } + + String _formatRelationship(RelationshipType type) { + switch(type) { + case RelationshipType.family: return 'Family'; + case RelationshipType.spouse: return 'Spouse'; + case RelationshipType.friend: return 'Friend'; + case RelationshipType.other: return 'Other'; + } + } + Widget _buildHeader(BuildContext context) { return Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -150,39 +195,5 @@ class EmergencyContactFormItem extends StatelessWidget { onChanged: onChanged, ); } - - Widget _buildDropdown( - BuildContext context, { - required String value, - required List items, - required Function(String?) onChanged, - }) { - return Container( - padding: EdgeInsets.symmetric(horizontal: UiConstants.space4), - decoration: BoxDecoration( - color: UiColors.bgPopup, - borderRadius: UiConstants.radiusLg, - border: Border.all(color: UiColors.border), - ), - child: DropdownButtonHideUnderline( - child: DropdownButton( - value: items.contains(value) ? value : items.first, - isExpanded: true, - icon: Icon(UiIcons.chevronDown, color: UiColors.textSecondary), - items: items.map((String item) { - return DropdownMenuItem( - value: item, - child: Text( - item.toUpperCase(), - style: UiTypography.body1r.copyWith( - color: UiColors.textPrimary, - ), - ), - ); - }).toList(), - onChanged: onChanged, - ), - ), - ); - } } + diff --git a/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/staff_emergency_contact_module.dart b/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/staff_emergency_contact_module.dart index 66048891..3245fd70 100644 --- a/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/staff_emergency_contact_module.dart +++ b/apps/mobile/packages/features/staff/profile_sections/onboarding/emergency_contact/lib/src/staff_emergency_contact_module.dart @@ -1,3 +1,4 @@ +import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter_modular/flutter_modular.dart'; import 'package:krow_data_connect/krow_data_connect.dart'; import 'data/repositories/emergency_contact_repository_impl.dart'; @@ -11,10 +12,11 @@ class StaffEmergencyContactModule extends Module { @override void binds(Injector i) { // Repository - // Uses ProfileRepositoryMock from data_connect - i.addLazySingleton(ProfileRepositoryMock.new); i.addLazySingleton( - () => EmergencyContactRepositoryImpl(i.get()), + () => EmergencyContactRepositoryImpl( + dataConnect: ExampleConnector.instance, + firebaseAuth: FirebaseAuth.instance, + ), ); // UseCases @@ -30,7 +32,6 @@ class StaffEmergencyContactModule extends Module { () => EmergencyContactBloc( getEmergencyContacts: i.get(), saveEmergencyContacts: i.get(), - staffId: 'mock-staff-id', // TODO: Get direct from auth state ), ); }