diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 461f1b0e7..02755fb33 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -22,7 +22,7 @@ jobs: - name: Flutter action uses: subosito/flutter-action@v2.8.0 with: - flutter-version: '3.10.5' + flutter-version: "3.10.5" - name: Generate models run: ./tools/install_bricks.sh diff --git a/apps/health_campaign_field_worker_app/lib/blocs/search_households/search_households.dart b/apps/health_campaign_field_worker_app/lib/blocs/search_households/search_households.dart index 7a5917d5a..86c3cc8a9 100644 --- a/apps/health_campaign_field_worker_app/lib/blocs/search_households/search_households.dart +++ b/apps/health_campaign_field_worker_app/lib/blocs/search_households/search_households.dart @@ -6,6 +6,7 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:stream_transform/stream_transform.dart'; +import '../../data/repositories/local/address.dart'; import '../../data/repositories/local/project_beneficiary.dart'; import '../../data/repositories/local/task.dart'; import '../../models/data_model.dart'; @@ -26,6 +27,7 @@ class SearchHouseholdsBloc final String userUid; final IndividualDataRepository individual; final HouseholdDataRepository household; + final AddressLocalRepository addressRepository; final HouseholdMemberDataRepository householdMember; final ProjectBeneficiaryDataRepository projectBeneficiary; final TaskDataRepository taskDataRepository; @@ -39,6 +41,7 @@ class SearchHouseholdsBloc required this.projectBeneficiary, required this.taskDataRepository, required this.beneficiaryType, + required this.addressRepository, }) : super(const SearchHouseholdsState()) { on( _handleSearchByHouseholdHead, @@ -46,6 +49,7 @@ class SearchHouseholdsBloc const Duration(milliseconds: 100), ), ); + on(_handleSearchByProximitity); on(_handleClear); on(_handleSearchByHousehold); on(_handleInitialize); @@ -193,6 +197,85 @@ class SearchHouseholdsBloc } } + FutureOr _handleSearchByProximitity( + SearchHouseholdsByProximityEvent event, + SearchHouseholdsEmitter emit, + ) async { + emit(state.copyWith(loading: true)); + final results = + await addressRepository.searchHouseHoldbyAddress(AddressSearchModel( + latitude: event.latitude, + longitude: event.longititude, + maxRadius: event.maxRadius, + )); + final containers = []; + for (final element in results) { + final members = await householdMember.search( + HouseholdMemberSearchModel( + householdClientReferenceId: element.clientReferenceId, + ), + ); + final head = await householdMember.search( + HouseholdMemberSearchModel( + householdClientReferenceId: element.clientReferenceId, + isHeadOfHousehold: true, + ), + ); + + final individualIds = members + .map((element) => element.individualClientReferenceId) + .whereNotNull() + .toList(); + + final allHouseholdMembers = await individual.search( + IndividualSearchModel( + clientReferenceId: individualIds, + ), + ); + + final headOfHousehold = allHouseholdMembers.firstWhere((element) => + element.clientReferenceId == head.first.individualClientReferenceId); + + final projectBeneficiaries = beneficiaryType != BeneficiaryType.individual + ? await projectBeneficiary.search( + ProjectBeneficiarySearchModel( + beneficiaryClientReferenceId: [element.clientReferenceId], + //[TODO] Need to check for beneficiaryId + projectId: event.projectId, + ), + ) + : await projectBeneficiary.search( + ProjectBeneficiarySearchModel( + beneficiaryClientReferenceId: individualIds, + //[TODO] Need to check for beneficiaryId + projectId: event.projectId, + ), + ); + + final tasks = await taskDataRepository.search(TaskSearchModel( + projectBeneficiaryClientReferenceId: + projectBeneficiaries.map((e) => e.clientReferenceId).toList(), + )); + + containers.add( + HouseholdMemberWrapper( + household: element, + headOfHousehold: headOfHousehold, + members: allHouseholdMembers, + projectBeneficiaries: projectBeneficiaries, + tasks: tasks.isEmpty ? null : tasks, + ), + ); + } + emit(state.copyWith( + householdMembers: containers, + loading: false, + searchQuery: null, + )); + + return; + } + FutureOr _handleSearchByHouseholdHead( SearchHouseholdsSearchByHouseholdHeadEvent event, SearchHouseholdsEmitter emit, @@ -211,21 +294,36 @@ class SearchHouseholdsBloc searchQuery: event.searchText, )); - final results = await individual.search( + final List proximityBasedResults = + await addressRepository.searchHouseHoldbyAddress(AddressSearchModel( + latitude: event.latitude, + longitude: event.longitude, + maxRadius: event.maxRadius, + )); + final List results = await individual.search( IndividualSearchModel( name: NameSearchModel(givenName: event.searchText.trim()), ), ); final householdMembers = []; - - for (final element in results) { - final members = await householdMember.search( - HouseholdMemberSearchModel( - individualClientReferenceId: element.clientReferenceId, - isHeadOfHousehold: true, - ), - ); + final r = event.isProximityEnabled ? proximityBasedResults : results; + for (final element in r) { + final members = event.isProximityEnabled + ? await householdMember.search( + HouseholdMemberSearchModel( + householdClientReferenceId: + (element as HouseholdModel).clientReferenceId, + isHeadOfHousehold: true, + ), + ) + : await householdMember.search( + HouseholdMemberSearchModel( + individualClientReferenceId: + (element as IndividualModel).clientReferenceId, + isHeadOfHousehold: true, + ), + ); for (final member in members) { final allHouseholdMembers = await householdMember.search( @@ -250,10 +348,12 @@ class SearchHouseholdsBloc .toList(); if (householdId == null) continue; - final households = await household.search( HouseholdSearchModel( clientReferenceId: [householdId], + latitude: event.latitude, + longitude: event.longitude, + maxRadius: event.maxRadius, ), ); @@ -261,9 +361,18 @@ class SearchHouseholdsBloc final resultHousehold = households.first; - final individuals = await individual.search( - IndividualSearchModel(clientReferenceId: individualIds), - ); + final individuals = event.isProximityEnabled + ? await individual.search( + IndividualSearchModel( + clientReferenceId: individualIds, + name: NameSearchModel(givenName: event.searchText.trim()), + ), + ) + : await individual.search( + IndividualSearchModel( + clientReferenceId: individualIds, + ), + ); final head = individuals.firstWhereOrNull( (element) => @@ -336,14 +445,29 @@ class SearchHouseholdsEvent with _$SearchHouseholdsEvent { const factory SearchHouseholdsEvent.searchByHousehold({ required String projectId, + double? latitude, + double? longitude, + double? maxRadius, + required final bool isProximityEnabled, required HouseholdModel householdModel, }) = SearchHouseholdsByHouseholdsEvent; const factory SearchHouseholdsEvent.searchByHouseholdHead({ required String searchText, required String projectId, + required final bool isProximityEnabled, + double? latitude, + double? longitude, + double? maxRadius, }) = SearchHouseholdsSearchByHouseholdHeadEvent; + const factory SearchHouseholdsEvent.searchByProximity({ + required double latitude, + required double longititude, + required String projectId, + required double maxRadius, + }) = SearchHouseholdsByProximityEvent; + const factory SearchHouseholdsEvent.clear() = SearchHouseholdsClearEvent; } @@ -374,6 +498,7 @@ class HouseholdMemberWrapper with _$HouseholdMemberWrapper { required IndividualModel headOfHousehold, required List members, required List projectBeneficiaries, + double? distance, List? tasks, }) = _HouseholdMemberWrapper; } diff --git a/apps/health_campaign_field_worker_app/lib/blocs/search_households/search_households.freezed.dart b/apps/health_campaign_field_worker_app/lib/blocs/search_households/search_households.freezed.dart index 5c1cac7df..ab623ba18 100644 --- a/apps/health_campaign_field_worker_app/lib/blocs/search_households/search_households.freezed.dart +++ b/apps/health_campaign_field_worker_app/lib/blocs/search_households/search_households.freezed.dart @@ -19,30 +19,75 @@ mixin _$SearchHouseholdsEvent { @optionalTypeArgs TResult when({ required TResult Function() initialize, - required TResult Function(String projectId, HouseholdModel householdModel) + required TResult Function( + String projectId, + double? latitude, + double? longitude, + double? maxRadius, + bool isProximityEnabled, + HouseholdModel householdModel) searchByHousehold, - required TResult Function(String searchText, String projectId) + required TResult Function( + String searchText, + String projectId, + bool isProximityEnabled, + double? latitude, + double? longitude, + double? maxRadius) searchByHouseholdHead, + required TResult Function(double latitude, double longititude, + String projectId, double maxRadius) + searchByProximity, required TResult Function() clear, }) => throw _privateConstructorUsedError; @optionalTypeArgs TResult? whenOrNull({ TResult? Function()? initialize, - TResult? Function(String projectId, HouseholdModel householdModel)? + TResult? Function( + String projectId, + double? latitude, + double? longitude, + double? maxRadius, + bool isProximityEnabled, + HouseholdModel householdModel)? searchByHousehold, - TResult? Function(String searchText, String projectId)? + TResult? Function( + String searchText, + String projectId, + bool isProximityEnabled, + double? latitude, + double? longitude, + double? maxRadius)? searchByHouseholdHead, + TResult? Function(double latitude, double longititude, String projectId, + double maxRadius)? + searchByProximity, TResult? Function()? clear, }) => throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeWhen({ TResult Function()? initialize, - TResult Function(String projectId, HouseholdModel householdModel)? + TResult Function( + String projectId, + double? latitude, + double? longitude, + double? maxRadius, + bool isProximityEnabled, + HouseholdModel householdModel)? searchByHousehold, - TResult Function(String searchText, String projectId)? + TResult Function( + String searchText, + String projectId, + bool isProximityEnabled, + double? latitude, + double? longitude, + double? maxRadius)? searchByHouseholdHead, + TResult Function(double latitude, double longititude, String projectId, + double maxRadius)? + searchByProximity, TResult Function()? clear, required TResult orElse(), }) => @@ -55,6 +100,8 @@ mixin _$SearchHouseholdsEvent { searchByHousehold, required TResult Function(SearchHouseholdsSearchByHouseholdHeadEvent value) searchByHouseholdHead, + required TResult Function(SearchHouseholdsByProximityEvent value) + searchByProximity, required TResult Function(SearchHouseholdsClearEvent value) clear, }) => throw _privateConstructorUsedError; @@ -65,6 +112,8 @@ mixin _$SearchHouseholdsEvent { searchByHousehold, TResult? Function(SearchHouseholdsSearchByHouseholdHeadEvent value)? searchByHouseholdHead, + TResult? Function(SearchHouseholdsByProximityEvent value)? + searchByProximity, TResult? Function(SearchHouseholdsClearEvent value)? clear, }) => throw _privateConstructorUsedError; @@ -75,6 +124,7 @@ mixin _$SearchHouseholdsEvent { searchByHousehold, TResult Function(SearchHouseholdsSearchByHouseholdHeadEvent value)? searchByHouseholdHead, + TResult Function(SearchHouseholdsByProximityEvent value)? searchByProximity, TResult Function(SearchHouseholdsClearEvent value)? clear, required TResult orElse(), }) => @@ -144,10 +194,25 @@ class _$SearchHouseholdsInitializedEvent @optionalTypeArgs TResult when({ required TResult Function() initialize, - required TResult Function(String projectId, HouseholdModel householdModel) + required TResult Function( + String projectId, + double? latitude, + double? longitude, + double? maxRadius, + bool isProximityEnabled, + HouseholdModel householdModel) searchByHousehold, - required TResult Function(String searchText, String projectId) + required TResult Function( + String searchText, + String projectId, + bool isProximityEnabled, + double? latitude, + double? longitude, + double? maxRadius) searchByHouseholdHead, + required TResult Function(double latitude, double longititude, + String projectId, double maxRadius) + searchByProximity, required TResult Function() clear, }) { return initialize(); @@ -157,10 +222,25 @@ class _$SearchHouseholdsInitializedEvent @optionalTypeArgs TResult? whenOrNull({ TResult? Function()? initialize, - TResult? Function(String projectId, HouseholdModel householdModel)? + TResult? Function( + String projectId, + double? latitude, + double? longitude, + double? maxRadius, + bool isProximityEnabled, + HouseholdModel householdModel)? searchByHousehold, - TResult? Function(String searchText, String projectId)? + TResult? Function( + String searchText, + String projectId, + bool isProximityEnabled, + double? latitude, + double? longitude, + double? maxRadius)? searchByHouseholdHead, + TResult? Function(double latitude, double longititude, String projectId, + double maxRadius)? + searchByProximity, TResult? Function()? clear, }) { return initialize?.call(); @@ -170,10 +250,25 @@ class _$SearchHouseholdsInitializedEvent @optionalTypeArgs TResult maybeWhen({ TResult Function()? initialize, - TResult Function(String projectId, HouseholdModel householdModel)? + TResult Function( + String projectId, + double? latitude, + double? longitude, + double? maxRadius, + bool isProximityEnabled, + HouseholdModel householdModel)? searchByHousehold, - TResult Function(String searchText, String projectId)? + TResult Function( + String searchText, + String projectId, + bool isProximityEnabled, + double? latitude, + double? longitude, + double? maxRadius)? searchByHouseholdHead, + TResult Function(double latitude, double longititude, String projectId, + double maxRadius)? + searchByProximity, TResult Function()? clear, required TResult orElse(), }) { @@ -192,6 +287,8 @@ class _$SearchHouseholdsInitializedEvent searchByHousehold, required TResult Function(SearchHouseholdsSearchByHouseholdHeadEvent value) searchByHouseholdHead, + required TResult Function(SearchHouseholdsByProximityEvent value) + searchByProximity, required TResult Function(SearchHouseholdsClearEvent value) clear, }) { return initialize(this); @@ -205,6 +302,8 @@ class _$SearchHouseholdsInitializedEvent searchByHousehold, TResult? Function(SearchHouseholdsSearchByHouseholdHeadEvent value)? searchByHouseholdHead, + TResult? Function(SearchHouseholdsByProximityEvent value)? + searchByProximity, TResult? Function(SearchHouseholdsClearEvent value)? clear, }) { return initialize?.call(this); @@ -218,6 +317,7 @@ class _$SearchHouseholdsInitializedEvent searchByHousehold, TResult Function(SearchHouseholdsSearchByHouseholdHeadEvent value)? searchByHouseholdHead, + TResult Function(SearchHouseholdsByProximityEvent value)? searchByProximity, TResult Function(SearchHouseholdsClearEvent value)? clear, required TResult orElse(), }) { @@ -241,7 +341,13 @@ abstract class _$$SearchHouseholdsByHouseholdsEventCopyWith<$Res> { $Res Function(_$SearchHouseholdsByHouseholdsEvent) then) = __$$SearchHouseholdsByHouseholdsEventCopyWithImpl<$Res>; @useResult - $Res call({String projectId, HouseholdModel householdModel}); + $Res call( + {String projectId, + double? latitude, + double? longitude, + double? maxRadius, + bool isProximityEnabled, + HouseholdModel householdModel}); } /// @nodoc @@ -258,6 +364,10 @@ class __$$SearchHouseholdsByHouseholdsEventCopyWithImpl<$Res> @override $Res call({ Object? projectId = null, + Object? latitude = freezed, + Object? longitude = freezed, + Object? maxRadius = freezed, + Object? isProximityEnabled = null, Object? householdModel = null, }) { return _then(_$SearchHouseholdsByHouseholdsEvent( @@ -265,6 +375,22 @@ class __$$SearchHouseholdsByHouseholdsEventCopyWithImpl<$Res> ? _value.projectId : projectId // ignore: cast_nullable_to_non_nullable as String, + latitude: freezed == latitude + ? _value.latitude + : latitude // ignore: cast_nullable_to_non_nullable + as double?, + longitude: freezed == longitude + ? _value.longitude + : longitude // ignore: cast_nullable_to_non_nullable + as double?, + maxRadius: freezed == maxRadius + ? _value.maxRadius + : maxRadius // ignore: cast_nullable_to_non_nullable + as double?, + isProximityEnabled: null == isProximityEnabled + ? _value.isProximityEnabled + : isProximityEnabled // ignore: cast_nullable_to_non_nullable + as bool, householdModel: null == householdModel ? _value.householdModel : householdModel // ignore: cast_nullable_to_non_nullable @@ -278,16 +404,29 @@ class __$$SearchHouseholdsByHouseholdsEventCopyWithImpl<$Res> class _$SearchHouseholdsByHouseholdsEvent implements SearchHouseholdsByHouseholdsEvent { const _$SearchHouseholdsByHouseholdsEvent( - {required this.projectId, required this.householdModel}); + {required this.projectId, + this.latitude, + this.longitude, + this.maxRadius, + required this.isProximityEnabled, + required this.householdModel}); @override final String projectId; @override + final double? latitude; + @override + final double? longitude; + @override + final double? maxRadius; + @override + final bool isProximityEnabled; + @override final HouseholdModel householdModel; @override String toString() { - return 'SearchHouseholdsEvent.searchByHousehold(projectId: $projectId, householdModel: $householdModel)'; + return 'SearchHouseholdsEvent.searchByHousehold(projectId: $projectId, latitude: $latitude, longitude: $longitude, maxRadius: $maxRadius, isProximityEnabled: $isProximityEnabled, householdModel: $householdModel)'; } @override @@ -297,12 +436,21 @@ class _$SearchHouseholdsByHouseholdsEvent other is _$SearchHouseholdsByHouseholdsEvent && (identical(other.projectId, projectId) || other.projectId == projectId) && + (identical(other.latitude, latitude) || + other.latitude == latitude) && + (identical(other.longitude, longitude) || + other.longitude == longitude) && + (identical(other.maxRadius, maxRadius) || + other.maxRadius == maxRadius) && + (identical(other.isProximityEnabled, isProximityEnabled) || + other.isProximityEnabled == isProximityEnabled) && (identical(other.householdModel, householdModel) || other.householdModel == householdModel)); } @override - int get hashCode => Object.hash(runtimeType, projectId, householdModel); + int get hashCode => Object.hash(runtimeType, projectId, latitude, longitude, + maxRadius, isProximityEnabled, householdModel); @JsonKey(ignore: true) @override @@ -316,41 +464,89 @@ class _$SearchHouseholdsByHouseholdsEvent @optionalTypeArgs TResult when({ required TResult Function() initialize, - required TResult Function(String projectId, HouseholdModel householdModel) + required TResult Function( + String projectId, + double? latitude, + double? longitude, + double? maxRadius, + bool isProximityEnabled, + HouseholdModel householdModel) searchByHousehold, - required TResult Function(String searchText, String projectId) + required TResult Function( + String searchText, + String projectId, + bool isProximityEnabled, + double? latitude, + double? longitude, + double? maxRadius) searchByHouseholdHead, + required TResult Function(double latitude, double longititude, + String projectId, double maxRadius) + searchByProximity, required TResult Function() clear, }) { - return searchByHousehold(projectId, householdModel); + return searchByHousehold(projectId, latitude, longitude, maxRadius, + isProximityEnabled, householdModel); } @override @optionalTypeArgs TResult? whenOrNull({ TResult? Function()? initialize, - TResult? Function(String projectId, HouseholdModel householdModel)? + TResult? Function( + String projectId, + double? latitude, + double? longitude, + double? maxRadius, + bool isProximityEnabled, + HouseholdModel householdModel)? searchByHousehold, - TResult? Function(String searchText, String projectId)? + TResult? Function( + String searchText, + String projectId, + bool isProximityEnabled, + double? latitude, + double? longitude, + double? maxRadius)? searchByHouseholdHead, + TResult? Function(double latitude, double longititude, String projectId, + double maxRadius)? + searchByProximity, TResult? Function()? clear, }) { - return searchByHousehold?.call(projectId, householdModel); + return searchByHousehold?.call(projectId, latitude, longitude, maxRadius, + isProximityEnabled, householdModel); } @override @optionalTypeArgs TResult maybeWhen({ TResult Function()? initialize, - TResult Function(String projectId, HouseholdModel householdModel)? + TResult Function( + String projectId, + double? latitude, + double? longitude, + double? maxRadius, + bool isProximityEnabled, + HouseholdModel householdModel)? searchByHousehold, - TResult Function(String searchText, String projectId)? + TResult Function( + String searchText, + String projectId, + bool isProximityEnabled, + double? latitude, + double? longitude, + double? maxRadius)? searchByHouseholdHead, + TResult Function(double latitude, double longititude, String projectId, + double maxRadius)? + searchByProximity, TResult Function()? clear, required TResult orElse(), }) { if (searchByHousehold != null) { - return searchByHousehold(projectId, householdModel); + return searchByHousehold(projectId, latitude, longitude, maxRadius, + isProximityEnabled, householdModel); } return orElse(); } @@ -364,6 +560,8 @@ class _$SearchHouseholdsByHouseholdsEvent searchByHousehold, required TResult Function(SearchHouseholdsSearchByHouseholdHeadEvent value) searchByHouseholdHead, + required TResult Function(SearchHouseholdsByProximityEvent value) + searchByProximity, required TResult Function(SearchHouseholdsClearEvent value) clear, }) { return searchByHousehold(this); @@ -377,6 +575,8 @@ class _$SearchHouseholdsByHouseholdsEvent searchByHousehold, TResult? Function(SearchHouseholdsSearchByHouseholdHeadEvent value)? searchByHouseholdHead, + TResult? Function(SearchHouseholdsByProximityEvent value)? + searchByProximity, TResult? Function(SearchHouseholdsClearEvent value)? clear, }) { return searchByHousehold?.call(this); @@ -390,6 +590,7 @@ class _$SearchHouseholdsByHouseholdsEvent searchByHousehold, TResult Function(SearchHouseholdsSearchByHouseholdHeadEvent value)? searchByHouseholdHead, + TResult Function(SearchHouseholdsByProximityEvent value)? searchByProximity, TResult Function(SearchHouseholdsClearEvent value)? clear, required TResult orElse(), }) { @@ -404,10 +605,18 @@ abstract class SearchHouseholdsByHouseholdsEvent implements SearchHouseholdsEvent { const factory SearchHouseholdsByHouseholdsEvent( {required final String projectId, + final double? latitude, + final double? longitude, + final double? maxRadius, + required final bool isProximityEnabled, required final HouseholdModel householdModel}) = _$SearchHouseholdsByHouseholdsEvent; String get projectId; + double? get latitude; + double? get longitude; + double? get maxRadius; + bool get isProximityEnabled; HouseholdModel get householdModel; @JsonKey(ignore: true) _$$SearchHouseholdsByHouseholdsEventCopyWith< @@ -422,7 +631,13 @@ abstract class _$$SearchHouseholdsSearchByHouseholdHeadEventCopyWith<$Res> { $Res Function(_$SearchHouseholdsSearchByHouseholdHeadEvent) then) = __$$SearchHouseholdsSearchByHouseholdHeadEventCopyWithImpl<$Res>; @useResult - $Res call({String searchText, String projectId}); + $Res call( + {String searchText, + String projectId, + bool isProximityEnabled, + double? latitude, + double? longitude, + double? maxRadius}); } /// @nodoc @@ -440,6 +655,10 @@ class __$$SearchHouseholdsSearchByHouseholdHeadEventCopyWithImpl<$Res> $Res call({ Object? searchText = null, Object? projectId = null, + Object? isProximityEnabled = null, + Object? latitude = freezed, + Object? longitude = freezed, + Object? maxRadius = freezed, }) { return _then(_$SearchHouseholdsSearchByHouseholdHeadEvent( searchText: null == searchText @@ -450,6 +669,22 @@ class __$$SearchHouseholdsSearchByHouseholdHeadEventCopyWithImpl<$Res> ? _value.projectId : projectId // ignore: cast_nullable_to_non_nullable as String, + isProximityEnabled: null == isProximityEnabled + ? _value.isProximityEnabled + : isProximityEnabled // ignore: cast_nullable_to_non_nullable + as bool, + latitude: freezed == latitude + ? _value.latitude + : latitude // ignore: cast_nullable_to_non_nullable + as double?, + longitude: freezed == longitude + ? _value.longitude + : longitude // ignore: cast_nullable_to_non_nullable + as double?, + maxRadius: freezed == maxRadius + ? _value.maxRadius + : maxRadius // ignore: cast_nullable_to_non_nullable + as double?, )); } } @@ -459,16 +694,29 @@ class __$$SearchHouseholdsSearchByHouseholdHeadEventCopyWithImpl<$Res> class _$SearchHouseholdsSearchByHouseholdHeadEvent implements SearchHouseholdsSearchByHouseholdHeadEvent { const _$SearchHouseholdsSearchByHouseholdHeadEvent( - {required this.searchText, required this.projectId}); + {required this.searchText, + required this.projectId, + required this.isProximityEnabled, + this.latitude, + this.longitude, + this.maxRadius}); @override final String searchText; @override final String projectId; + @override + final bool isProximityEnabled; + @override + final double? latitude; + @override + final double? longitude; + @override + final double? maxRadius; @override String toString() { - return 'SearchHouseholdsEvent.searchByHouseholdHead(searchText: $searchText, projectId: $projectId)'; + return 'SearchHouseholdsEvent.searchByHouseholdHead(searchText: $searchText, projectId: $projectId, isProximityEnabled: $isProximityEnabled, latitude: $latitude, longitude: $longitude, maxRadius: $maxRadius)'; } @override @@ -479,11 +727,20 @@ class _$SearchHouseholdsSearchByHouseholdHeadEvent (identical(other.searchText, searchText) || other.searchText == searchText) && (identical(other.projectId, projectId) || - other.projectId == projectId)); + other.projectId == projectId) && + (identical(other.isProximityEnabled, isProximityEnabled) || + other.isProximityEnabled == isProximityEnabled) && + (identical(other.latitude, latitude) || + other.latitude == latitude) && + (identical(other.longitude, longitude) || + other.longitude == longitude) && + (identical(other.maxRadius, maxRadius) || + other.maxRadius == maxRadius)); } @override - int get hashCode => Object.hash(runtimeType, searchText, projectId); + int get hashCode => Object.hash(runtimeType, searchText, projectId, + isProximityEnabled, latitude, longitude, maxRadius); @JsonKey(ignore: true) @override @@ -498,41 +755,89 @@ class _$SearchHouseholdsSearchByHouseholdHeadEvent @optionalTypeArgs TResult when({ required TResult Function() initialize, - required TResult Function(String projectId, HouseholdModel householdModel) + required TResult Function( + String projectId, + double? latitude, + double? longitude, + double? maxRadius, + bool isProximityEnabled, + HouseholdModel householdModel) searchByHousehold, - required TResult Function(String searchText, String projectId) + required TResult Function( + String searchText, + String projectId, + bool isProximityEnabled, + double? latitude, + double? longitude, + double? maxRadius) searchByHouseholdHead, + required TResult Function(double latitude, double longititude, + String projectId, double maxRadius) + searchByProximity, required TResult Function() clear, }) { - return searchByHouseholdHead(searchText, projectId); + return searchByHouseholdHead(searchText, projectId, isProximityEnabled, + latitude, longitude, maxRadius); } @override @optionalTypeArgs TResult? whenOrNull({ TResult? Function()? initialize, - TResult? Function(String projectId, HouseholdModel householdModel)? + TResult? Function( + String projectId, + double? latitude, + double? longitude, + double? maxRadius, + bool isProximityEnabled, + HouseholdModel householdModel)? searchByHousehold, - TResult? Function(String searchText, String projectId)? + TResult? Function( + String searchText, + String projectId, + bool isProximityEnabled, + double? latitude, + double? longitude, + double? maxRadius)? searchByHouseholdHead, + TResult? Function(double latitude, double longititude, String projectId, + double maxRadius)? + searchByProximity, TResult? Function()? clear, }) { - return searchByHouseholdHead?.call(searchText, projectId); + return searchByHouseholdHead?.call(searchText, projectId, + isProximityEnabled, latitude, longitude, maxRadius); } @override @optionalTypeArgs TResult maybeWhen({ TResult Function()? initialize, - TResult Function(String projectId, HouseholdModel householdModel)? + TResult Function( + String projectId, + double? latitude, + double? longitude, + double? maxRadius, + bool isProximityEnabled, + HouseholdModel householdModel)? searchByHousehold, - TResult Function(String searchText, String projectId)? + TResult Function( + String searchText, + String projectId, + bool isProximityEnabled, + double? latitude, + double? longitude, + double? maxRadius)? searchByHouseholdHead, + TResult Function(double latitude, double longititude, String projectId, + double maxRadius)? + searchByProximity, TResult Function()? clear, required TResult orElse(), }) { if (searchByHouseholdHead != null) { - return searchByHouseholdHead(searchText, projectId); + return searchByHouseholdHead(searchText, projectId, isProximityEnabled, + latitude, longitude, maxRadius); } return orElse(); } @@ -546,6 +851,8 @@ class _$SearchHouseholdsSearchByHouseholdHeadEvent searchByHousehold, required TResult Function(SearchHouseholdsSearchByHouseholdHeadEvent value) searchByHouseholdHead, + required TResult Function(SearchHouseholdsByProximityEvent value) + searchByProximity, required TResult Function(SearchHouseholdsClearEvent value) clear, }) { return searchByHouseholdHead(this); @@ -559,6 +866,8 @@ class _$SearchHouseholdsSearchByHouseholdHeadEvent searchByHousehold, TResult? Function(SearchHouseholdsSearchByHouseholdHeadEvent value)? searchByHouseholdHead, + TResult? Function(SearchHouseholdsByProximityEvent value)? + searchByProximity, TResult? Function(SearchHouseholdsClearEvent value)? clear, }) { return searchByHouseholdHead?.call(this); @@ -572,6 +881,7 @@ class _$SearchHouseholdsSearchByHouseholdHeadEvent searchByHousehold, TResult Function(SearchHouseholdsSearchByHouseholdHeadEvent value)? searchByHouseholdHead, + TResult Function(SearchHouseholdsByProximityEvent value)? searchByProximity, TResult Function(SearchHouseholdsClearEvent value)? clear, required TResult orElse(), }) { @@ -585,17 +895,285 @@ class _$SearchHouseholdsSearchByHouseholdHeadEvent abstract class SearchHouseholdsSearchByHouseholdHeadEvent implements SearchHouseholdsEvent { const factory SearchHouseholdsSearchByHouseholdHeadEvent( - {required final String searchText, required final String projectId}) = - _$SearchHouseholdsSearchByHouseholdHeadEvent; + {required final String searchText, + required final String projectId, + required final bool isProximityEnabled, + final double? latitude, + final double? longitude, + final double? maxRadius}) = _$SearchHouseholdsSearchByHouseholdHeadEvent; String get searchText; String get projectId; + bool get isProximityEnabled; + double? get latitude; + double? get longitude; + double? get maxRadius; @JsonKey(ignore: true) _$$SearchHouseholdsSearchByHouseholdHeadEventCopyWith< _$SearchHouseholdsSearchByHouseholdHeadEvent> get copyWith => throw _privateConstructorUsedError; } +/// @nodoc +abstract class _$$SearchHouseholdsByProximityEventCopyWith<$Res> { + factory _$$SearchHouseholdsByProximityEventCopyWith( + _$SearchHouseholdsByProximityEvent value, + $Res Function(_$SearchHouseholdsByProximityEvent) then) = + __$$SearchHouseholdsByProximityEventCopyWithImpl<$Res>; + @useResult + $Res call( + {double latitude, + double longititude, + String projectId, + double maxRadius}); +} + +/// @nodoc +class __$$SearchHouseholdsByProximityEventCopyWithImpl<$Res> + extends _$SearchHouseholdsEventCopyWithImpl<$Res, + _$SearchHouseholdsByProximityEvent> + implements _$$SearchHouseholdsByProximityEventCopyWith<$Res> { + __$$SearchHouseholdsByProximityEventCopyWithImpl( + _$SearchHouseholdsByProximityEvent _value, + $Res Function(_$SearchHouseholdsByProximityEvent) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? latitude = null, + Object? longititude = null, + Object? projectId = null, + Object? maxRadius = null, + }) { + return _then(_$SearchHouseholdsByProximityEvent( + latitude: null == latitude + ? _value.latitude + : latitude // ignore: cast_nullable_to_non_nullable + as double, + longititude: null == longititude + ? _value.longititude + : longititude // ignore: cast_nullable_to_non_nullable + as double, + projectId: null == projectId + ? _value.projectId + : projectId // ignore: cast_nullable_to_non_nullable + as String, + maxRadius: null == maxRadius + ? _value.maxRadius + : maxRadius // ignore: cast_nullable_to_non_nullable + as double, + )); + } +} + +/// @nodoc + +class _$SearchHouseholdsByProximityEvent + implements SearchHouseholdsByProximityEvent { + const _$SearchHouseholdsByProximityEvent( + {required this.latitude, + required this.longititude, + required this.projectId, + required this.maxRadius}); + + @override + final double latitude; + @override + final double longititude; + @override + final String projectId; + @override + final double maxRadius; + + @override + String toString() { + return 'SearchHouseholdsEvent.searchByProximity(latitude: $latitude, longititude: $longititude, projectId: $projectId, maxRadius: $maxRadius)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$SearchHouseholdsByProximityEvent && + (identical(other.latitude, latitude) || + other.latitude == latitude) && + (identical(other.longititude, longititude) || + other.longititude == longititude) && + (identical(other.projectId, projectId) || + other.projectId == projectId) && + (identical(other.maxRadius, maxRadius) || + other.maxRadius == maxRadius)); + } + + @override + int get hashCode => + Object.hash(runtimeType, latitude, longititude, projectId, maxRadius); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$SearchHouseholdsByProximityEventCopyWith< + _$SearchHouseholdsByProximityEvent> + get copyWith => __$$SearchHouseholdsByProximityEventCopyWithImpl< + _$SearchHouseholdsByProximityEvent>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function() initialize, + required TResult Function( + String projectId, + double? latitude, + double? longitude, + double? maxRadius, + bool isProximityEnabled, + HouseholdModel householdModel) + searchByHousehold, + required TResult Function( + String searchText, + String projectId, + bool isProximityEnabled, + double? latitude, + double? longitude, + double? maxRadius) + searchByHouseholdHead, + required TResult Function(double latitude, double longititude, + String projectId, double maxRadius) + searchByProximity, + required TResult Function() clear, + }) { + return searchByProximity(latitude, longititude, projectId, maxRadius); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? initialize, + TResult? Function( + String projectId, + double? latitude, + double? longitude, + double? maxRadius, + bool isProximityEnabled, + HouseholdModel householdModel)? + searchByHousehold, + TResult? Function( + String searchText, + String projectId, + bool isProximityEnabled, + double? latitude, + double? longitude, + double? maxRadius)? + searchByHouseholdHead, + TResult? Function(double latitude, double longititude, String projectId, + double maxRadius)? + searchByProximity, + TResult? Function()? clear, + }) { + return searchByProximity?.call(latitude, longititude, projectId, maxRadius); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? initialize, + TResult Function( + String projectId, + double? latitude, + double? longitude, + double? maxRadius, + bool isProximityEnabled, + HouseholdModel householdModel)? + searchByHousehold, + TResult Function( + String searchText, + String projectId, + bool isProximityEnabled, + double? latitude, + double? longitude, + double? maxRadius)? + searchByHouseholdHead, + TResult Function(double latitude, double longititude, String projectId, + double maxRadius)? + searchByProximity, + TResult Function()? clear, + required TResult orElse(), + }) { + if (searchByProximity != null) { + return searchByProximity(latitude, longititude, projectId, maxRadius); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(SearchHouseholdsInitializedEvent value) + initialize, + required TResult Function(SearchHouseholdsByHouseholdsEvent value) + searchByHousehold, + required TResult Function(SearchHouseholdsSearchByHouseholdHeadEvent value) + searchByHouseholdHead, + required TResult Function(SearchHouseholdsByProximityEvent value) + searchByProximity, + required TResult Function(SearchHouseholdsClearEvent value) clear, + }) { + return searchByProximity(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(SearchHouseholdsInitializedEvent value)? initialize, + TResult? Function(SearchHouseholdsByHouseholdsEvent value)? + searchByHousehold, + TResult? Function(SearchHouseholdsSearchByHouseholdHeadEvent value)? + searchByHouseholdHead, + TResult? Function(SearchHouseholdsByProximityEvent value)? + searchByProximity, + TResult? Function(SearchHouseholdsClearEvent value)? clear, + }) { + return searchByProximity?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(SearchHouseholdsInitializedEvent value)? initialize, + TResult Function(SearchHouseholdsByHouseholdsEvent value)? + searchByHousehold, + TResult Function(SearchHouseholdsSearchByHouseholdHeadEvent value)? + searchByHouseholdHead, + TResult Function(SearchHouseholdsByProximityEvent value)? searchByProximity, + TResult Function(SearchHouseholdsClearEvent value)? clear, + required TResult orElse(), + }) { + if (searchByProximity != null) { + return searchByProximity(this); + } + return orElse(); + } +} + +abstract class SearchHouseholdsByProximityEvent + implements SearchHouseholdsEvent { + const factory SearchHouseholdsByProximityEvent( + {required final double latitude, + required final double longititude, + required final String projectId, + required final double maxRadius}) = _$SearchHouseholdsByProximityEvent; + + double get latitude; + double get longititude; + String get projectId; + double get maxRadius; + @JsonKey(ignore: true) + _$$SearchHouseholdsByProximityEventCopyWith< + _$SearchHouseholdsByProximityEvent> + get copyWith => throw _privateConstructorUsedError; +} + /// @nodoc abstract class _$$SearchHouseholdsClearEventCopyWith<$Res> { factory _$$SearchHouseholdsClearEventCopyWith( @@ -639,10 +1217,25 @@ class _$SearchHouseholdsClearEvent implements SearchHouseholdsClearEvent { @optionalTypeArgs TResult when({ required TResult Function() initialize, - required TResult Function(String projectId, HouseholdModel householdModel) + required TResult Function( + String projectId, + double? latitude, + double? longitude, + double? maxRadius, + bool isProximityEnabled, + HouseholdModel householdModel) searchByHousehold, - required TResult Function(String searchText, String projectId) + required TResult Function( + String searchText, + String projectId, + bool isProximityEnabled, + double? latitude, + double? longitude, + double? maxRadius) searchByHouseholdHead, + required TResult Function(double latitude, double longititude, + String projectId, double maxRadius) + searchByProximity, required TResult Function() clear, }) { return clear(); @@ -652,10 +1245,25 @@ class _$SearchHouseholdsClearEvent implements SearchHouseholdsClearEvent { @optionalTypeArgs TResult? whenOrNull({ TResult? Function()? initialize, - TResult? Function(String projectId, HouseholdModel householdModel)? + TResult? Function( + String projectId, + double? latitude, + double? longitude, + double? maxRadius, + bool isProximityEnabled, + HouseholdModel householdModel)? searchByHousehold, - TResult? Function(String searchText, String projectId)? + TResult? Function( + String searchText, + String projectId, + bool isProximityEnabled, + double? latitude, + double? longitude, + double? maxRadius)? searchByHouseholdHead, + TResult? Function(double latitude, double longititude, String projectId, + double maxRadius)? + searchByProximity, TResult? Function()? clear, }) { return clear?.call(); @@ -665,10 +1273,25 @@ class _$SearchHouseholdsClearEvent implements SearchHouseholdsClearEvent { @optionalTypeArgs TResult maybeWhen({ TResult Function()? initialize, - TResult Function(String projectId, HouseholdModel householdModel)? + TResult Function( + String projectId, + double? latitude, + double? longitude, + double? maxRadius, + bool isProximityEnabled, + HouseholdModel householdModel)? searchByHousehold, - TResult Function(String searchText, String projectId)? + TResult Function( + String searchText, + String projectId, + bool isProximityEnabled, + double? latitude, + double? longitude, + double? maxRadius)? searchByHouseholdHead, + TResult Function(double latitude, double longititude, String projectId, + double maxRadius)? + searchByProximity, TResult Function()? clear, required TResult orElse(), }) { @@ -687,6 +1310,8 @@ class _$SearchHouseholdsClearEvent implements SearchHouseholdsClearEvent { searchByHousehold, required TResult Function(SearchHouseholdsSearchByHouseholdHeadEvent value) searchByHouseholdHead, + required TResult Function(SearchHouseholdsByProximityEvent value) + searchByProximity, required TResult Function(SearchHouseholdsClearEvent value) clear, }) { return clear(this); @@ -700,6 +1325,8 @@ class _$SearchHouseholdsClearEvent implements SearchHouseholdsClearEvent { searchByHousehold, TResult? Function(SearchHouseholdsSearchByHouseholdHeadEvent value)? searchByHouseholdHead, + TResult? Function(SearchHouseholdsByProximityEvent value)? + searchByProximity, TResult? Function(SearchHouseholdsClearEvent value)? clear, }) { return clear?.call(this); @@ -713,6 +1340,7 @@ class _$SearchHouseholdsClearEvent implements SearchHouseholdsClearEvent { searchByHousehold, TResult Function(SearchHouseholdsSearchByHouseholdHeadEvent value)? searchByHouseholdHead, + TResult Function(SearchHouseholdsByProximityEvent value)? searchByProximity, TResult Function(SearchHouseholdsClearEvent value)? clear, required TResult orElse(), }) { @@ -960,6 +1588,7 @@ mixin _$HouseholdMemberWrapper { List get members => throw _privateConstructorUsedError; List get projectBeneficiaries => throw _privateConstructorUsedError; + double? get distance => throw _privateConstructorUsedError; List? get tasks => throw _privateConstructorUsedError; @JsonKey(ignore: true) @@ -978,6 +1607,7 @@ abstract class $HouseholdMemberWrapperCopyWith<$Res> { IndividualModel headOfHousehold, List members, List projectBeneficiaries, + double? distance, List? tasks}); } @@ -999,6 +1629,7 @@ class _$HouseholdMemberWrapperCopyWithImpl<$Res, Object? headOfHousehold = null, Object? members = null, Object? projectBeneficiaries = null, + Object? distance = freezed, Object? tasks = freezed, }) { return _then(_value.copyWith( @@ -1018,6 +1649,10 @@ class _$HouseholdMemberWrapperCopyWithImpl<$Res, ? _value.projectBeneficiaries : projectBeneficiaries // ignore: cast_nullable_to_non_nullable as List, + distance: freezed == distance + ? _value.distance + : distance // ignore: cast_nullable_to_non_nullable + as double?, tasks: freezed == tasks ? _value.tasks : tasks // ignore: cast_nullable_to_non_nullable @@ -1039,6 +1674,7 @@ abstract class _$$_HouseholdMemberWrapperCopyWith<$Res> IndividualModel headOfHousehold, List members, List projectBeneficiaries, + double? distance, List? tasks}); } @@ -1058,6 +1694,7 @@ class __$$_HouseholdMemberWrapperCopyWithImpl<$Res> Object? headOfHousehold = null, Object? members = null, Object? projectBeneficiaries = null, + Object? distance = freezed, Object? tasks = freezed, }) { return _then(_$_HouseholdMemberWrapper( @@ -1077,6 +1714,10 @@ class __$$_HouseholdMemberWrapperCopyWithImpl<$Res> ? _value._projectBeneficiaries : projectBeneficiaries // ignore: cast_nullable_to_non_nullable as List, + distance: freezed == distance + ? _value.distance + : distance // ignore: cast_nullable_to_non_nullable + as double?, tasks: freezed == tasks ? _value._tasks : tasks // ignore: cast_nullable_to_non_nullable @@ -1093,6 +1734,7 @@ class _$_HouseholdMemberWrapper implements _HouseholdMemberWrapper { required this.headOfHousehold, required final List members, required final List projectBeneficiaries, + this.distance, final List? tasks}) : _members = members, _projectBeneficiaries = projectBeneficiaries, @@ -1116,6 +1758,8 @@ class _$_HouseholdMemberWrapper implements _HouseholdMemberWrapper { return EqualUnmodifiableListView(_projectBeneficiaries); } + @override + final double? distance; final List? _tasks; @override List? get tasks { @@ -1127,7 +1771,7 @@ class _$_HouseholdMemberWrapper implements _HouseholdMemberWrapper { @override String toString() { - return 'HouseholdMemberWrapper(household: $household, headOfHousehold: $headOfHousehold, members: $members, projectBeneficiaries: $projectBeneficiaries, tasks: $tasks)'; + return 'HouseholdMemberWrapper(household: $household, headOfHousehold: $headOfHousehold, members: $members, projectBeneficiaries: $projectBeneficiaries, distance: $distance, tasks: $tasks)'; } @override @@ -1142,6 +1786,8 @@ class _$_HouseholdMemberWrapper implements _HouseholdMemberWrapper { const DeepCollectionEquality().equals(other._members, _members) && const DeepCollectionEquality() .equals(other._projectBeneficiaries, _projectBeneficiaries) && + (identical(other.distance, distance) || + other.distance == distance) && const DeepCollectionEquality().equals(other._tasks, _tasks)); } @@ -1152,6 +1798,7 @@ class _$_HouseholdMemberWrapper implements _HouseholdMemberWrapper { headOfHousehold, const DeepCollectionEquality().hash(_members), const DeepCollectionEquality().hash(_projectBeneficiaries), + distance, const DeepCollectionEquality().hash(_tasks)); @JsonKey(ignore: true) @@ -1168,6 +1815,7 @@ abstract class _HouseholdMemberWrapper implements HouseholdMemberWrapper { required final IndividualModel headOfHousehold, required final List members, required final List projectBeneficiaries, + final double? distance, final List? tasks}) = _$_HouseholdMemberWrapper; @override @@ -1179,6 +1827,8 @@ abstract class _HouseholdMemberWrapper implements HouseholdMemberWrapper { @override List get projectBeneficiaries; @override + double? get distance; + @override List? get tasks; @override @JsonKey(ignore: true) diff --git a/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/app_configuration.dart b/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/app_configuration.dart index ec73de63c..ee14af1a0 100644 --- a/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/app_configuration.dart +++ b/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/app_configuration.dart @@ -15,6 +15,9 @@ class AppConfiguration { @Name("SYNC_METHOD") late String? syncMethod; + @Name("PROXIMITY_SEARCH_RANGE") + late double? maxRadius; + @Name("SYNC_TRIGGER") late String? syncTrigger; diff --git a/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/app_configuration.g.dart b/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/app_configuration.g.dart index 93c86551f..22ea7e1a8 100644 --- a/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/app_configuration.g.dart +++ b/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/app_configuration.g.dart @@ -105,23 +105,28 @@ const AppConfigurationSchema = CollectionSchema( name: r'PERSISTENCE_MODE', type: IsarType.string, ), - r'SYNC_METHOD': PropertySchema( + r'PROXIMITY_SEARCH_RANGE': PropertySchema( id: 15, + name: r'PROXIMITY_SEARCH_RANGE', + type: IsarType.double, + ), + r'SYNC_METHOD': PropertySchema( + id: 16, name: r'SYNC_METHOD', type: IsarType.string, ), r'SYNC_TRIGGER': PropertySchema( - id: 16, + id: 17, name: r'SYNC_TRIGGER', type: IsarType.string, ), r'TENANT_ID': PropertySchema( - id: 17, + id: 18, name: r'TENANT_ID', type: IsarType.string, ), r'TRANSPORT_TYPES': PropertySchema( - id: 18, + id: 19, name: r'TRANSPORT_TYPES', type: IsarType.objectList, target: r'TransportTypes', @@ -462,11 +467,12 @@ void _appConfigurationSerialize( ); writer.writeString(offsets[13], object.networkDetection); writer.writeString(offsets[14], object.persistenceMode); - writer.writeString(offsets[15], object.syncMethod); - writer.writeString(offsets[16], object.syncTrigger); - writer.writeString(offsets[17], object.tenantId); + writer.writeDouble(offsets[15], object.maxRadius); + writer.writeString(offsets[16], object.syncMethod); + writer.writeString(offsets[17], object.syncTrigger); + writer.writeString(offsets[18], object.tenantId); writer.writeObjectList( - offsets[18], + offsets[19], allOffsets, TransportTypesSchema.serialize, object.transportTypes, @@ -560,11 +566,12 @@ AppConfiguration _appConfigurationDeserialize( ); object.networkDetection = reader.readStringOrNull(offsets[13]); object.persistenceMode = reader.readStringOrNull(offsets[14]); - object.syncMethod = reader.readStringOrNull(offsets[15]); - object.syncTrigger = reader.readStringOrNull(offsets[16]); - object.tenantId = reader.readStringOrNull(offsets[17]); + object.maxRadius = reader.readDoubleOrNull(offsets[15]); + object.syncMethod = reader.readStringOrNull(offsets[16]); + object.syncTrigger = reader.readStringOrNull(offsets[17]); + object.tenantId = reader.readStringOrNull(offsets[18]); object.transportTypes = reader.readObjectList( - offsets[18], + offsets[19], TransportTypesSchema.deserialize, allOffsets, TransportTypes(), @@ -673,12 +680,14 @@ P _appConfigurationDeserializeProp

( case 14: return (reader.readStringOrNull(offset)) as P; case 15: - return (reader.readStringOrNull(offset)) as P; + return (reader.readDoubleOrNull(offset)) as P; case 16: return (reader.readStringOrNull(offset)) as P; case 17: return (reader.readStringOrNull(offset)) as P; case 18: + return (reader.readStringOrNull(offset)) as P; + case 19: return (reader.readObjectList( offset, TransportTypesSchema.deserialize, @@ -2216,6 +2225,90 @@ extension AppConfigurationQueryFilter }); } + QueryBuilder + maxRadiusIsNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNull( + property: r'PROXIMITY_SEARCH_RANGE', + )); + }); + } + + QueryBuilder + maxRadiusIsNotNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNotNull( + property: r'PROXIMITY_SEARCH_RANGE', + )); + }); + } + + QueryBuilder + maxRadiusEqualTo( + double? value, { + double epsilon = Query.epsilon, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'PROXIMITY_SEARCH_RANGE', + value: value, + epsilon: epsilon, + )); + }); + } + + QueryBuilder + maxRadiusGreaterThan( + double? value, { + bool include = false, + double epsilon = Query.epsilon, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'PROXIMITY_SEARCH_RANGE', + value: value, + epsilon: epsilon, + )); + }); + } + + QueryBuilder + maxRadiusLessThan( + double? value, { + bool include = false, + double epsilon = Query.epsilon, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'PROXIMITY_SEARCH_RANGE', + value: value, + epsilon: epsilon, + )); + }); + } + + QueryBuilder + maxRadiusBetween( + double? lower, + double? upper, { + bool includeLower = true, + bool includeUpper = true, + double epsilon = Query.epsilon, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'PROXIMITY_SEARCH_RANGE', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + epsilon: epsilon, + )); + }); + } + QueryBuilder syncMethodIsNull() { return QueryBuilder.apply(this, (query) { @@ -2978,6 +3071,20 @@ extension AppConfigurationQuerySortBy }); } + QueryBuilder + sortByMaxRadius() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'PROXIMITY_SEARCH_RANGE', Sort.asc); + }); + } + + QueryBuilder + sortByMaxRadiusDesc() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'PROXIMITY_SEARCH_RANGE', Sort.desc); + }); + } + QueryBuilder sortBySyncMethod() { return QueryBuilder.apply(this, (query) { @@ -3051,6 +3158,20 @@ extension AppConfigurationQuerySortThenBy }); } + QueryBuilder + thenByMaxRadius() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'PROXIMITY_SEARCH_RANGE', Sort.asc); + }); + } + + QueryBuilder + thenByMaxRadiusDesc() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'PROXIMITY_SEARCH_RANGE', Sort.desc); + }); + } + QueryBuilder thenBySyncMethod() { return QueryBuilder.apply(this, (query) { @@ -3125,6 +3246,13 @@ extension AppConfigurationQueryWhereDistinct }); } + QueryBuilder + distinctByMaxRadius() { + return QueryBuilder.apply(this, (query) { + return query.addDistinctBy(r'PROXIMITY_SEARCH_RANGE'); + }); + } + QueryBuilder distinctBySyncMethod({bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { @@ -3260,6 +3388,13 @@ extension AppConfigurationQueryProperty }); } + QueryBuilder + maxRadiusProperty() { + return QueryBuilder.apply(this, (query) { + return query.addPropertyName(r'PROXIMITY_SEARCH_RANGE'); + }); + } + QueryBuilder syncMethodProperty() { return QueryBuilder.apply(this, (query) { diff --git a/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/oplog.g.dart b/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/oplog.g.dart index 0025108d9..e175b463e 100644 --- a/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/oplog.g.dart +++ b/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/oplog.g.dart @@ -251,6 +251,7 @@ P _opLogDeserializeProp

( const _OpLogentityTypeEnumValueMap = { r'user': r'user', r'facility': r'facility', + r'address': r'address', r'household': r'household', r'householdMember': r'householdMember', r'individual': r'individual', @@ -277,6 +278,7 @@ const _OpLogentityTypeEnumValueMap = { const _OpLogentityTypeValueEnumMap = { r'user': DataModelType.user, r'facility': DataModelType.facility, + r'address': DataModelType.address, r'household': DataModelType.household, r'householdMember': DataModelType.householdMember, r'individual': DataModelType.individual, diff --git a/apps/health_campaign_field_worker_app/lib/data/local_store/sql_store/sql_store.g.dart b/apps/health_campaign_field_worker_app/lib/data/local_store/sql_store/sql_store.g.dart index 02dab9400..2d4aba219 100644 --- a/apps/health_campaign_field_worker_app/lib/data/local_store/sql_store/sql_store.g.dart +++ b/apps/health_campaign_field_worker_app/lib/data/local_store/sql_store/sql_store.g.dart @@ -4362,7 +4362,6 @@ class HouseholdData extends DataClass implements Insertable { final int? memberCount; final double? latitude; final double? longitude; - final double? maxRadius; final String? auditCreatedBy; final int? auditCreatedTime; final int? clientCreatedTime; @@ -4381,7 +4380,6 @@ class HouseholdData extends DataClass implements Insertable { this.memberCount, this.latitude, this.longitude, - this.maxRadius, this.auditCreatedBy, this.auditCreatedTime, this.clientCreatedTime, @@ -4406,8 +4404,6 @@ class HouseholdData extends DataClass implements Insertable { .mapFromDatabaseResponse(data['${effectivePrefix}latitude']), longitude: const RealType() .mapFromDatabaseResponse(data['${effectivePrefix}longitude']), - maxRadius: const RealType() - .mapFromDatabaseResponse(data['${effectivePrefix}max_radius']), auditCreatedBy: const StringType() .mapFromDatabaseResponse(data['${effectivePrefix}audit_created_by']), auditCreatedTime: const IntType().mapFromDatabaseResponse( @@ -4451,9 +4447,6 @@ class HouseholdData extends DataClass implements Insertable { if (!nullToAbsent || longitude != null) { map['longitude'] = Variable(longitude); } - if (!nullToAbsent || maxRadius != null) { - map['max_radius'] = Variable(maxRadius); - } if (!nullToAbsent || auditCreatedBy != null) { map['audit_created_by'] = Variable(auditCreatedBy); } @@ -4506,9 +4499,6 @@ class HouseholdData extends DataClass implements Insertable { longitude: longitude == null && nullToAbsent ? const Value.absent() : Value(longitude), - maxRadius: maxRadius == null && nullToAbsent - ? const Value.absent() - : Value(maxRadius), auditCreatedBy: auditCreatedBy == null && nullToAbsent ? const Value.absent() : Value(auditCreatedBy), @@ -4557,7 +4547,6 @@ class HouseholdData extends DataClass implements Insertable { memberCount: serializer.fromJson(json['memberCount']), latitude: serializer.fromJson(json['latitude']), longitude: serializer.fromJson(json['longitude']), - maxRadius: serializer.fromJson(json['maxRadius']), auditCreatedBy: serializer.fromJson(json['auditCreatedBy']), auditCreatedTime: serializer.fromJson(json['auditCreatedTime']), clientCreatedTime: serializer.fromJson(json['clientCreatedTime']), @@ -4581,7 +4570,6 @@ class HouseholdData extends DataClass implements Insertable { 'memberCount': serializer.toJson(memberCount), 'latitude': serializer.toJson(latitude), 'longitude': serializer.toJson(longitude), - 'maxRadius': serializer.toJson(maxRadius), 'auditCreatedBy': serializer.toJson(auditCreatedBy), 'auditCreatedTime': serializer.toJson(auditCreatedTime), 'clientCreatedTime': serializer.toJson(clientCreatedTime), @@ -4603,7 +4591,6 @@ class HouseholdData extends DataClass implements Insertable { int? memberCount, double? latitude, double? longitude, - double? maxRadius, String? auditCreatedBy, int? auditCreatedTime, int? clientCreatedTime, @@ -4622,7 +4609,6 @@ class HouseholdData extends DataClass implements Insertable { memberCount: memberCount ?? this.memberCount, latitude: latitude ?? this.latitude, longitude: longitude ?? this.longitude, - maxRadius: maxRadius ?? this.maxRadius, auditCreatedBy: auditCreatedBy ?? this.auditCreatedBy, auditCreatedTime: auditCreatedTime ?? this.auditCreatedTime, clientCreatedTime: clientCreatedTime ?? this.clientCreatedTime, @@ -4644,7 +4630,6 @@ class HouseholdData extends DataClass implements Insertable { ..write('memberCount: $memberCount, ') ..write('latitude: $latitude, ') ..write('longitude: $longitude, ') - ..write('maxRadius: $maxRadius, ') ..write('auditCreatedBy: $auditCreatedBy, ') ..write('auditCreatedTime: $auditCreatedTime, ') ..write('clientCreatedTime: $clientCreatedTime, ') @@ -4668,7 +4653,6 @@ class HouseholdData extends DataClass implements Insertable { memberCount, latitude, longitude, - maxRadius, auditCreatedBy, auditCreatedTime, clientCreatedTime, @@ -4690,7 +4674,6 @@ class HouseholdData extends DataClass implements Insertable { other.memberCount == this.memberCount && other.latitude == this.latitude && other.longitude == this.longitude && - other.maxRadius == this.maxRadius && other.auditCreatedBy == this.auditCreatedBy && other.auditCreatedTime == this.auditCreatedTime && other.clientCreatedTime == this.clientCreatedTime && @@ -4711,7 +4694,6 @@ class HouseholdCompanion extends UpdateCompanion { final Value memberCount; final Value latitude; final Value longitude; - final Value maxRadius; final Value auditCreatedBy; final Value auditCreatedTime; final Value clientCreatedTime; @@ -4730,7 +4712,6 @@ class HouseholdCompanion extends UpdateCompanion { this.memberCount = const Value.absent(), this.latitude = const Value.absent(), this.longitude = const Value.absent(), - this.maxRadius = const Value.absent(), this.auditCreatedBy = const Value.absent(), this.auditCreatedTime = const Value.absent(), this.clientCreatedTime = const Value.absent(), @@ -4750,7 +4731,6 @@ class HouseholdCompanion extends UpdateCompanion { this.memberCount = const Value.absent(), this.latitude = const Value.absent(), this.longitude = const Value.absent(), - this.maxRadius = const Value.absent(), this.auditCreatedBy = const Value.absent(), this.auditCreatedTime = const Value.absent(), this.clientCreatedTime = const Value.absent(), @@ -4770,7 +4750,6 @@ class HouseholdCompanion extends UpdateCompanion { Expression? memberCount, Expression? latitude, Expression? longitude, - Expression? maxRadius, Expression? auditCreatedBy, Expression? auditCreatedTime, Expression? clientCreatedTime, @@ -4790,7 +4769,6 @@ class HouseholdCompanion extends UpdateCompanion { if (memberCount != null) 'member_count': memberCount, if (latitude != null) 'latitude': latitude, if (longitude != null) 'longitude': longitude, - if (maxRadius != null) 'max_radius': maxRadius, if (auditCreatedBy != null) 'audit_created_by': auditCreatedBy, if (auditCreatedTime != null) 'audit_created_time': auditCreatedTime, if (clientCreatedTime != null) 'client_created_time': clientCreatedTime, @@ -4813,7 +4791,6 @@ class HouseholdCompanion extends UpdateCompanion { Value? memberCount, Value? latitude, Value? longitude, - Value? maxRadius, Value? auditCreatedBy, Value? auditCreatedTime, Value? clientCreatedTime, @@ -4832,7 +4809,6 @@ class HouseholdCompanion extends UpdateCompanion { memberCount: memberCount ?? this.memberCount, latitude: latitude ?? this.latitude, longitude: longitude ?? this.longitude, - maxRadius: maxRadius ?? this.maxRadius, auditCreatedBy: auditCreatedBy ?? this.auditCreatedBy, auditCreatedTime: auditCreatedTime ?? this.auditCreatedTime, clientCreatedTime: clientCreatedTime ?? this.clientCreatedTime, @@ -4864,9 +4840,6 @@ class HouseholdCompanion extends UpdateCompanion { if (longitude.present) { map['longitude'] = Variable(longitude.value); } - if (maxRadius.present) { - map['max_radius'] = Variable(maxRadius.value); - } if (auditCreatedBy.present) { map['audit_created_by'] = Variable(auditCreatedBy.value); } @@ -4916,7 +4889,6 @@ class HouseholdCompanion extends UpdateCompanion { ..write('memberCount: $memberCount, ') ..write('latitude: $latitude, ') ..write('longitude: $longitude, ') - ..write('maxRadius: $maxRadius, ') ..write('auditCreatedBy: $auditCreatedBy, ') ..write('auditCreatedTime: $auditCreatedTime, ') ..write('clientCreatedTime: $clientCreatedTime, ') @@ -4962,11 +4934,6 @@ class $HouseholdTable extends Household late final GeneratedColumn longitude = GeneratedColumn( 'longitude', aliasedName, true, type: const RealType(), requiredDuringInsert: false); - final VerificationMeta _maxRadiusMeta = const VerificationMeta('maxRadius'); - @override - late final GeneratedColumn maxRadius = GeneratedColumn( - 'max_radius', aliasedName, true, - type: const RealType(), requiredDuringInsert: false); final VerificationMeta _auditCreatedByMeta = const VerificationMeta('auditCreatedBy'); @override @@ -5051,7 +5018,6 @@ class $HouseholdTable extends Household memberCount, latitude, longitude, - maxRadius, auditCreatedBy, auditCreatedTime, clientCreatedTime, @@ -5092,10 +5058,6 @@ class $HouseholdTable extends Household context.handle(_longitudeMeta, longitude.isAcceptableOrUnknown(data['longitude']!, _longitudeMeta)); } - if (data.containsKey('max_radius')) { - context.handle(_maxRadiusMeta, - maxRadius.isAcceptableOrUnknown(data['max_radius']!, _maxRadiusMeta)); - } if (data.containsKey('audit_created_by')) { context.handle( _auditCreatedByMeta, diff --git a/apps/health_campaign_field_worker_app/lib/data/local_store/sql_store/tables/household.dart b/apps/health_campaign_field_worker_app/lib/data/local_store/sql_store/tables/household.dart index d75fbbcf8..4eb7f7748 100644 --- a/apps/health_campaign_field_worker_app/lib/data/local_store/sql_store/tables/household.dart +++ b/apps/health_campaign_field_worker_app/lib/data/local_store/sql_store/tables/household.dart @@ -8,7 +8,6 @@ class Household extends Table { IntColumn get memberCount => integer().nullable()(); RealColumn get latitude => real().nullable()(); RealColumn get longitude => real().nullable()(); - RealColumn get maxRadius => real().nullable()(); TextColumn get auditCreatedBy => text().nullable()(); IntColumn get auditCreatedTime => integer().nullable()(); IntColumn get clientCreatedTime => integer().nullable()(); diff --git a/apps/health_campaign_field_worker_app/lib/data/repositories/local/address.dart b/apps/health_campaign_field_worker_app/lib/data/repositories/local/address.dart new file mode 100644 index 000000000..4f053fa0c --- /dev/null +++ b/apps/health_campaign_field_worker_app/lib/data/repositories/local/address.dart @@ -0,0 +1,106 @@ +import 'dart:async'; + +import 'package:drift/drift.dart'; +import 'dart:math' as math; +import '../../../models/data_model.dart'; +import '../../../utils/utils.dart'; +import '../../local_store/sql_store/sql_store.dart'; +import '../oplog/oplog.dart'; + +class AddressLocalRepository { + final LocalSqlDataStore sql; + final OpLogManager opLogManager; + + AddressLocalRepository(this.sql, this.opLogManager); + + FutureOr> searchHouseHoldbyAddress( + AddressSearchModel query, [ + String? userId, + ]) async { + final selectQuery = sql.select(sql.address).join( + [ + leftOuterJoin( + sql.household, + sql.household.clientReferenceId.equalsExp( + sql.address.relatedClientReferenceId, + ), + ), + ], + ); + + (selectQuery + ..where(buildAnd([ + sql.address.relatedClientReferenceId.isNotNull(), + sql.household.clientReferenceId.isNotNull(), + if (query.latitude != null && + query.longitude != null && + query.maxRadius != null) + CustomExpression(''' + (6371393 * acos( + cos(${query.latitude! * math.pi / 180.0}) * cos((address.latitude * ${math.pi / 180.0})) + * cos((address.longitude * ${math.pi / 180.0}) - ${query.longitude! * math.pi / 180.0}) + + sin(${query.latitude! * math.pi / 180.0}) * sin((address.latitude * ${math.pi / 180.0})) + )) <= ${query.maxRadius!} + '''), + if (query.latitude != null && + query.longitude != null && + query.maxRadius != null) + sql.address.longitude.isNotNull(), + sql.address.latitude.isNotNull(), + ]))); + final results = await selectQuery.get(); + + return results + .map((e) { + final household = e.readTableOrNull(sql.household); + final address = e.readTableOrNull(sql.address); + + return HouseholdModel( + id: household?.id, + tenantId: household?.tenantId, + clientReferenceId: household!.clientReferenceId, + memberCount: household.memberCount, + rowVersion: household.rowVersion, + isDeleted: household.isDeleted, + auditDetails: AuditDetails( + createdBy: household.auditCreatedBy!, + createdTime: household.auditCreatedTime!, + lastModifiedBy: household.auditModifiedBy, + lastModifiedTime: household.auditModifiedTime, + ), + address: address == null + ? null + : AddressModel( + id: address.id, + relatedClientReferenceId: address.relatedClientReferenceId, + tenantId: address.tenantId, + doorNo: address.doorNo, + latitude: address.latitude, + longitude: address.longitude, + landmark: address.landmark, + locationAccuracy: address.locationAccuracy, + addressLine1: address.addressLine1, + addressLine2: address.addressLine2, + city: address.city, + pincode: address.pincode, + locality: address.localityBoundaryCode != null + ? LocalityModel( + code: address.localityBoundaryCode!, + name: address.localityBoundaryName, + ) + : null, + type: address.type, + rowVersion: address.rowVersion, + auditDetails: AuditDetails( + createdBy: household.auditCreatedBy!, + createdTime: household.auditCreatedTime!, + lastModifiedBy: household.auditModifiedBy, + lastModifiedTime: household?.auditModifiedTime, + ), + ), + ); + }) + .where((element) => element.isDeleted != true) + .toList(); + } +} diff --git a/apps/health_campaign_field_worker_app/lib/data/repositories/local/household.dart b/apps/health_campaign_field_worker_app/lib/data/repositories/local/household.dart index 73e470859..e8b6f4744 100644 --- a/apps/health_campaign_field_worker_app/lib/data/repositories/local/household.dart +++ b/apps/health_campaign_field_worker_app/lib/data/repositories/local/household.dart @@ -1,5 +1,6 @@ import 'dart:async'; import 'dart:math'; +import 'dart:math' as math; import 'package:drift/drift.dart'; import '../../../models/data_model.dart'; import '../../../utils/utils.dart'; @@ -24,29 +25,41 @@ class HouseholdLocalRepository ), ], ); - final results = await (selectQuery - ..where( - buildAnd( - [ - if (query.clientReferenceId != null) - sql.household.clientReferenceId - .isIn(query.clientReferenceId!), - if (query.id != null) - sql.household.id.equals( - query.id, - ), - if (query.tenantId != null) - sql.household.tenantId.equals( - query.tenantId, - ), - if (userId != null) - sql.household.auditCreatedBy.equals( - userId, - ), - ], - ), - )) - .get(); + + (selectQuery + ..where( + buildAnd( + [ + if (query.clientReferenceId != null) + sql.household.clientReferenceId.isIn(query.clientReferenceId!), + if (query.id != null) + sql.household.id.equals( + query.id, + ), + if (query.tenantId != null) + sql.household.tenantId.equals( + query.tenantId, + ), + if (userId != null) + sql.household.auditCreatedBy.equals( + userId, + ), + if (query.latitude != null && + query.longitude != null && + query.maxRadius != null && + query.isProximityEnabled == true) + CustomExpression(''' + (6371393 * acos( + cos(${query.latitude! * math.pi / 180.0}) * cos((address.latitude * ${math.pi / 180.0})) + * cos((address.longitude * ${math.pi / 180.0}) - ${query.longitude! * math.pi / 180.0}) + + sin(${query.latitude! * math.pi / 180.0}) * sin((address.latitude * ${math.pi / 180.0})) + )) <= ${query.maxRadius!} + '''), + ], + ), + )); + + final results = await selectQuery.get(); return results .map((e) { diff --git a/apps/health_campaign_field_worker_app/lib/data/repositories/oplog/oplog.dart b/apps/health_campaign_field_worker_app/lib/data/repositories/oplog/oplog.dart index 95ff78c11..aa4c37d8c 100644 --- a/apps/health_campaign_field_worker_app/lib/data/repositories/oplog/oplog.dart +++ b/apps/health_campaign_field_worker_app/lib/data/repositories/oplog/oplog.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:math'; import 'package:collection/collection.dart'; import 'package:isar/isar.dart'; @@ -273,6 +274,36 @@ class IndividualOpLogManager extends OpLogManager { int? getRowVersion(IndividualModel entity) => entity.rowVersion; } +class AddressOpLogManager extends OpLogManager { + AddressOpLogManager(super.isar); + + @override + AddressModel applyServerGeneratedIdToEntity( + AddressModel entity, + String serverGeneratedId, + int rowVersion, + ) { + return entity; + } + + @override + String getClientReferenceId( + AddressModel entity, + ) { + return entity.relatedClientReferenceId!; + } + + @override + int? getRowVersion(AddressModel entity) { + return entity.rowVersion; + } + + @override + String? getServerGeneratedId(AddressModel entity) { + return entity.relatedClientReferenceId; + } +} + class HouseholdOpLogManager extends OpLogManager { HouseholdOpLogManager(super.isar); diff --git a/apps/health_campaign_field_worker_app/lib/data/repositories/remote/mdms.dart b/apps/health_campaign_field_worker_app/lib/data/repositories/remote/mdms.dart index c34fcbbb5..15279773d 100644 --- a/apps/health_campaign_field_worker_app/lib/data/repositories/remote/mdms.dart +++ b/apps/health_campaign_field_worker_app/lib/data/repositories/remote/mdms.dart @@ -138,6 +138,7 @@ class MdmsRepository { ..syncMethod = element.syncMethod ..syncTrigger = element.syncTrigger ..tenantId = element.tenantId + ..maxRadius = element.maxRadius ..backgroundServiceConfig = backgroundServiceConfig; final List languageList = element.languages.map((element) { diff --git a/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.dart b/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.dart index fddc97782..ca489e2f1 100644 --- a/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.dart +++ b/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.dart @@ -90,6 +90,7 @@ class AppConfig with _$AppConfig { @JsonKey(name: 'SYNC_TRIGGER') required String syncTrigger, @JsonKey(name: 'LANGUAGES') required List languages, @JsonKey(name: 'TENANT_ID') final String? tenantId, + @JsonKey(name: 'PROXIMITY_SEARCH_RANGE') final double? maxRadius, @JsonKey(name: 'HOUSEHOLD_DELETION_REASON_OPTIONS') required List householdDeletionReasonOptions, @JsonKey(name: 'BANDWIDTH_BATCH_SIZE') diff --git a/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.freezed.dart b/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.freezed.dart index 64a28936e..dda5c56d7 100644 --- a/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.freezed.dart +++ b/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.freezed.dart @@ -1202,6 +1202,8 @@ mixin _$AppConfig { List get languages => throw _privateConstructorUsedError; @JsonKey(name: 'TENANT_ID') String? get tenantId => throw _privateConstructorUsedError; + @JsonKey(name: 'PROXIMITY_SEARCH_RANGE') + double? get maxRadius => throw _privateConstructorUsedError; @JsonKey(name: 'HOUSEHOLD_DELETION_REASON_OPTIONS') List get householdDeletionReasonOptions => throw _privateConstructorUsedError; @@ -1255,6 +1257,8 @@ abstract class $AppConfigCopyWith<$Res> { List languages, @JsonKey(name: 'TENANT_ID') String? tenantId, + @JsonKey(name: 'PROXIMITY_SEARCH_RANGE') + double? maxRadius, @JsonKey(name: 'HOUSEHOLD_DELETION_REASON_OPTIONS') List householdDeletionReasonOptions, @JsonKey(name: 'BANDWIDTH_BATCH_SIZE') @@ -1301,6 +1305,7 @@ class _$AppConfigCopyWithImpl<$Res, $Val extends AppConfig> Object? syncTrigger = null, Object? languages = null, Object? tenantId = freezed, + Object? maxRadius = freezed, Object? householdDeletionReasonOptions = null, Object? bandWidthBatchSize = null, Object? backgroundServiceConfig = freezed, @@ -1338,6 +1343,10 @@ class _$AppConfigCopyWithImpl<$Res, $Val extends AppConfig> ? _value.tenantId : tenantId // ignore: cast_nullable_to_non_nullable as String?, + maxRadius: freezed == maxRadius + ? _value.maxRadius + : maxRadius // ignore: cast_nullable_to_non_nullable + as double?, householdDeletionReasonOptions: null == householdDeletionReasonOptions ? _value.householdDeletionReasonOptions : householdDeletionReasonOptions // ignore: cast_nullable_to_non_nullable @@ -1428,6 +1437,8 @@ abstract class _$$_AppConfigCopyWith<$Res> implements $AppConfigCopyWith<$Res> { List languages, @JsonKey(name: 'TENANT_ID') String? tenantId, + @JsonKey(name: 'PROXIMITY_SEARCH_RANGE') + double? maxRadius, @JsonKey(name: 'HOUSEHOLD_DELETION_REASON_OPTIONS') List householdDeletionReasonOptions, @JsonKey(name: 'BANDWIDTH_BATCH_SIZE') @@ -1474,6 +1485,7 @@ class __$$_AppConfigCopyWithImpl<$Res> Object? syncTrigger = null, Object? languages = null, Object? tenantId = freezed, + Object? maxRadius = freezed, Object? householdDeletionReasonOptions = null, Object? bandWidthBatchSize = null, Object? backgroundServiceConfig = freezed, @@ -1511,6 +1523,10 @@ class __$$_AppConfigCopyWithImpl<$Res> ? _value.tenantId : tenantId // ignore: cast_nullable_to_non_nullable as String?, + maxRadius: freezed == maxRadius + ? _value.maxRadius + : maxRadius // ignore: cast_nullable_to_non_nullable + as double?, householdDeletionReasonOptions: null == householdDeletionReasonOptions ? _value._householdDeletionReasonOptions : householdDeletionReasonOptions // ignore: cast_nullable_to_non_nullable @@ -1576,6 +1592,8 @@ class _$_AppConfig implements _AppConfig { required final List languages, @JsonKey(name: 'TENANT_ID') this.tenantId, + @JsonKey(name: 'PROXIMITY_SEARCH_RANGE') + this.maxRadius, @JsonKey(name: 'HOUSEHOLD_DELETION_REASON_OPTIONS') required final List householdDeletionReasonOptions, @@ -1638,6 +1656,9 @@ class _$_AppConfig implements _AppConfig { @override @JsonKey(name: 'TENANT_ID') final String? tenantId; + @override + @JsonKey(name: 'PROXIMITY_SEARCH_RANGE') + final double? maxRadius; final List _householdDeletionReasonOptions; @override @JsonKey(name: 'HOUSEHOLD_DELETION_REASON_OPTIONS') @@ -1720,7 +1741,7 @@ class _$_AppConfig implements _AppConfig { @override String toString() { - return 'AppConfig(networkDetection: $networkDetection, persistenceMode: $persistenceMode, syncMethod: $syncMethod, syncTrigger: $syncTrigger, languages: $languages, tenantId: $tenantId, householdDeletionReasonOptions: $householdDeletionReasonOptions, bandWidthBatchSize: $bandWidthBatchSize, backgroundServiceConfig: $backgroundServiceConfig, householdMemberDeletionReasonOptions: $householdMemberDeletionReasonOptions, genderOptions: $genderOptions, checklistTypes: $checklistTypes, idTypeOptions: $idTypeOptions, deliveryCommentOptions: $deliveryCommentOptions, backendInterface: $backendInterface, callSupportOptions: $callSupportOptions, transportTypes: $transportTypes)'; + return 'AppConfig(networkDetection: $networkDetection, persistenceMode: $persistenceMode, syncMethod: $syncMethod, syncTrigger: $syncTrigger, languages: $languages, tenantId: $tenantId, maxRadius: $maxRadius, householdDeletionReasonOptions: $householdDeletionReasonOptions, bandWidthBatchSize: $bandWidthBatchSize, backgroundServiceConfig: $backgroundServiceConfig, householdMemberDeletionReasonOptions: $householdMemberDeletionReasonOptions, genderOptions: $genderOptions, checklistTypes: $checklistTypes, idTypeOptions: $idTypeOptions, deliveryCommentOptions: $deliveryCommentOptions, backendInterface: $backendInterface, callSupportOptions: $callSupportOptions, transportTypes: $transportTypes)'; } @override @@ -1740,6 +1761,8 @@ class _$_AppConfig implements _AppConfig { .equals(other._languages, _languages) && (identical(other.tenantId, tenantId) || other.tenantId == tenantId) && + (identical(other.maxRadius, maxRadius) || + other.maxRadius == maxRadius) && const DeepCollectionEquality().equals( other._householdDeletionReasonOptions, _householdDeletionReasonOptions) && @@ -1777,6 +1800,7 @@ class _$_AppConfig implements _AppConfig { syncTrigger, const DeepCollectionEquality().hash(_languages), tenantId, + maxRadius, const DeepCollectionEquality().hash(_householdDeletionReasonOptions), const DeepCollectionEquality().hash(_bandWidthBatchSize), backgroundServiceConfig, @@ -1818,6 +1842,8 @@ abstract class _AppConfig implements AppConfig { required final List languages, @JsonKey(name: 'TENANT_ID') final String? tenantId, + @JsonKey(name: 'PROXIMITY_SEARCH_RANGE') + final double? maxRadius, @JsonKey(name: 'HOUSEHOLD_DELETION_REASON_OPTIONS') required final List householdDeletionReasonOptions, @@ -1865,6 +1891,9 @@ abstract class _AppConfig implements AppConfig { @JsonKey(name: 'TENANT_ID') String? get tenantId; @override + @JsonKey(name: 'PROXIMITY_SEARCH_RANGE') + double? get maxRadius; + @override @JsonKey(name: 'HOUSEHOLD_DELETION_REASON_OPTIONS') List get householdDeletionReasonOptions; @override diff --git a/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.g.dart b/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.g.dart index 9d537e380..35a744ae8 100644 --- a/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.g.dart +++ b/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.g.dart @@ -117,6 +117,7 @@ _$_AppConfig _$$_AppConfigFromJson(Map json) => _$_AppConfig( .map((e) => Languages.fromJson(e as Map)) .toList(), tenantId: json['TENANT_ID'] as String?, + maxRadius: (json['PROXIMITY_SEARCH_RANGE'] as num?)?.toDouble(), householdDeletionReasonOptions: (json['HOUSEHOLD_DELETION_REASON_OPTIONS'] as List) .map((e) => DeletionReasonOptions.fromJson(e as Map)) @@ -164,6 +165,7 @@ Map _$$_AppConfigToJson(_$_AppConfig instance) => 'SYNC_TRIGGER': instance.syncTrigger, 'LANGUAGES': instance.languages, 'TENANT_ID': instance.tenantId, + 'PROXIMITY_SEARCH_RANGE': instance.maxRadius, 'HOUSEHOLD_DELETION_REASON_OPTIONS': instance.householdDeletionReasonOptions, 'BANDWIDTH_BATCH_SIZE': instance.bandWidthBatchSize, diff --git a/apps/health_campaign_field_worker_app/lib/models/data_model.dart b/apps/health_campaign_field_worker_app/lib/models/data_model.dart index 209c59662..4446a6373 100644 --- a/apps/health_campaign_field_worker_app/lib/models/data_model.dart +++ b/apps/health_campaign_field_worker_app/lib/models/data_model.dart @@ -141,6 +141,7 @@ class AuditDetails { enum DataModelType { user, facility, + address, household, householdMember, individual, diff --git a/apps/health_campaign_field_worker_app/lib/models/data_model.mapper.g.dart b/apps/health_campaign_field_worker_app/lib/models/data_model.mapper.g.dart index a7a96be16..9d114c1f2 100644 --- a/apps/health_campaign_field_worker_app/lib/models/data_model.mapper.g.dart +++ b/apps/health_campaign_field_worker_app/lib/models/data_model.mapper.g.dart @@ -487,15 +487,15 @@ class AddressSearchModelMapper extends BaseMapper { @override Function get decoder => decode; AddressSearchModel decode(dynamic v) => checked(v, (Map map) => fromMap(map)); - AddressSearchModel fromMap(Map map) => AddressSearchModel.ignoreDeleted(id: Mapper.i.$getOpt(map, 'id'), tenantId: Mapper.i.$getOpt(map, 'tenantId'), boundaryCode: Mapper.i.$getOpt(map, 'boundaryCode')); + AddressSearchModel fromMap(Map map) => AddressSearchModel.ignoreDeleted(id: Mapper.i.$getOpt(map, 'id'), latitude: Mapper.i.$getOpt(map, 'latitude'), longitude: Mapper.i.$getOpt(map, 'longitude'), maxRadius: Mapper.i.$getOpt(map, 'maxRadius'), tenantId: Mapper.i.$getOpt(map, 'tenantId'), boundaryCode: Mapper.i.$getOpt(map, 'boundaryCode')); @override Function get encoder => (AddressSearchModel v) => encode(v); dynamic encode(AddressSearchModel v) => toMap(v); - Map toMap(AddressSearchModel a) => {if (Mapper.i.$enc(a.id, 'id') != null) 'id': Mapper.i.$enc(a.id, 'id'), if (Mapper.i.$enc(a.tenantId, 'tenantId') != null) 'tenantId': Mapper.i.$enc(a.tenantId, 'tenantId'), if (Mapper.i.$enc(a.boundaryCode, 'boundaryCode') != null) 'boundaryCode': Mapper.i.$enc(a.boundaryCode, 'boundaryCode')}; + Map toMap(AddressSearchModel a) => {if (Mapper.i.$enc(a.id, 'id') != null) 'id': Mapper.i.$enc(a.id, 'id'), if (Mapper.i.$enc(a.latitude, 'latitude') != null) 'latitude': Mapper.i.$enc(a.latitude, 'latitude'), if (Mapper.i.$enc(a.longitude, 'longitude') != null) 'longitude': Mapper.i.$enc(a.longitude, 'longitude'), if (Mapper.i.$enc(a.maxRadius, 'maxRadius') != null) 'maxRadius': Mapper.i.$enc(a.maxRadius, 'maxRadius'), if (Mapper.i.$enc(a.tenantId, 'tenantId') != null) 'tenantId': Mapper.i.$enc(a.tenantId, 'tenantId'), if (Mapper.i.$enc(a.boundaryCode, 'boundaryCode') != null) 'boundaryCode': Mapper.i.$enc(a.boundaryCode, 'boundaryCode')}; - @override String stringify(AddressSearchModel self) => 'AddressSearchModel(boundaryCode: ${Mapper.asString(self.boundaryCode)}, isDeleted: ${Mapper.asString(self.isDeleted)}, auditDetails: ${Mapper.asString(self.auditDetails)}, additionalFields: ${Mapper.asString(self.additionalFields)}, id: ${Mapper.asString(self.id)}, tenantId: ${Mapper.asString(self.tenantId)})'; - @override int hash(AddressSearchModel self) => Mapper.hash(self.boundaryCode) ^ Mapper.hash(self.isDeleted) ^ Mapper.hash(self.auditDetails) ^ Mapper.hash(self.additionalFields) ^ Mapper.hash(self.id) ^ Mapper.hash(self.tenantId); - @override bool equals(AddressSearchModel self, AddressSearchModel other) => Mapper.isEqual(self.boundaryCode, other.boundaryCode) && Mapper.isEqual(self.isDeleted, other.isDeleted) && Mapper.isEqual(self.auditDetails, other.auditDetails) && Mapper.isEqual(self.additionalFields, other.additionalFields) && Mapper.isEqual(self.id, other.id) && Mapper.isEqual(self.tenantId, other.tenantId); + @override String stringify(AddressSearchModel self) => 'AddressSearchModel(boundaryCode: ${Mapper.asString(self.boundaryCode)}, isDeleted: ${Mapper.asString(self.isDeleted)}, auditDetails: ${Mapper.asString(self.auditDetails)}, additionalFields: ${Mapper.asString(self.additionalFields)}, id: ${Mapper.asString(self.id)}, latitude: ${Mapper.asString(self.latitude)}, longitude: ${Mapper.asString(self.longitude)}, maxRadius: ${Mapper.asString(self.maxRadius)}, tenantId: ${Mapper.asString(self.tenantId)})'; + @override int hash(AddressSearchModel self) => Mapper.hash(self.boundaryCode) ^ Mapper.hash(self.isDeleted) ^ Mapper.hash(self.auditDetails) ^ Mapper.hash(self.additionalFields) ^ Mapper.hash(self.id) ^ Mapper.hash(self.latitude) ^ Mapper.hash(self.longitude) ^ Mapper.hash(self.maxRadius) ^ Mapper.hash(self.tenantId); + @override bool equals(AddressSearchModel self, AddressSearchModel other) => Mapper.isEqual(self.boundaryCode, other.boundaryCode) && Mapper.isEqual(self.isDeleted, other.isDeleted) && Mapper.isEqual(self.auditDetails, other.auditDetails) && Mapper.isEqual(self.additionalFields, other.additionalFields) && Mapper.isEqual(self.id, other.id) && Mapper.isEqual(self.latitude, other.latitude) && Mapper.isEqual(self.longitude, other.longitude) && Mapper.isEqual(self.maxRadius, other.maxRadius) && Mapper.isEqual(self.tenantId, other.tenantId); @override Function get typeFactory => (f) => f(); } @@ -508,14 +508,14 @@ extension AddressSearchModelMapperExtension on AddressSearchModel { abstract class AddressSearchModelCopyWith<$R> { factory AddressSearchModelCopyWith(AddressSearchModel value, Then then) = _AddressSearchModelCopyWithImpl<$R>; - $R call({String? id, String? tenantId, String? boundaryCode}); + $R call({String? id, double? latitude, double? longitude, double? maxRadius, String? tenantId, String? boundaryCode}); $R apply(AddressSearchModel Function(AddressSearchModel) transform); } class _AddressSearchModelCopyWithImpl<$R> extends BaseCopyWith implements AddressSearchModelCopyWith<$R> { _AddressSearchModelCopyWithImpl(AddressSearchModel value, Then then) : super(value, then); - @override $R call({Object? id = $none, Object? tenantId = $none, Object? boundaryCode = $none}) => $then(AddressSearchModel.ignoreDeleted(id: or(id, $value.id), tenantId: or(tenantId, $value.tenantId), boundaryCode: or(boundaryCode, $value.boundaryCode))); + @override $R call({Object? id = $none, Object? latitude = $none, Object? longitude = $none, Object? maxRadius = $none, Object? tenantId = $none, Object? boundaryCode = $none}) => $then(AddressSearchModel.ignoreDeleted(id: or(id, $value.id), latitude: or(latitude, $value.latitude), longitude: or(longitude, $value.longitude), maxRadius: or(maxRadius, $value.maxRadius), tenantId: or(tenantId, $value.tenantId), boundaryCode: or(boundaryCode, $value.boundaryCode))); } class AddressModelMapper extends BaseMapper { @@ -1031,15 +1031,15 @@ class HouseholdSearchModelMapper extends BaseMapper { @override Function get decoder => decode; HouseholdSearchModel decode(dynamic v) => checked(v, (Map map) => fromMap(map)); - HouseholdSearchModel fromMap(Map map) => HouseholdSearchModel.ignoreDeleted(id: Mapper.i.$getOpt(map, 'id'), memberCount: Mapper.i.$getOpt(map, 'memberCount'), latitude: Mapper.i.$getOpt(map, 'latitude'), longitude: Mapper.i.$getOpt(map, 'longitude'), maxRadius: Mapper.i.$getOpt(map, 'maxRadius'), clientReferenceId: Mapper.i.$getOpt(map, 'clientReferenceId'), tenantId: Mapper.i.$getOpt(map, 'tenantId'), boundaryCode: Mapper.i.$getOpt(map, 'boundaryCode')); + HouseholdSearchModel fromMap(Map map) => HouseholdSearchModel.ignoreDeleted(id: Mapper.i.$getOpt(map, 'id'), memberCount: Mapper.i.$getOpt(map, 'memberCount'), latitude: Mapper.i.$getOpt(map, 'latitude'), longitude: Mapper.i.$getOpt(map, 'longitude'), maxRadius: Mapper.i.$getOpt(map, 'maxRadius'), isProximityEnabled: Mapper.i.$getOpt(map, 'isProximityEnabled'), clientReferenceId: Mapper.i.$getOpt(map, 'clientReferenceId'), tenantId: Mapper.i.$getOpt(map, 'tenantId'), boundaryCode: Mapper.i.$getOpt(map, 'boundaryCode')); @override Function get encoder => (HouseholdSearchModel v) => encode(v); dynamic encode(HouseholdSearchModel v) => toMap(v); - Map toMap(HouseholdSearchModel h) => {if (Mapper.i.$enc(h.id, 'id') != null) 'id': Mapper.i.$enc(h.id, 'id'), if (Mapper.i.$enc(h.memberCount, 'memberCount') != null) 'memberCount': Mapper.i.$enc(h.memberCount, 'memberCount'), if (Mapper.i.$enc(h.latitude, 'latitude') != null) 'latitude': Mapper.i.$enc(h.latitude, 'latitude'), if (Mapper.i.$enc(h.longitude, 'longitude') != null) 'longitude': Mapper.i.$enc(h.longitude, 'longitude'), if (Mapper.i.$enc(h.maxRadius, 'maxRadius') != null) 'maxRadius': Mapper.i.$enc(h.maxRadius, 'maxRadius'), if (Mapper.i.$enc(h.clientReferenceId, 'clientReferenceId') != null) 'clientReferenceId': Mapper.i.$enc(h.clientReferenceId, 'clientReferenceId'), if (Mapper.i.$enc(h.tenantId, 'tenantId') != null) 'tenantId': Mapper.i.$enc(h.tenantId, 'tenantId'), if (Mapper.i.$enc(h.boundaryCode, 'boundaryCode') != null) 'boundaryCode': Mapper.i.$enc(h.boundaryCode, 'boundaryCode')}; + Map toMap(HouseholdSearchModel h) => {if (Mapper.i.$enc(h.id, 'id') != null) 'id': Mapper.i.$enc(h.id, 'id'), if (Mapper.i.$enc(h.memberCount, 'memberCount') != null) 'memberCount': Mapper.i.$enc(h.memberCount, 'memberCount'), if (Mapper.i.$enc(h.latitude, 'latitude') != null) 'latitude': Mapper.i.$enc(h.latitude, 'latitude'), if (Mapper.i.$enc(h.longitude, 'longitude') != null) 'longitude': Mapper.i.$enc(h.longitude, 'longitude'), if (Mapper.i.$enc(h.maxRadius, 'maxRadius') != null) 'maxRadius': Mapper.i.$enc(h.maxRadius, 'maxRadius'), if (Mapper.i.$enc(h.isProximityEnabled, 'isProximityEnabled') != null) 'isProximityEnabled': Mapper.i.$enc(h.isProximityEnabled, 'isProximityEnabled'), if (Mapper.i.$enc(h.clientReferenceId, 'clientReferenceId') != null) 'clientReferenceId': Mapper.i.$enc(h.clientReferenceId, 'clientReferenceId'), if (Mapper.i.$enc(h.tenantId, 'tenantId') != null) 'tenantId': Mapper.i.$enc(h.tenantId, 'tenantId'), if (Mapper.i.$enc(h.boundaryCode, 'boundaryCode') != null) 'boundaryCode': Mapper.i.$enc(h.boundaryCode, 'boundaryCode')}; - @override String stringify(HouseholdSearchModel self) => 'HouseholdSearchModel(boundaryCode: ${Mapper.asString(self.boundaryCode)}, isDeleted: ${Mapper.asString(self.isDeleted)}, auditDetails: ${Mapper.asString(self.auditDetails)}, additionalFields: ${Mapper.asString(self.additionalFields)}, id: ${Mapper.asString(self.id)}, memberCount: ${Mapper.asString(self.memberCount)}, latitude: ${Mapper.asString(self.latitude)}, longitude: ${Mapper.asString(self.longitude)}, maxRadius: ${Mapper.asString(self.maxRadius)}, clientReferenceId: ${Mapper.asString(self.clientReferenceId)}, tenantId: ${Mapper.asString(self.tenantId)})'; - @override int hash(HouseholdSearchModel self) => Mapper.hash(self.boundaryCode) ^ Mapper.hash(self.isDeleted) ^ Mapper.hash(self.auditDetails) ^ Mapper.hash(self.additionalFields) ^ Mapper.hash(self.id) ^ Mapper.hash(self.memberCount) ^ Mapper.hash(self.latitude) ^ Mapper.hash(self.longitude) ^ Mapper.hash(self.maxRadius) ^ Mapper.hash(self.clientReferenceId) ^ Mapper.hash(self.tenantId); - @override bool equals(HouseholdSearchModel self, HouseholdSearchModel other) => Mapper.isEqual(self.boundaryCode, other.boundaryCode) && Mapper.isEqual(self.isDeleted, other.isDeleted) && Mapper.isEqual(self.auditDetails, other.auditDetails) && Mapper.isEqual(self.additionalFields, other.additionalFields) && Mapper.isEqual(self.id, other.id) && Mapper.isEqual(self.memberCount, other.memberCount) && Mapper.isEqual(self.latitude, other.latitude) && Mapper.isEqual(self.longitude, other.longitude) && Mapper.isEqual(self.maxRadius, other.maxRadius) && Mapper.isEqual(self.clientReferenceId, other.clientReferenceId) && Mapper.isEqual(self.tenantId, other.tenantId); + @override String stringify(HouseholdSearchModel self) => 'HouseholdSearchModel(boundaryCode: ${Mapper.asString(self.boundaryCode)}, isDeleted: ${Mapper.asString(self.isDeleted)}, auditDetails: ${Mapper.asString(self.auditDetails)}, additionalFields: ${Mapper.asString(self.additionalFields)}, id: ${Mapper.asString(self.id)}, memberCount: ${Mapper.asString(self.memberCount)}, latitude: ${Mapper.asString(self.latitude)}, longitude: ${Mapper.asString(self.longitude)}, maxRadius: ${Mapper.asString(self.maxRadius)}, isProximityEnabled: ${Mapper.asString(self.isProximityEnabled)}, clientReferenceId: ${Mapper.asString(self.clientReferenceId)}, tenantId: ${Mapper.asString(self.tenantId)})'; + @override int hash(HouseholdSearchModel self) => Mapper.hash(self.boundaryCode) ^ Mapper.hash(self.isDeleted) ^ Mapper.hash(self.auditDetails) ^ Mapper.hash(self.additionalFields) ^ Mapper.hash(self.id) ^ Mapper.hash(self.memberCount) ^ Mapper.hash(self.latitude) ^ Mapper.hash(self.longitude) ^ Mapper.hash(self.maxRadius) ^ Mapper.hash(self.isProximityEnabled) ^ Mapper.hash(self.clientReferenceId) ^ Mapper.hash(self.tenantId); + @override bool equals(HouseholdSearchModel self, HouseholdSearchModel other) => Mapper.isEqual(self.boundaryCode, other.boundaryCode) && Mapper.isEqual(self.isDeleted, other.isDeleted) && Mapper.isEqual(self.auditDetails, other.auditDetails) && Mapper.isEqual(self.additionalFields, other.additionalFields) && Mapper.isEqual(self.id, other.id) && Mapper.isEqual(self.memberCount, other.memberCount) && Mapper.isEqual(self.latitude, other.latitude) && Mapper.isEqual(self.longitude, other.longitude) && Mapper.isEqual(self.maxRadius, other.maxRadius) && Mapper.isEqual(self.isProximityEnabled, other.isProximityEnabled) && Mapper.isEqual(self.clientReferenceId, other.clientReferenceId) && Mapper.isEqual(self.tenantId, other.tenantId); @override Function get typeFactory => (f) => f(); } @@ -1052,14 +1052,14 @@ extension HouseholdSearchModelMapperExtension on HouseholdSearchModel { abstract class HouseholdSearchModelCopyWith<$R> { factory HouseholdSearchModelCopyWith(HouseholdSearchModel value, Then then) = _HouseholdSearchModelCopyWithImpl<$R>; - $R call({String? id, int? memberCount, double? latitude, double? longitude, double? maxRadius, List? clientReferenceId, String? tenantId, String? boundaryCode}); + $R call({String? id, int? memberCount, double? latitude, double? longitude, double? maxRadius, bool? isProximityEnabled, List? clientReferenceId, String? tenantId, String? boundaryCode}); $R apply(HouseholdSearchModel Function(HouseholdSearchModel) transform); } class _HouseholdSearchModelCopyWithImpl<$R> extends BaseCopyWith implements HouseholdSearchModelCopyWith<$R> { _HouseholdSearchModelCopyWithImpl(HouseholdSearchModel value, Then then) : super(value, then); - @override $R call({Object? id = $none, Object? memberCount = $none, Object? latitude = $none, Object? longitude = $none, Object? maxRadius = $none, Object? clientReferenceId = $none, Object? tenantId = $none, Object? boundaryCode = $none}) => $then(HouseholdSearchModel.ignoreDeleted(id: or(id, $value.id), memberCount: or(memberCount, $value.memberCount), latitude: or(latitude, $value.latitude), longitude: or(longitude, $value.longitude), maxRadius: or(maxRadius, $value.maxRadius), clientReferenceId: or(clientReferenceId, $value.clientReferenceId), tenantId: or(tenantId, $value.tenantId), boundaryCode: or(boundaryCode, $value.boundaryCode))); + @override $R call({Object? id = $none, Object? memberCount = $none, Object? latitude = $none, Object? longitude = $none, Object? maxRadius = $none, Object? isProximityEnabled = $none, Object? clientReferenceId = $none, Object? tenantId = $none, Object? boundaryCode = $none}) => $then(HouseholdSearchModel.ignoreDeleted(id: or(id, $value.id), memberCount: or(memberCount, $value.memberCount), latitude: or(latitude, $value.latitude), longitude: or(longitude, $value.longitude), maxRadius: or(maxRadius, $value.maxRadius), isProximityEnabled: or(isProximityEnabled, $value.isProximityEnabled), clientReferenceId: or(clientReferenceId, $value.clientReferenceId), tenantId: or(tenantId, $value.tenantId), boundaryCode: or(boundaryCode, $value.boundaryCode))); } class HouseholdModelMapper extends BaseMapper { @@ -1067,15 +1067,15 @@ class HouseholdModelMapper extends BaseMapper { @override Function get decoder => decode; HouseholdModel decode(dynamic v) => checked(v, (Map map) => fromMap(map)); - HouseholdModel fromMap(Map map) => HouseholdModel(additionalFields: Mapper.i.$getOpt(map, 'additionalFields'), id: Mapper.i.$getOpt(map, 'id'), memberCount: Mapper.i.$getOpt(map, 'memberCount'), latitude: Mapper.i.$getOpt(map, 'latitude'), longitude: Mapper.i.$getOpt(map, 'longitude'), maxRadius: Mapper.i.$getOpt(map, 'maxRadius'), clientReferenceId: Mapper.i.$get(map, 'clientReferenceId'), tenantId: Mapper.i.$getOpt(map, 'tenantId'), rowVersion: Mapper.i.$getOpt(map, 'rowVersion'), address: Mapper.i.$getOpt(map, 'address'), auditDetails: Mapper.i.$getOpt(map, 'auditDetails'), clientAuditDetails: Mapper.i.$getOpt(map, 'clientAuditDetails'), isDeleted: Mapper.i.$getOpt(map, 'isDeleted') ?? false); + HouseholdModel fromMap(Map map) => HouseholdModel(additionalFields: Mapper.i.$getOpt(map, 'additionalFields'), id: Mapper.i.$getOpt(map, 'id'), memberCount: Mapper.i.$getOpt(map, 'memberCount'), latitude: Mapper.i.$getOpt(map, 'latitude'), longitude: Mapper.i.$getOpt(map, 'longitude'), clientReferenceId: Mapper.i.$get(map, 'clientReferenceId'), tenantId: Mapper.i.$getOpt(map, 'tenantId'), rowVersion: Mapper.i.$getOpt(map, 'rowVersion'), address: Mapper.i.$getOpt(map, 'address'), auditDetails: Mapper.i.$getOpt(map, 'auditDetails'), clientAuditDetails: Mapper.i.$getOpt(map, 'clientAuditDetails'), isDeleted: Mapper.i.$getOpt(map, 'isDeleted') ?? false); @override Function get encoder => (HouseholdModel v) => encode(v); dynamic encode(HouseholdModel v) => toMap(v); - Map toMap(HouseholdModel h) => {if (Mapper.i.$enc(h.additionalFields, 'additionalFields') != null) 'additionalFields': Mapper.i.$enc(h.additionalFields, 'additionalFields'), if (Mapper.i.$enc(h.id, 'id') != null) 'id': Mapper.i.$enc(h.id, 'id'), if (Mapper.i.$enc(h.memberCount, 'memberCount') != null) 'memberCount': Mapper.i.$enc(h.memberCount, 'memberCount'), if (Mapper.i.$enc(h.latitude, 'latitude') != null) 'latitude': Mapper.i.$enc(h.latitude, 'latitude'), if (Mapper.i.$enc(h.longitude, 'longitude') != null) 'longitude': Mapper.i.$enc(h.longitude, 'longitude'), if (Mapper.i.$enc(h.maxRadius, 'maxRadius') != null) 'maxRadius': Mapper.i.$enc(h.maxRadius, 'maxRadius'), 'clientReferenceId': Mapper.i.$enc(h.clientReferenceId, 'clientReferenceId'), if (Mapper.i.$enc(h.tenantId, 'tenantId') != null) 'tenantId': Mapper.i.$enc(h.tenantId, 'tenantId'), if (Mapper.i.$enc(h.rowVersion, 'rowVersion') != null) 'rowVersion': Mapper.i.$enc(h.rowVersion, 'rowVersion'), if (Mapper.i.$enc(h.address, 'address') != null) 'address': Mapper.i.$enc(h.address, 'address'), if (Mapper.i.$enc(h.auditDetails, 'auditDetails') != null) 'auditDetails': Mapper.i.$enc(h.auditDetails, 'auditDetails'), if (Mapper.i.$enc(h.clientAuditDetails, 'clientAuditDetails') != null) 'clientAuditDetails': Mapper.i.$enc(h.clientAuditDetails, 'clientAuditDetails'), if (Mapper.i.$enc(h.isDeleted, 'isDeleted') != null) 'isDeleted': Mapper.i.$enc(h.isDeleted, 'isDeleted')}; + Map toMap(HouseholdModel h) => {if (Mapper.i.$enc(h.additionalFields, 'additionalFields') != null) 'additionalFields': Mapper.i.$enc(h.additionalFields, 'additionalFields'), if (Mapper.i.$enc(h.id, 'id') != null) 'id': Mapper.i.$enc(h.id, 'id'), if (Mapper.i.$enc(h.memberCount, 'memberCount') != null) 'memberCount': Mapper.i.$enc(h.memberCount, 'memberCount'), if (Mapper.i.$enc(h.latitude, 'latitude') != null) 'latitude': Mapper.i.$enc(h.latitude, 'latitude'), if (Mapper.i.$enc(h.longitude, 'longitude') != null) 'longitude': Mapper.i.$enc(h.longitude, 'longitude'), 'clientReferenceId': Mapper.i.$enc(h.clientReferenceId, 'clientReferenceId'), if (Mapper.i.$enc(h.tenantId, 'tenantId') != null) 'tenantId': Mapper.i.$enc(h.tenantId, 'tenantId'), if (Mapper.i.$enc(h.rowVersion, 'rowVersion') != null) 'rowVersion': Mapper.i.$enc(h.rowVersion, 'rowVersion'), if (Mapper.i.$enc(h.address, 'address') != null) 'address': Mapper.i.$enc(h.address, 'address'), if (Mapper.i.$enc(h.auditDetails, 'auditDetails') != null) 'auditDetails': Mapper.i.$enc(h.auditDetails, 'auditDetails'), if (Mapper.i.$enc(h.clientAuditDetails, 'clientAuditDetails') != null) 'clientAuditDetails': Mapper.i.$enc(h.clientAuditDetails, 'clientAuditDetails'), if (Mapper.i.$enc(h.isDeleted, 'isDeleted') != null) 'isDeleted': Mapper.i.$enc(h.isDeleted, 'isDeleted')}; - @override String stringify(HouseholdModel self) => 'HouseholdModel(boundaryCode: ${Mapper.asString(self.boundaryCode)}, isDeleted: ${Mapper.asString(self.isDeleted)}, auditDetails: ${Mapper.asString(self.auditDetails)}, clientAuditDetails: ${Mapper.asString(self.clientAuditDetails)}, id: ${Mapper.asString(self.id)}, memberCount: ${Mapper.asString(self.memberCount)}, latitude: ${Mapper.asString(self.latitude)}, longitude: ${Mapper.asString(self.longitude)}, maxRadius: ${Mapper.asString(self.maxRadius)}, clientReferenceId: ${Mapper.asString(self.clientReferenceId)}, tenantId: ${Mapper.asString(self.tenantId)}, rowVersion: ${Mapper.asString(self.rowVersion)}, address: ${Mapper.asString(self.address)}, additionalFields: ${Mapper.asString(self.additionalFields)})'; - @override int hash(HouseholdModel self) => Mapper.hash(self.boundaryCode) ^ Mapper.hash(self.isDeleted) ^ Mapper.hash(self.auditDetails) ^ Mapper.hash(self.clientAuditDetails) ^ Mapper.hash(self.id) ^ Mapper.hash(self.memberCount) ^ Mapper.hash(self.latitude) ^ Mapper.hash(self.longitude) ^ Mapper.hash(self.maxRadius) ^ Mapper.hash(self.clientReferenceId) ^ Mapper.hash(self.tenantId) ^ Mapper.hash(self.rowVersion) ^ Mapper.hash(self.address) ^ Mapper.hash(self.additionalFields); - @override bool equals(HouseholdModel self, HouseholdModel other) => Mapper.isEqual(self.boundaryCode, other.boundaryCode) && Mapper.isEqual(self.isDeleted, other.isDeleted) && Mapper.isEqual(self.auditDetails, other.auditDetails) && Mapper.isEqual(self.clientAuditDetails, other.clientAuditDetails) && Mapper.isEqual(self.id, other.id) && Mapper.isEqual(self.memberCount, other.memberCount) && Mapper.isEqual(self.latitude, other.latitude) && Mapper.isEqual(self.longitude, other.longitude) && Mapper.isEqual(self.maxRadius, other.maxRadius) && Mapper.isEqual(self.clientReferenceId, other.clientReferenceId) && Mapper.isEqual(self.tenantId, other.tenantId) && Mapper.isEqual(self.rowVersion, other.rowVersion) && Mapper.isEqual(self.address, other.address) && Mapper.isEqual(self.additionalFields, other.additionalFields); + @override String stringify(HouseholdModel self) => 'HouseholdModel(boundaryCode: ${Mapper.asString(self.boundaryCode)}, isDeleted: ${Mapper.asString(self.isDeleted)}, auditDetails: ${Mapper.asString(self.auditDetails)}, clientAuditDetails: ${Mapper.asString(self.clientAuditDetails)}, id: ${Mapper.asString(self.id)}, memberCount: ${Mapper.asString(self.memberCount)}, latitude: ${Mapper.asString(self.latitude)}, longitude: ${Mapper.asString(self.longitude)}, clientReferenceId: ${Mapper.asString(self.clientReferenceId)}, tenantId: ${Mapper.asString(self.tenantId)}, rowVersion: ${Mapper.asString(self.rowVersion)}, address: ${Mapper.asString(self.address)}, additionalFields: ${Mapper.asString(self.additionalFields)})'; + @override int hash(HouseholdModel self) => Mapper.hash(self.boundaryCode) ^ Mapper.hash(self.isDeleted) ^ Mapper.hash(self.auditDetails) ^ Mapper.hash(self.clientAuditDetails) ^ Mapper.hash(self.id) ^ Mapper.hash(self.memberCount) ^ Mapper.hash(self.latitude) ^ Mapper.hash(self.longitude) ^ Mapper.hash(self.clientReferenceId) ^ Mapper.hash(self.tenantId) ^ Mapper.hash(self.rowVersion) ^ Mapper.hash(self.address) ^ Mapper.hash(self.additionalFields); + @override bool equals(HouseholdModel self, HouseholdModel other) => Mapper.isEqual(self.boundaryCode, other.boundaryCode) && Mapper.isEqual(self.isDeleted, other.isDeleted) && Mapper.isEqual(self.auditDetails, other.auditDetails) && Mapper.isEqual(self.clientAuditDetails, other.clientAuditDetails) && Mapper.isEqual(self.id, other.id) && Mapper.isEqual(self.memberCount, other.memberCount) && Mapper.isEqual(self.latitude, other.latitude) && Mapper.isEqual(self.longitude, other.longitude) && Mapper.isEqual(self.clientReferenceId, other.clientReferenceId) && Mapper.isEqual(self.tenantId, other.tenantId) && Mapper.isEqual(self.rowVersion, other.rowVersion) && Mapper.isEqual(self.address, other.address) && Mapper.isEqual(self.additionalFields, other.additionalFields); @override Function get typeFactory => (f) => f(); } @@ -1092,7 +1092,7 @@ abstract class HouseholdModelCopyWith<$R> { AddressModelCopyWith<$R>? get address; AuditDetailsCopyWith<$R>? get auditDetails; ClientAuditDetailsCopyWith<$R>? get clientAuditDetails; - $R call({HouseholdAdditionalFields? additionalFields, String? id, int? memberCount, double? latitude, double? longitude, double? maxRadius, String? clientReferenceId, String? tenantId, int? rowVersion, AddressModel? address, AuditDetails? auditDetails, ClientAuditDetails? clientAuditDetails, bool? isDeleted}); + $R call({HouseholdAdditionalFields? additionalFields, String? id, int? memberCount, double? latitude, double? longitude, String? clientReferenceId, String? tenantId, int? rowVersion, AddressModel? address, AuditDetails? auditDetails, ClientAuditDetails? clientAuditDetails, bool? isDeleted}); $R apply(HouseholdModel Function(HouseholdModel) transform); } @@ -1103,7 +1103,7 @@ class _HouseholdModelCopyWithImpl<$R> extends BaseCopyWith i @override AddressModelCopyWith<$R>? get address => $value.address != null ? AddressModelCopyWith($value.address!, (v) => call(address: v)) : null; @override AuditDetailsCopyWith<$R>? get auditDetails => $value.auditDetails != null ? AuditDetailsCopyWith($value.auditDetails!, (v) => call(auditDetails: v)) : null; @override ClientAuditDetailsCopyWith<$R>? get clientAuditDetails => $value.clientAuditDetails != null ? ClientAuditDetailsCopyWith($value.clientAuditDetails!, (v) => call(clientAuditDetails: v)) : null; - @override $R call({Object? additionalFields = $none, Object? id = $none, Object? memberCount = $none, Object? latitude = $none, Object? longitude = $none, Object? maxRadius = $none, String? clientReferenceId, Object? tenantId = $none, Object? rowVersion = $none, Object? address = $none, Object? auditDetails = $none, Object? clientAuditDetails = $none, Object? isDeleted = $none}) => $then(HouseholdModel(additionalFields: or(additionalFields, $value.additionalFields), id: or(id, $value.id), memberCount: or(memberCount, $value.memberCount), latitude: or(latitude, $value.latitude), longitude: or(longitude, $value.longitude), maxRadius: or(maxRadius, $value.maxRadius), clientReferenceId: clientReferenceId ?? $value.clientReferenceId, tenantId: or(tenantId, $value.tenantId), rowVersion: or(rowVersion, $value.rowVersion), address: or(address, $value.address), auditDetails: or(auditDetails, $value.auditDetails), clientAuditDetails: or(clientAuditDetails, $value.clientAuditDetails), isDeleted: or(isDeleted, $value.isDeleted))); + @override $R call({Object? additionalFields = $none, Object? id = $none, Object? memberCount = $none, Object? latitude = $none, Object? longitude = $none, String? clientReferenceId, Object? tenantId = $none, Object? rowVersion = $none, Object? address = $none, Object? auditDetails = $none, Object? clientAuditDetails = $none, Object? isDeleted = $none}) => $then(HouseholdModel(additionalFields: or(additionalFields, $value.additionalFields), id: or(id, $value.id), memberCount: or(memberCount, $value.memberCount), latitude: or(latitude, $value.latitude), longitude: or(longitude, $value.longitude), clientReferenceId: clientReferenceId ?? $value.clientReferenceId, tenantId: or(tenantId, $value.tenantId), rowVersion: or(rowVersion, $value.rowVersion), address: or(address, $value.address), auditDetails: or(auditDetails, $value.auditDetails), clientAuditDetails: or(clientAuditDetails, $value.clientAuditDetails), isDeleted: or(isDeleted, $value.isDeleted))); } class HouseholdAdditionalFieldsMapper extends BaseMapper { diff --git a/apps/health_campaign_field_worker_app/lib/models/entities/address.dart b/apps/health_campaign_field_worker_app/lib/models/entities/address.dart index 2112dff48..8ba7c2d5e 100644 --- a/apps/health_campaign_field_worker_app/lib/models/entities/address.dart +++ b/apps/health_campaign_field_worker_app/lib/models/entities/address.dart @@ -8,10 +8,16 @@ import '../../data/local_store/sql_store/sql_store.dart'; @MappableClass(ignoreNull: true) class AddressSearchModel extends EntitySearchModel { final String? id; + final double? latitude; + final double? longitude; + final double? maxRadius; final String? tenantId; AddressSearchModel({ this.id, + this.latitude, + this.longitude, + this.maxRadius, this.tenantId, super.boundaryCode, super.isDeleted, @@ -20,6 +26,9 @@ class AddressSearchModel extends EntitySearchModel { @MappableConstructor() AddressSearchModel.ignoreDeleted({ this.id, + this.latitude, + this.longitude, + this.maxRadius, this.tenantId, super.boundaryCode, }): super(isDeleted: false); diff --git a/apps/health_campaign_field_worker_app/lib/models/entities/household.dart b/apps/health_campaign_field_worker_app/lib/models/entities/household.dart index 4c7c6a27a..6f1b15f88 100644 --- a/apps/health_campaign_field_worker_app/lib/models/entities/household.dart +++ b/apps/health_campaign_field_worker_app/lib/models/entities/household.dart @@ -12,6 +12,7 @@ class HouseholdSearchModel extends EntitySearchModel { final double? latitude; final double? longitude; final double? maxRadius; + final bool? isProximityEnabled; final List? clientReferenceId; final String? tenantId; @@ -21,6 +22,7 @@ class HouseholdSearchModel extends EntitySearchModel { this.latitude, this.longitude, this.maxRadius, + this.isProximityEnabled, this.clientReferenceId, this.tenantId, super.boundaryCode, @@ -34,6 +36,7 @@ class HouseholdSearchModel extends EntitySearchModel { this.latitude, this.longitude, this.maxRadius, + this.isProximityEnabled, this.clientReferenceId, this.tenantId, super.boundaryCode, @@ -49,7 +52,6 @@ class HouseholdModel extends EntityModel { final int? memberCount; final double? latitude; final double? longitude; - final double? maxRadius; final String clientReferenceId; final String? tenantId; final int? rowVersion; @@ -62,7 +64,6 @@ class HouseholdModel extends EntityModel { this.memberCount, this.latitude, this.longitude, - this.maxRadius, required this.clientReferenceId, this.tenantId, this.rowVersion, @@ -87,7 +88,6 @@ class HouseholdModel extends EntityModel { memberCount: Value(memberCount), latitude: Value(latitude), longitude: Value(longitude), - maxRadius: Value(maxRadius), clientReferenceId: Value(clientReferenceId), tenantId: Value(tenantId), rowVersion: Value(rowVersion), diff --git a/apps/health_campaign_field_worker_app/lib/models/model_configs/address.json b/apps/health_campaign_field_worker_app/lib/models/model_configs/address.json index b737004ce..bb8917d60 100644 --- a/apps/health_campaign_field_worker_app/lib/models/model_configs/address.json +++ b/apps/health_campaign_field_worker_app/lib/models/model_configs/address.json @@ -21,17 +21,27 @@ "includeForEntity": false, "includeForTable": false }, + { "name": "doorNo", "type": "String" }, { "name": "latitude", - "type": "double" + "type": "double", + "includeForQuery": true }, { "name": "longitude", - "type": "double" + "type": "double", + "includeForQuery": true + }, + { + "name": "maxRadius", + "type": "double", + "includeForQuery": true, + "includeForEntity": false, + "includeForTable": false }, { "name": "locationAccuracy", diff --git a/apps/health_campaign_field_worker_app/lib/models/model_configs/household.json b/apps/health_campaign_field_worker_app/lib/models/model_configs/household.json index 47dee9c98..2c2460b3c 100644 --- a/apps/health_campaign_field_worker_app/lib/models/model_configs/household.json +++ b/apps/health_campaign_field_worker_app/lib/models/model_configs/household.json @@ -26,7 +26,16 @@ { "name": "maxRadius", "type": "double", - "includeForQuery": true + "includeForQuery": true, + "includeForEntity": false, + "includeForTable": false + }, + { + "name": "isProximityEnabled", + "type": "bool", + "includeForQuery": true, + "includeForEntity": false, + "includeForTable": false } ], "customAttributes": [ diff --git a/apps/health_campaign_field_worker_app/lib/pages/authenticated.dart b/apps/health_campaign_field_worker_app/lib/pages/authenticated.dart index 787e87bb1..784ebebe1 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/authenticated.dart +++ b/apps/health_campaign_field_worker_app/lib/pages/authenticated.dart @@ -11,6 +11,9 @@ import '../blocs/localization/app_localization.dart'; import '../blocs/search_households/search_households.dart'; import '../blocs/sync/sync.dart'; import '../data/local_store/no_sql/schema/oplog.dart'; +import '../data/local_store/sql_store/sql_store.dart'; +import '../data/repositories/local/address.dart'; +import '../data/repositories/oplog/oplog.dart'; import '../models/data_model.dart'; import '../router/app_router.dart'; import '../router/authenticated_route_observer.dart'; @@ -69,10 +72,16 @@ class AuthenticatedPageWrapper extends StatelessWidget { providers: [ BlocProvider( create: (context) { + final isar = context.read(); + return SearchHouseholdsBloc( beneficiaryType: context.beneficiaryType, userUid: context.loggedInUserUuid, projectId: context.projectId, + addressRepository: AddressLocalRepository( + context.read(), + AddressOpLogManager(isar), + ), projectBeneficiary: context.repository< ProjectBeneficiaryModel, ProjectBeneficiarySearchModel>(), diff --git a/apps/health_campaign_field_worker_app/lib/pages/beneficiary_registration/household_location.dart b/apps/health_campaign_field_worker_app/lib/pages/beneficiary_registration/household_location.dart index bf1f84f6d..612434821 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/beneficiary_registration/household_location.dart +++ b/apps/health_campaign_field_worker_app/lib/pages/beneficiary_registration/household_location.dart @@ -74,107 +74,113 @@ class _HouseholdLocationPageState height: 85, child: DigitCard( margin: const EdgeInsets.only(left: 0, right: 0, top: 10), - child: DigitElevatedButton( - onPressed: () { - form.markAllAsTouched(); - if (!form.valid) return; + child: BlocBuilder( + builder: (context, locationState) { + return DigitElevatedButton( + onPressed: () { + form.markAllAsTouched(); + if (!form.valid) return; - final addressLine1 = - form.control(_addressLine1Key).value as String?; - final addressLine2 = - form.control(_addressLine2Key).value as String?; - final landmark = - form.control(_landmarkKey).value as String?; - final postalCode = - form.control(_postalCodeKey).value as String?; + final addressLine1 = + form.control(_addressLine1Key).value as String?; + final addressLine2 = + form.control(_addressLine2Key).value as String?; + final landmark = + form.control(_landmarkKey).value as String?; + final postalCode = + form.control(_postalCodeKey).value as String?; - registrationState.maybeWhen( - orElse: () { - return; - }, - create: ( - address, - householdModel, - individualModel, - registrationDate, - searchQuery, - loading, - isHeadOfHousehold, - ) { - var addressModel = AddressModel( - addressLine1: addressLine1, - addressLine2: addressLine2, - landmark: landmark, - pincode: postalCode, - type: AddressType.correspondence, - latitude: form.control(_latKey).value, - longitude: form.control(_lngKey).value, - locationAccuracy: - form.control(_accuracyKey).value, - locality: LocalityModel( - code: context.boundary.code!, - name: context.boundary.name, - ), - tenantId: envConfig.variables.tenantId, - rowVersion: 1, - clientAuditDetails: ClientAuditDetails( - createdBy: context.loggedInUserUuid, - createdTime: context.millisecondsSinceEpoch(), - lastModifiedBy: context.loggedInUserUuid, - lastModifiedTime: - context.millisecondsSinceEpoch(), - ), - auditDetails: AuditDetails( - createdBy: context.loggedInUserUuid, - createdTime: context.millisecondsSinceEpoch(), - lastModifiedBy: context.loggedInUserUuid, - lastModifiedTime: - context.millisecondsSinceEpoch(), - ), - ); + registrationState.maybeWhen( + orElse: () { + return; + }, + create: ( + address, + householdModel, + individualModel, + registrationDate, + searchQuery, + loading, + isHeadOfHousehold, + ) { + var addressModel = AddressModel( + addressLine1: addressLine1, + addressLine2: addressLine2, + landmark: landmark, + pincode: postalCode, + type: AddressType.correspondence, + latitude: form.control(_latKey).value ?? + locationState.latitude, + longitude: form.control(_lngKey).value ?? + locationState.longitude, + locationAccuracy: + form.control(_accuracyKey).value ?? + locationState.accuracy, + locality: LocalityModel( + code: context.boundary.code!, + name: context.boundary.name, + ), + tenantId: envConfig.variables.tenantId, + rowVersion: 1, + auditDetails: AuditDetails( + createdBy: context.loggedInUserUuid, + createdTime: + context.millisecondsSinceEpoch(), + ), + clientAuditDetails: ClientAuditDetails( + createdBy: context.loggedInUserUuid, + createdTime: + context.millisecondsSinceEpoch(), + lastModifiedBy: context.loggedInUserUuid, + lastModifiedTime: + context.millisecondsSinceEpoch(), + ), + ); - bloc.add( - BeneficiaryRegistrationSaveAddressEvent( - addressModel, - ), - ); - router.push(HouseHoldDetailsRoute()); - }, - editHousehold: ( - address, - householdModel, - individuals, - registrationDate, - loading, - ) { - var addressModel = address.copyWith( - addressLine1: addressLine1, - addressLine2: addressLine2, - landmark: landmark, - locality: address.locality, - pincode: postalCode, - type: AddressType.correspondence, - latitude: form.control(_latKey).value, - longitude: form.control(_lngKey).value, - locationAccuracy: - form.control(_accuracyKey).value, - ); + bloc.add( + BeneficiaryRegistrationSaveAddressEvent( + addressModel, + ), + ); + router.push(HouseHoldDetailsRoute()); + }, + editHousehold: ( + address, + householdModel, + individuals, + registrationDate, + loading, + ) { + var addressModel = address.copyWith( + addressLine1: addressLine1, + addressLine2: addressLine2, + landmark: landmark, + locality: address.locality, + pincode: postalCode, + type: AddressType.correspondence, + latitude: form.control(_latKey).value, + longitude: form.control(_lngKey).value, + locationAccuracy: + form.control(_accuracyKey).value, + ); - bloc.add( - BeneficiaryRegistrationSaveAddressEvent( - addressModel, - ), + bloc.add( + BeneficiaryRegistrationSaveAddressEvent( + addressModel, + ), + ); + router.push(HouseHoldDetailsRoute()); + }, ); - router.push(HouseHoldDetailsRoute()); }, + child: Center( + child: Text( + localizations + .translate(i18.householdLocation.actionLabel), + ), + ), ); }, - child: Center( - child: Text( - localizations - .translate(i18.householdLocation.actionLabel), - ), - ), ), ), ), diff --git a/apps/health_campaign_field_worker_app/lib/pages/beneficiary_registration/individual_details.dart b/apps/health_campaign_field_worker_app/lib/pages/beneficiary_registration/individual_details.dart index 4c9f35203..b65bf69c0 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/beneficiary_registration/individual_details.dart +++ b/apps/health_campaign_field_worker_app/lib/pages/beneficiary_registration/individual_details.dart @@ -63,6 +63,7 @@ class _IndividualDetailsPageState SearchHouseholdsByHouseholdsEvent( householdModel: value.householdModel, projectId: context.projectId, + isProximityEnabled: false, ), ); router.push(AcknowledgementRoute()); diff --git a/apps/health_campaign_field_worker_app/lib/pages/search_beneficiary.dart b/apps/health_campaign_field_worker_app/lib/pages/search_beneficiary.dart index 2a6dea15b..7bf236882 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/search_beneficiary.dart +++ b/apps/health_campaign_field_worker_app/lib/pages/search_beneficiary.dart @@ -2,7 +2,9 @@ import 'package:digit_components/digit_components.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart'; +import 'package:location/location.dart'; +import '../blocs/app_initialization/app_initialization.dart'; import '../blocs/beneficiary_registration/beneficiary_registration.dart'; import '../blocs/search_households/search_households.dart'; import '../models/beneficiary_statistics/beneficiary_statistics_model.dart'; @@ -27,144 +29,257 @@ class SearchBeneficiaryPage extends LocalizedStatefulWidget { class _SearchBeneficiaryPageState extends LocalizedState { final TextEditingController searchController = TextEditingController(); + bool isProximityEnabled = false; @override Widget build(BuildContext context) { final theme = Theme.of(context); return KeyboardVisibilityBuilder( - builder: (context, isKeyboardVisible) => Scaffold( - body: BlocBuilder( - builder: (context, searchState) { - return ScrollableContent( - header: const Column(children: [ - BackNavigationHelpHeaderWidget(), - ]), - slivers: [ - SliverToBoxAdapter( - child: Column( - children: [ - Padding( - padding: const EdgeInsets.all(8), - child: Align( - alignment: Alignment.topLeft, - child: Text( - localizations.translate( - i18.searchBeneficiary.statisticsLabelText, + builder: (context, isKeyboardVisible) => + BlocBuilder( + builder: (appcontext, state) { + if (state is! AppInitialized) return const Offstage(); + + final appConfig = state.appConfiguration; + + return Scaffold( + body: BlocBuilder( + builder: (context, searchState) { + return ScrollableContent( + header: const Column(children: [ + BackNavigationHelpHeaderWidget(), + ]), + slivers: [ + SliverToBoxAdapter( + child: Column( + children: [ + Padding( + padding: const EdgeInsets.all(8), + child: Align( + alignment: Alignment.topLeft, + child: Text( + localizations.translate( + i18.searchBeneficiary.statisticsLabelText, + ), + style: theme.textTheme.displayMedium, + textAlign: TextAlign.center, + ), ), - style: theme.textTheme.displayMedium, - textAlign: TextAlign.center, ), - ), - ), - BeneficiaryStatisticsCard( - beneficiaryStatistics: - BeneficiaryStatisticsWrapperModel( - beneficiaryStatisticsList: [ - BeneficiaryStatisticsModel( - title: - searchState.registeredHouseholds.toString(), - content: localizations.translate( - '${context.beneficiaryType.name.toUpperCase()}_${i18.searchBeneficiary.noOfHouseholdsRegistered}', - ), + BeneficiaryStatisticsCard( + beneficiaryStatistics: + BeneficiaryStatisticsWrapperModel( + beneficiaryStatisticsList: [ + BeneficiaryStatisticsModel( + title: searchState.registeredHouseholds + .toString(), + content: localizations.translate( + '${context.beneficiaryType.name.toUpperCase()}_${i18.searchBeneficiary.noOfHouseholdsRegistered}', + ), + ), + BeneficiaryStatisticsModel( + title: searchState.deliveredInterventions + .toString(), + content: localizations.translate( + '${context.beneficiaryType.name.toUpperCase()}_${i18.searchBeneficiary.noOfResourcesDelivered}', + ), + ), + ], ), - BeneficiaryStatisticsModel( - title: - searchState.deliveredInterventions.toString(), - content: localizations.translate( - '${context.beneficiaryType.name.toUpperCase()}_${i18.searchBeneficiary.noOfResourcesDelivered}', + ), + BlocBuilder( + builder: (context, locationState) { + return Column( + children: [ + DigitSearchBar( + controller: searchController, + hintText: localizations.translate( + i18.searchBeneficiary + .beneficiarySearchHintText, + ), + textCapitalization: + TextCapitalization.words, + onChanged: (value) { + final bloc = + context.read(); + + if (value.trim().length < 2 && + !isProximityEnabled) { + bloc.add( + const SearchHouseholdsClearEvent(), + ); + + return; + } else { + if (isProximityEnabled && + value.trim().length < 2) { + bloc.add(SearchHouseholdsEvent + .searchByProximity( + latitude: locationState.latitude!, + longititude: + locationState.longitude!, + projectId: context.projectId, + maxRadius: appConfig.maxRadius!, + )); + } else { + bloc.add( + SearchHouseholdsSearchByHouseholdHeadEvent( + searchText: value.trim(), + projectId: context.projectId, + latitude: locationState.latitude, + longitude: + locationState.longitude, + isProximityEnabled: + isProximityEnabled, + maxRadius: appConfig.maxRadius, + ), + ); + } + } + }, + ), + locationState.latitude != null + ? Row( + children: [ + Switch( + value: isProximityEnabled, + onChanged: (value) { + searchController.clear(); + setState(() { + isProximityEnabled = value; + }); + + if (locationState + .hasPermissions && + value && + locationState.latitude != + null && + locationState.longitude != + null && + appConfig.maxRadius != + null && + isProximityEnabled) { + final bloc = context.read< + SearchHouseholdsBloc>(); + bloc.add(SearchHouseholdsEvent + .searchByProximity( + latitude: + locationState.latitude!, + longititude: locationState + .longitude!, + projectId: + context.projectId, + maxRadius: + appConfig.maxRadius!, + )); + } else { + final bloc = context.read< + SearchHouseholdsBloc>(); + bloc.add( + const SearchHouseholdsClearEvent(), + ); + } + }, + ), + Text( + localizations.translate( + i18.searchBeneficiary + .proximityLabel, + ), + ), + ], + ) + : const Offstage(), + ], + ); + }, + ), + const SizedBox(height: 16), + if (searchState.resultsNotFound) + DigitInfoCard( + description: localizations.translate( + i18.searchBeneficiary + .beneficiaryInfoDescription, + ), + title: localizations.translate( + i18.searchBeneficiary.beneficiaryInfoTitle, ), ), - ], - ), + ], ), - DigitSearchBar( - controller: searchController, - hintText: localizations.translate( - i18.searchBeneficiary.beneficiarySearchHintText, + ), + if (searchState.loading) + const SliverFillRemaining( + child: Center( + child: CircularProgressIndicator(), ), - textCapitalization: TextCapitalization.words, - onChanged: (value) { - final bloc = context.read(); - if (value.trim().length < 2) { - bloc.add(const SearchHouseholdsClearEvent()); - - return; - } - - bloc.add( - SearchHouseholdsSearchByHouseholdHeadEvent( - searchText: value.trim(), - projectId: context.projectId, - ), - ); - }, ), - const SizedBox(height: 16), - if (searchState.resultsNotFound) - DigitInfoCard( - description: localizations.translate( - i18.searchBeneficiary.beneficiaryInfoDescription, - ), - title: localizations.translate( - i18.searchBeneficiary.beneficiaryInfoTitle, + BlocBuilder( + builder: (context, locationState) { + return SliverList( + delegate: SliverChildBuilderDelegate( + (ctx, index) { + final i = + searchState.householdMembers.elementAt(index); + final distance = calculateDistance( + Coordinate( + locationState.latitude!, + locationState.longitude!, + ), + Coordinate( + i.household.address!.latitude!, + i.household.address!.longitude!, + ), + ); + + return ViewBeneficiaryCard( + distance: distance, + householdMember: i, + onOpenPressed: () async { + final bloc = + context.read(); + final projectId = context.projectId; + + await context.router.push( + BeneficiaryWrapperRoute( + wrapper: i, + ), + ); + + bloc.add( + SearchHouseholdsSearchByHouseholdHeadEvent( + searchText: searchController.text, + projectId: projectId, + isProximityEnabled: isProximityEnabled, + ), + ); + }, + ); + }, + childCount: searchState.householdMembers.length, ), - ), - ], - ), - ), - if (searchState.loading) - const SliverFillRemaining( - child: Center( - child: CircularProgressIndicator(), + ); + }, ), - ), - SliverList( - delegate: SliverChildBuilderDelegate( - (ctx, index) { - final i = searchState.householdMembers.elementAt(index); - - return ViewBeneficiaryCard( - householdMember: i, - onOpenPressed: () async { - final bloc = context.read(); - final projectId = context.projectId; - - await context.router.push( - BeneficiaryWrapperRoute( - wrapper: i, - ), - ); + ], + ); + }, + ), + bottomNavigationBar: SizedBox( + height: 85, + child: DigitCard( + margin: const EdgeInsets.only(left: 0, right: 0, top: 10), + child: BlocBuilder( + builder: (context, state) { + final router = context.router; - bloc.add( - SearchHouseholdsSearchByHouseholdHeadEvent( - searchText: searchController.text, - projectId: projectId, - ), - ); - }, - ); - }, - childCount: searchState.householdMembers.length, - ), - ), - ], - ); - }, - ), - bottomNavigationBar: SizedBox( - height: 85, - child: DigitCard( - margin: const EdgeInsets.only(left: 0, right: 0, top: 10), - child: BlocBuilder( - builder: (context, state) { - final router = context.router; - - final searchQuery = state.searchQuery; - VoidCallback? onPressed; - - onPressed = - state.loading || searchQuery == null || searchQuery.isEmpty + final searchQuery = state.searchQuery; + VoidCallback? onPressed; + + onPressed = state.loading || + searchQuery == null || + searchQuery.isEmpty ? null : () { FocusManager.instance.primaryFocus?.unfocus(); @@ -176,18 +291,20 @@ class _SearchBeneficiaryPageState )); }; - return DigitElevatedButton( - onPressed: onPressed, - child: Center( - child: Text(localizations.translate( - i18.searchBeneficiary.beneficiaryAddActionLabel, - )), - ), - ); - }, + return DigitElevatedButton( + onPressed: onPressed, + child: Center( + child: Text(localizations.translate( + i18.searchBeneficiary.beneficiaryAddActionLabel, + )), + ), + ); + }, + ), + ), ), - ), - ), + ); + }, ), ); } diff --git a/apps/health_campaign_field_worker_app/lib/utils/constants.dart b/apps/health_campaign_field_worker_app/lib/utils/constants.dart index deafc8cac..75d61e866 100644 --- a/apps/health_campaign_field_worker_app/lib/utils/constants.dart +++ b/apps/health_campaign_field_worker_app/lib/utils/constants.dart @@ -12,6 +12,7 @@ import '../data/local_store/no_sql/schema/oplog.dart'; import '../data/local_store/no_sql/schema/row_versions.dart'; import '../data/local_store/no_sql/schema/service_registry.dart'; import '../data/local_store/sql_store/sql_store.dart'; +import '../data/repositories/local/address.dart'; import '../data/repositories/local/boundary.dart'; import '../data/repositories/local/facility.dart'; import '../data/repositories/local/household.dart'; diff --git a/apps/health_campaign_field_worker_app/lib/utils/i18_key_constants.dart b/apps/health_campaign_field_worker_app/lib/utils/i18_key_constants.dart index 4016f0395..7e78ef78b 100644 --- a/apps/health_campaign_field_worker_app/lib/utils/i18_key_constants.dart +++ b/apps/health_campaign_field_worker_app/lib/utils/i18_key_constants.dart @@ -179,8 +179,12 @@ class SearchBeneficiary { String get beneficiaryAddActionLabel => 'BENEFICIARY_ADD_ACTION_LABEL'; String get iconLabel => 'ICON_LABEL'; + String get yearsAbbr => 'YEARS_ABBR'; + String get monthsAbbr => 'MONTHS_ABBR'; + + String get proximityLabel => 'PROXIMITY_LABEL'; } class IndividualDetails { diff --git a/apps/health_campaign_field_worker_app/lib/utils/typedefs.dart b/apps/health_campaign_field_worker_app/lib/utils/typedefs.dart index a049626cd..ca7afb02e 100644 --- a/apps/health_campaign_field_worker_app/lib/utils/typedefs.dart +++ b/apps/health_campaign_field_worker_app/lib/utils/typedefs.dart @@ -4,6 +4,8 @@ import '../models/entities/user.dart'; typedef FacilityDataRepository = DataRepository; +typedef AddressDataRepository + = DataRepository; typedef HouseholdDataRepository = DataRepository; typedef HouseholdMemberDataRepository diff --git a/apps/health_campaign_field_worker_app/lib/utils/utils.dart b/apps/health_campaign_field_worker_app/lib/utils/utils.dart index 21a9fb31b..4330edb27 100644 --- a/apps/health_campaign_field_worker_app/lib/utils/utils.dart +++ b/apps/health_campaign_field_worker_app/lib/utils/utils.dart @@ -1,7 +1,7 @@ library app_utils; import 'dart:async'; - +import 'dart:math'; import 'package:connectivity_plus/connectivity_plus.dart'; import 'package:digit_components/theme/digit_theme.dart'; import 'package:digit_components/widgets/atoms/digit_toaster.dart'; @@ -135,6 +135,36 @@ performBackgroundService({ } } +class Coordinate { + final double latitude; + final double longitude; + + Coordinate(this.latitude, this.longitude); +} + +double calculateDistance(Coordinate start, Coordinate end) { + const double earthRadius = 6371.0; // Earth's radius in kilometers + + double toRadians(double degrees) { + return degrees * pi / 180.0; + } + + double lat1Rad = toRadians(start.latitude); + double lon1Rad = toRadians(start.longitude); + double lat2Rad = toRadians(end.latitude); + double lon2Rad = toRadians(end.longitude); + + double dLat = lat2Rad - lat1Rad; + double dLon = lon2Rad - lon1Rad; + + double a = pow(sin(dLat / 2), 2) + + cos(lat1Rad) * cos(lat2Rad) * pow(sin(dLon / 2), 2); + double c = 2 * atan2(sqrt(a), sqrt(1 - a)); + double distance = earthRadius * c; + + return distance; +} + Timer makePeriodicTimer( Duration duration, void Function(Timer timer) callback, { diff --git a/apps/health_campaign_field_worker_app/lib/widgets/beneficiary/view_beneficiary_card.dart b/apps/health_campaign_field_worker_app/lib/widgets/beneficiary/view_beneficiary_card.dart index 79d326300..238836582 100644 --- a/apps/health_campaign_field_worker_app/lib/widgets/beneficiary/view_beneficiary_card.dart +++ b/apps/health_campaign_field_worker_app/lib/widgets/beneficiary/view_beneficiary_card.dart @@ -14,12 +14,14 @@ import 'beneficiary_card.dart'; class ViewBeneficiaryCard extends LocalizedStatefulWidget { final HouseholdMemberWrapper householdMember; final VoidCallback? onOpenPressed; + final double? distance; const ViewBeneficiaryCard({ Key? key, super.appLocalizations, required this.householdMember, this.onOpenPressed, + this.distance, }) : super(key: key); @override @@ -168,7 +170,7 @@ class _ViewBeneficiaryCardState extends LocalizedState { householdMember.household.address?.pincode, ].whereNotNull().take(2).join(' '), subtitle: - '${householdMember.household.memberCount ?? 1} ${'Members'}', + '${householdMember.household.memberCount ?? 1} Members \n ${((widget.distance!) * 1000).round() > 999 ? '(${((widget.distance!).round())} km)' : '(${((widget.distance!) * 1000).round()} mts)'}', status: context.beneficiaryType != BeneficiaryType.individual ? householdMember.tasks?.first.status != null ? 'delivered' diff --git a/apps/health_campaign_field_worker_app/lib/widgets/member_card/member_card.dart b/apps/health_campaign_field_worker_app/lib/widgets/member_card/member_card.dart index a6244da3d..9834a04fe 100644 --- a/apps/health_campaign_field_worker_app/lib/widgets/member_card/member_card.dart +++ b/apps/health_campaign_field_worker_app/lib/widgets/member_card/member_card.dart @@ -14,8 +14,8 @@ import '../action_card/action_card.dart'; class MemberCard extends StatelessWidget { final String name; final String gender; - final int years; - final int months; + final int? years; + final int? months; final bool isHead; final IndividualModel individual; final bool isDelivered; @@ -29,7 +29,7 @@ class MemberCard extends StatelessWidget { required this.individual, required this.name, required this.gender, - required this.years, + this.years, this.isHead = false, this.months = 0, required this.localizations, @@ -130,7 +130,7 @@ class MemberCard extends StatelessWidget { ), Expanded( child: Text( - " | $years ${localizations.translate(i18.memberCard.deliverDetailsYearText)} $months ${localizations.translate(i18.memberCard.deliverDetailsMonthsText)}", + " | ${years ?? '-'} ${localizations.translate(i18.memberCard.deliverDetailsYearText)} ${months ?? '-'} ${localizations.translate(i18.memberCard.deliverDetailsMonthsText)}", style: theme.textTheme.bodyMedium, ), ), diff --git a/apps/health_campaign_field_worker_app/lib/widgets/network_manager_provider_wrapper.dart b/apps/health_campaign_field_worker_app/lib/widgets/network_manager_provider_wrapper.dart index 6d1a0786c..8007dd1b2 100644 --- a/apps/health_campaign_field_worker_app/lib/widgets/network_manager_provider_wrapper.dart +++ b/apps/health_campaign_field_worker_app/lib/widgets/network_manager_provider_wrapper.dart @@ -14,6 +14,7 @@ import '../blocs/app_initialization/app_initialization.dart'; import '../data/data_repository.dart'; import '../data/local_store/sql_store/sql_store.dart'; import '../data/network_manager.dart'; +import '../data/repositories/local/address.dart'; import '../data/repositories/local/boundary.dart'; import '../data/repositories/local/facility.dart'; import '../data/repositories/local/household.dart'; diff --git a/apps/health_campaign_field_worker_app/pubspec.lock b/apps/health_campaign_field_worker_app/pubspec.lock index 5e0375f52..5d3aea763 100644 --- a/apps/health_campaign_field_worker_app/pubspec.lock +++ b/apps/health_campaign_field_worker_app/pubspec.lock @@ -1158,10 +1158,10 @@ packages: dependency: transitive description: name: plugin_platform_interface - sha256: dbf0f707c78beedc9200146ad3cb0ab4d5da13c246336987be6940f026500d3a + sha256: "43798d895c929056255600343db8f049921cbec94d31ec87f1dc5c16c01935dd" url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.5" pluto_grid: dependency: "direct main" description: diff --git a/apps/health_campaign_field_worker_app/pubspec.yaml b/apps/health_campaign_field_worker_app/pubspec.yaml index 663987ea2..7d5fe7607 100644 --- a/apps/health_campaign_field_worker_app/pubspec.yaml +++ b/apps/health_campaign_field_worker_app/pubspec.yaml @@ -46,6 +46,7 @@ dependencies: url_launcher: ^6.1.10 connectivity_plus: ^4.0.1 material_design_icons_flutter: ^6.0.7096 + shared_preferences: ^2.1.0 pretty_dio_logger: ^1.2.0-beta-1 pluto_grid: ^7.0.1