diff --git a/apps/health_campaign_field_worker_app/lib/blocs/app_initialization/app_initialization.dart b/apps/health_campaign_field_worker_app/lib/blocs/app_initialization/app_initialization.dart index e37a4a6930..27745a84aa 100644 --- a/apps/health_campaign_field_worker_app/lib/blocs/app_initialization/app_initialization.dart +++ b/apps/health_campaign_field_worker_app/lib/blocs/app_initialization/app_initialization.dart @@ -316,7 +316,6 @@ class MdmsConfig { final List serviceRegistryList; final List? dashboardConfigSchema; - const MdmsConfig( {required this.appConfigs, required this.serviceRegistryList, diff --git a/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.dart b/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.dart index 61c278aeb2..253e7da6f1 100644 --- a/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.dart +++ b/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'package:digit_data_model/data_model.dart'; +import 'package:digit_data_model/models/entities/household_type.dart'; import 'package:disk_space_update/disk_space_update.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; @@ -11,6 +12,7 @@ import 'package:sync_service/sync_service_lib.dart'; import '../../data/local_store/no_sql/schema/app_configuration.dart'; import '../../data/local_store/secure_store/secure_store.dart'; import '../../data/repositories/remote/bandwidth_check.dart'; +import '../../data/repositories/remote/downsync.dart'; import '../../models/downsync/downsync.dart'; import '../../utils/background_service.dart'; import '../../utils/environment_config.dart'; @@ -23,20 +25,19 @@ class BeneficiaryDownSyncBloc extends Bloc { final LocalRepository individualLocalRepository; - final RemoteRepository - downSyncRemoteRepository; + final DownsyncRemoteRepository downSyncRemoteRepository; final LocalRepository downSyncLocalRepository; final BandwidthCheckRepository bandwidthCheckRepository; final LocalRepository - householdLocalRepository; + householdLocalRepository; final LocalRepository - householdMemberLocalRepository; + householdMemberLocalRepository; final LocalRepository - projectBeneficiaryLocalRepository; + projectBeneficiaryLocalRepository; final LocalRepository taskLocalRepository; final LocalRepository - sideEffectLocalRepository; + sideEffectLocalRepository; final LocalRepository referralLocalRepository; BeneficiaryDownSyncBloc({ @@ -107,6 +108,8 @@ class BeneficiaryDownSyncBloc } else { emit(const BeneficiaryDownSyncState.loading(true)); await LocalSecureStore.instance.setManualSyncTrigger(true); + + int serverTotalCount = 0, clfServerCount = 0; final existingDownSyncData = await downSyncLocalRepository.search(DownsyncSearchModel( locality: event.boundaryCode, @@ -116,9 +119,38 @@ class BeneficiaryDownSyncBloc ? null : existingDownSyncData.first.lastSyncedTime; - //To get the server totalCount, - final initialResults = await downSyncRemoteRepository.downSync( - DownsyncSearchModel( + //Check if the event is for DISTRIBUTOR + if (event.isDistributor) { + //To get the server totalCount, + final initialResults = await downSyncRemoteRepository.downSync( + DownsyncSearchModel( + locality: event.boundaryCode, + offset: existingDownSyncData.firstOrNull?.offset ?? 0, + limit: 1, + isDeleted: true, + lastSyncedTime: lastSyncedTime, + tenantId: envConfig.variables.tenantId, + projectId: event.projectId, + ), + ); + + //If API request failed, reset the State and emit a failure state + if (initialResults.isEmpty) { + await LocalSecureStore.instance.setManualSyncTrigger(false); + emit(const BeneficiaryDownSyncState.resetState()); + emit(const BeneficiaryDownSyncState.totalCountCheckFailed()); + return; + } + + //Extract server total count + serverTotalCount = initialResults["DownsyncCriteria"]["totalCount"]; + } + + //Check if the event is for COMMUNITY_CREATOR + if (event.isCommunityCreator) { + //To get the CLF server totalCount + final initialResults = await downSyncRemoteRepository + .searchClfDownSync(DownsyncSearchModel( locality: event.boundaryCode, offset: existingDownSyncData.firstOrNull?.offset ?? 0, limit: 1, @@ -126,22 +158,26 @@ class BeneficiaryDownSyncBloc lastSyncedTime: lastSyncedTime, tenantId: envConfig.variables.tenantId, projectId: event.projectId, - ), - ); - if (initialResults.isNotEmpty) { - // Current response from server is String, Expecting it to be int - //[TODO: Need to move the dynamic keys to constants - int serverTotalCount = initialResults["DownsyncCriteria"]["totalCount"]; - - emit(BeneficiaryDownSyncState.dataFound( - serverTotalCount, - event.batchSize, )); - } else { - await LocalSecureStore.instance.setManualSyncTrigger(false); - emit(const BeneficiaryDownSyncState.resetState()); - emit(const BeneficiaryDownSyncState.totalCountCheckFailed()); + + //If API request failed, reset the State and emit a failure state + if (initialResults.isEmpty) { + await LocalSecureStore.instance.setManualSyncTrigger(false); + emit(const BeneficiaryDownSyncState.resetState()); + emit(const BeneficiaryDownSyncState.totalCountCheckFailed()); + return; + } + + //Extract clf total count + clfServerCount = initialResults["DownsyncCriteria"]["totalCount"]; } + + // Emit a new state indicating that data has been found. Pass the server's total count, and clf total count + emit(BeneficiaryDownSyncState.dataFound( + serverTotalCount, + clfServerCount, + event.batchSize, + )); } } @@ -169,23 +205,42 @@ class BeneficiaryDownSyncBloc int offset = existingDownSyncData.isEmpty ? 0 : existingDownSyncData.first.offset ?? 0; + + int clfOffset = existingDownSyncData.isEmpty + ? 0 + : existingDownSyncData.first.clfOffset ?? 0; + int totalCount = event.initialServerCount; + + int clfTotalCount = event.clfServerCount; + int? lastSyncedTime = existingDownSyncData.isEmpty ? null : existingDownSyncData.first.lastSyncedTime; + if (existingDownSyncData.isEmpty) { await downSyncLocalRepository.create(DownsyncModel( offset: offset, + clfOffset: clfOffset, limit: event.batchSize, lastSyncedTime: lastSyncedTime, totalCount: totalCount, + clfTotalCount: clfTotalCount, locality: event.boundaryCode, boundaryName: event.boundaryName, )); } - if (offset < totalCount) { - emit(BeneficiaryDownSyncState.inProgress(offset, totalCount)); + //Flag to check if any API calls are made, if not then break out of loop + bool flag = false; + + emit(BeneficiaryDownSyncState.inProgress( + offset, totalCount, clfTotalCount)); + + //Check if logged in user has role DISTRIBUTOR and offset value is less than totalcount + //then make API call + if (event.isDistributor && offset < totalCount) { + flag = true; //Make the batch API call final downSyncResults = await downSyncRemoteRepository.downSync( DownsyncSearchModel( @@ -199,6 +254,7 @@ class BeneficiaryDownSyncBloc isDeleted: true, ), ); + // check if the API response is there or it failed if (downSyncResults.isNotEmpty) { await SyncServiceSingleton() @@ -214,15 +270,6 @@ class BeneficiaryDownSyncBloc ]); // Update the local downSync data for the boundary with the new values totalCount = downSyncResults["DownsyncCriteria"]["totalCount"]; - - await downSyncLocalRepository.update(DownsyncModel( - offset: offset + event.batchSize, - limit: event.batchSize, - lastSyncedTime: lastSyncedTime, - totalCount: totalCount, - locality: event.boundaryCode, - boundaryName: event.boundaryName, - )); } // When API response failed else { @@ -230,12 +277,87 @@ class BeneficiaryDownSyncBloc await LocalSecureStore.instance.setManualSyncTrigger(false); break; } - } else { + } + + //Check if logged in user has role COMMUNITY_CREATOR and clfOffset value is less than clfTotalCount + //then make API call + if (event.isCommunityCreator && clfOffset < clfTotalCount) { + flag = true; + + //Get households + final downSyncResults = await downSyncRemoteRepository + .searchClfDownSync(DownsyncSearchModel( + locality: event.boundaryCode, + offset: clfOffset, + limit: event.batchSize, + totalCount: clfTotalCount, + tenantId: envConfig.variables.tenantId, + projectId: event.projectId, + lastSyncedTime: lastSyncedTime, + isDeleted: true, + )); + + if (downSyncResults.isNotEmpty) { + final householdList = downSyncResults["Households"] as List; + final memberCountList = + downSyncResults["numberOfMembers"] as List; + int idx = 0; + + //Get memberData for each household + householdList.forEach((e) async { + int memberOffset = 0; + int memberCount = memberCountList[idx++]; + while (memberCount > 0) { + final memberData = await downSyncRemoteRepository + .getMemberData(DownsyncSearchModel( + locality: event.boundaryCode, + offset: memberOffset, + limit: event.batchSize, + totalCount: clfTotalCount, + tenantId: envConfig.variables.tenantId, + projectId: event.projectId, + lastSyncedTime: lastSyncedTime, + isDeleted: true, + householdId: e["id"], + )); + + if (memberData.isEmpty) break; + if (memberData["Households"] == null) { + memberData["Households"] = []; + memberData["Households"].add(e); + } + await SyncServiceSingleton() + .entityMapper + ?.writeToEntityDB(memberData, [ + individualLocalRepository, + householdLocalRepository, + householdMemberLocalRepository, + projectBeneficiaryLocalRepository, + taskLocalRepository, + sideEffectLocalRepository, + referralLocalRepository, + ]); + memberCount -= event.batchSize; + memberOffset += event.batchSize; + } + }); + + clfTotalCount = downSyncResults["DownsyncCriteria"]["totalCount"]; + } else { + emit(const BeneficiaryDownSyncState.failed()); + await LocalSecureStore.instance.setManualSyncTrigger(false); + break; + } + } + + if (!flag) { + //Update DownSync result await downSyncLocalRepository.update( existingDownSyncData.first.copyWith( offset: 0, limit: 0, totalCount: totalCount, + clfTotalCount: clfTotalCount, locality: event.boundaryCode, boundaryName: event.boundaryName, lastSyncedTime: DateTime.now().millisecondsSinceEpoch, @@ -243,14 +365,27 @@ class BeneficiaryDownSyncBloc ); final result = DownsyncModel( offset: totalCount, + clfOffset: clfTotalCount, lastSyncedTime: DateTime.now().millisecondsSinceEpoch, totalCount: totalCount, + clfTotalCount: clfTotalCount, locality: event.boundaryCode, boundaryName: event.boundaryName, ); await LocalSecureStore.instance.setManualSyncTrigger(false); emit(BeneficiaryDownSyncState.success(result)); - break; // If offset is greater than or equal to totalCount, exit the loop + break; + } else { + await downSyncLocalRepository.update(DownsyncModel( + offset: (totalCount != 0) ? offset + event.batchSize : 0, + clfOffset: (clfTotalCount != 0) ? clfOffset + event.batchSize : 0, + limit: event.batchSize, + lastSyncedTime: lastSyncedTime, + totalCount: totalCount, + clfTotalCount: clfTotalCount, + locality: event.boundaryCode, + boundaryName: event.boundaryName, + )); } } } catch (e) { @@ -276,7 +411,10 @@ class BeneficiaryDownSyncEvent with _$BeneficiaryDownSyncEvent { required String boundaryCode, required int batchSize, required int initialServerCount, + required int clfServerCount, required String boundaryName, + required bool isCommunityCreator, + required bool isDistributor, }) = DownSyncBeneficiaryEvent; const factory BeneficiaryDownSyncEvent.checkForData({ @@ -285,6 +423,8 @@ class BeneficiaryDownSyncEvent with _$BeneficiaryDownSyncEvent { required int pendingSyncCount, required int batchSize, required String boundaryName, + required bool isCommunityCreator, + required bool isDistributor, }) = DownSyncCheckTotalCountEvent; const factory BeneficiaryDownSyncEvent.getBatchSize({ @@ -307,6 +447,7 @@ class BeneficiaryDownSyncState with _$BeneficiaryDownSyncState { const factory BeneficiaryDownSyncState.inProgress( int syncedCount, int totalCount, + int clfTotalCount, ) = _DownSyncInProgressState; const factory BeneficiaryDownSyncState.success( DownsyncModel downSyncResult, @@ -324,6 +465,7 @@ class BeneficiaryDownSyncState with _$BeneficiaryDownSyncState { _DownSyncInsufficientStorageState; const factory BeneficiaryDownSyncState.dataFound( int initialServerCount, + int initialClfServerCount, int batchSize, ) = _DownSyncDataFoundState; const factory BeneficiaryDownSyncState.resetState() = _DownSyncResetState; diff --git a/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.freezed.dart b/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.freezed.dart index 092150d1b5..4501c5177b 100644 --- a/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.freezed.dart +++ b/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.freezed.dart @@ -18,11 +18,24 @@ final _privateConstructorUsedError = UnsupportedError( mixin _$BeneficiaryDownSyncEvent { @optionalTypeArgs TResult when({ - required TResult Function(String projectId, String boundaryCode, - int batchSize, int initialServerCount, String boundaryName) + required TResult Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor) downSync, - required TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName) + required TResult Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor) checkForData, required TResult Function( List appConfiguration, @@ -37,11 +50,24 @@ mixin _$BeneficiaryDownSyncEvent { throw _privateConstructorUsedError; @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? + TResult? Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? downSync, - TResult? Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? + TResult? Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? checkForData, TResult? Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? @@ -52,11 +78,24 @@ mixin _$BeneficiaryDownSyncEvent { throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeWhen({ - TResult Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? + TResult Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? downSync, - TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? + TResult Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? checkForData, TResult Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? @@ -127,7 +166,10 @@ abstract class _$$DownSyncBeneficiaryEventImplCopyWith<$Res> { String boundaryCode, int batchSize, int initialServerCount, - String boundaryName}); + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor}); } /// @nodoc @@ -147,7 +189,10 @@ class __$$DownSyncBeneficiaryEventImplCopyWithImpl<$Res> Object? boundaryCode = null, Object? batchSize = null, Object? initialServerCount = null, + Object? clfServerCount = null, Object? boundaryName = null, + Object? isCommunityCreator = null, + Object? isDistributor = null, }) { return _then(_$DownSyncBeneficiaryEventImpl( projectId: null == projectId @@ -166,10 +211,22 @@ class __$$DownSyncBeneficiaryEventImplCopyWithImpl<$Res> ? _value.initialServerCount : initialServerCount // ignore: cast_nullable_to_non_nullable as int, + clfServerCount: null == clfServerCount + ? _value.clfServerCount + : clfServerCount // ignore: cast_nullable_to_non_nullable + as int, boundaryName: null == boundaryName ? _value.boundaryName : boundaryName // ignore: cast_nullable_to_non_nullable as String, + isCommunityCreator: null == isCommunityCreator + ? _value.isCommunityCreator + : isCommunityCreator // ignore: cast_nullable_to_non_nullable + as bool, + isDistributor: null == isDistributor + ? _value.isDistributor + : isDistributor // ignore: cast_nullable_to_non_nullable + as bool, )); } } @@ -182,7 +239,10 @@ class _$DownSyncBeneficiaryEventImpl implements DownSyncBeneficiaryEvent { required this.boundaryCode, required this.batchSize, required this.initialServerCount, - required this.boundaryName}); + required this.clfServerCount, + required this.boundaryName, + required this.isCommunityCreator, + required this.isDistributor}); @override final String projectId; @@ -193,11 +253,17 @@ class _$DownSyncBeneficiaryEventImpl implements DownSyncBeneficiaryEvent { @override final int initialServerCount; @override + final int clfServerCount; + @override final String boundaryName; + @override + final bool isCommunityCreator; + @override + final bool isDistributor; @override String toString() { - return 'BeneficiaryDownSyncEvent.downSync(projectId: $projectId, boundaryCode: $boundaryCode, batchSize: $batchSize, initialServerCount: $initialServerCount, boundaryName: $boundaryName)'; + return 'BeneficiaryDownSyncEvent.downSync(projectId: $projectId, boundaryCode: $boundaryCode, batchSize: $batchSize, initialServerCount: $initialServerCount, clfServerCount: $clfServerCount, boundaryName: $boundaryName, isCommunityCreator: $isCommunityCreator, isDistributor: $isDistributor)'; } @override @@ -213,13 +279,27 @@ class _$DownSyncBeneficiaryEventImpl implements DownSyncBeneficiaryEvent { other.batchSize == batchSize) && (identical(other.initialServerCount, initialServerCount) || other.initialServerCount == initialServerCount) && + (identical(other.clfServerCount, clfServerCount) || + other.clfServerCount == clfServerCount) && (identical(other.boundaryName, boundaryName) || - other.boundaryName == boundaryName)); + other.boundaryName == boundaryName) && + (identical(other.isCommunityCreator, isCommunityCreator) || + other.isCommunityCreator == isCommunityCreator) && + (identical(other.isDistributor, isDistributor) || + other.isDistributor == isDistributor)); } @override - int get hashCode => Object.hash(runtimeType, projectId, boundaryCode, - batchSize, initialServerCount, boundaryName); + int get hashCode => Object.hash( + runtimeType, + projectId, + boundaryCode, + batchSize, + initialServerCount, + clfServerCount, + boundaryName, + isCommunityCreator, + isDistributor); @JsonKey(ignore: true) @override @@ -231,11 +311,24 @@ class _$DownSyncBeneficiaryEventImpl implements DownSyncBeneficiaryEvent { @override @optionalTypeArgs TResult when({ - required TResult Function(String projectId, String boundaryCode, - int batchSize, int initialServerCount, String boundaryName) + required TResult Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor) downSync, - required TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName) + required TResult Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor) checkForData, required TResult Function( List appConfiguration, @@ -247,18 +340,31 @@ class _$DownSyncBeneficiaryEventImpl implements DownSyncBeneficiaryEvent { required TResult Function() downSyncReport, required TResult Function() resetState, }) { - return downSync( - projectId, boundaryCode, batchSize, initialServerCount, boundaryName); + return downSync(projectId, boundaryCode, batchSize, initialServerCount, + clfServerCount, boundaryName, isCommunityCreator, isDistributor); } @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? + TResult? Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? downSync, - TResult? Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? + TResult? Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? checkForData, TResult? Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? @@ -267,17 +373,37 @@ class _$DownSyncBeneficiaryEventImpl implements DownSyncBeneficiaryEvent { TResult? Function()? resetState, }) { return downSync?.call( - projectId, boundaryCode, batchSize, initialServerCount, boundaryName); + projectId, + boundaryCode, + batchSize, + initialServerCount, + clfServerCount, + boundaryName, + isCommunityCreator, + isDistributor); } @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? + TResult Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? downSync, - TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? + TResult Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? checkForData, TResult Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? @@ -287,8 +413,8 @@ class _$DownSyncBeneficiaryEventImpl implements DownSyncBeneficiaryEvent { required TResult orElse(), }) { if (downSync != null) { - return downSync( - projectId, boundaryCode, batchSize, initialServerCount, boundaryName); + return downSync(projectId, boundaryCode, batchSize, initialServerCount, + clfServerCount, boundaryName, isCommunityCreator, isDistributor); } return orElse(); } @@ -340,13 +466,19 @@ abstract class DownSyncBeneficiaryEvent implements BeneficiaryDownSyncEvent { required final String boundaryCode, required final int batchSize, required final int initialServerCount, - required final String boundaryName}) = _$DownSyncBeneficiaryEventImpl; + required final int clfServerCount, + required final String boundaryName, + required final bool isCommunityCreator, + required final bool isDistributor}) = _$DownSyncBeneficiaryEventImpl; String get projectId; String get boundaryCode; int get batchSize; int get initialServerCount; + int get clfServerCount; String get boundaryName; + bool get isCommunityCreator; + bool get isDistributor; @JsonKey(ignore: true) _$$DownSyncBeneficiaryEventImplCopyWith<_$DownSyncBeneficiaryEventImpl> get copyWith => throw _privateConstructorUsedError; @@ -364,7 +496,9 @@ abstract class _$$DownSyncCheckTotalCountEventImplCopyWith<$Res> { String boundaryCode, int pendingSyncCount, int batchSize, - String boundaryName}); + String boundaryName, + bool isCommunityCreator, + bool isDistributor}); } /// @nodoc @@ -385,6 +519,8 @@ class __$$DownSyncCheckTotalCountEventImplCopyWithImpl<$Res> Object? pendingSyncCount = null, Object? batchSize = null, Object? boundaryName = null, + Object? isCommunityCreator = null, + Object? isDistributor = null, }) { return _then(_$DownSyncCheckTotalCountEventImpl( projectId: null == projectId @@ -407,6 +543,14 @@ class __$$DownSyncCheckTotalCountEventImplCopyWithImpl<$Res> ? _value.boundaryName : boundaryName // ignore: cast_nullable_to_non_nullable as String, + isCommunityCreator: null == isCommunityCreator + ? _value.isCommunityCreator + : isCommunityCreator // ignore: cast_nullable_to_non_nullable + as bool, + isDistributor: null == isDistributor + ? _value.isDistributor + : isDistributor // ignore: cast_nullable_to_non_nullable + as bool, )); } } @@ -420,7 +564,9 @@ class _$DownSyncCheckTotalCountEventImpl required this.boundaryCode, required this.pendingSyncCount, required this.batchSize, - required this.boundaryName}); + required this.boundaryName, + required this.isCommunityCreator, + required this.isDistributor}); @override final String projectId; @@ -432,10 +578,14 @@ class _$DownSyncCheckTotalCountEventImpl final int batchSize; @override final String boundaryName; + @override + final bool isCommunityCreator; + @override + final bool isDistributor; @override String toString() { - return 'BeneficiaryDownSyncEvent.checkForData(projectId: $projectId, boundaryCode: $boundaryCode, pendingSyncCount: $pendingSyncCount, batchSize: $batchSize, boundaryName: $boundaryName)'; + return 'BeneficiaryDownSyncEvent.checkForData(projectId: $projectId, boundaryCode: $boundaryCode, pendingSyncCount: $pendingSyncCount, batchSize: $batchSize, boundaryName: $boundaryName, isCommunityCreator: $isCommunityCreator, isDistributor: $isDistributor)'; } @override @@ -452,12 +602,23 @@ class _$DownSyncCheckTotalCountEventImpl (identical(other.batchSize, batchSize) || other.batchSize == batchSize) && (identical(other.boundaryName, boundaryName) || - other.boundaryName == boundaryName)); + other.boundaryName == boundaryName) && + (identical(other.isCommunityCreator, isCommunityCreator) || + other.isCommunityCreator == isCommunityCreator) && + (identical(other.isDistributor, isDistributor) || + other.isDistributor == isDistributor)); } @override - int get hashCode => Object.hash(runtimeType, projectId, boundaryCode, - pendingSyncCount, batchSize, boundaryName); + int get hashCode => Object.hash( + runtimeType, + projectId, + boundaryCode, + pendingSyncCount, + batchSize, + boundaryName, + isCommunityCreator, + isDistributor); @JsonKey(ignore: true) @override @@ -470,11 +631,24 @@ class _$DownSyncCheckTotalCountEventImpl @override @optionalTypeArgs TResult when({ - required TResult Function(String projectId, String boundaryCode, - int batchSize, int initialServerCount, String boundaryName) + required TResult Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor) downSync, - required TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName) + required TResult Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor) checkForData, required TResult Function( List appConfiguration, @@ -486,18 +660,31 @@ class _$DownSyncCheckTotalCountEventImpl required TResult Function() downSyncReport, required TResult Function() resetState, }) { - return checkForData( - projectId, boundaryCode, pendingSyncCount, batchSize, boundaryName); + return checkForData(projectId, boundaryCode, pendingSyncCount, batchSize, + boundaryName, isCommunityCreator, isDistributor); } @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? + TResult? Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? downSync, - TResult? Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? + TResult? Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? checkForData, TResult? Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? @@ -505,18 +692,31 @@ class _$DownSyncCheckTotalCountEventImpl TResult? Function()? downSyncReport, TResult? Function()? resetState, }) { - return checkForData?.call( - projectId, boundaryCode, pendingSyncCount, batchSize, boundaryName); + return checkForData?.call(projectId, boundaryCode, pendingSyncCount, + batchSize, boundaryName, isCommunityCreator, isDistributor); } @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? + TResult Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? downSync, - TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? + TResult Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? checkForData, TResult Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? @@ -526,8 +726,8 @@ class _$DownSyncCheckTotalCountEventImpl required TResult orElse(), }) { if (checkForData != null) { - return checkForData( - projectId, boundaryCode, pendingSyncCount, batchSize, boundaryName); + return checkForData(projectId, boundaryCode, pendingSyncCount, batchSize, + boundaryName, isCommunityCreator, isDistributor); } return orElse(); } @@ -580,13 +780,17 @@ abstract class DownSyncCheckTotalCountEvent required final String boundaryCode, required final int pendingSyncCount, required final int batchSize, - required final String boundaryName}) = _$DownSyncCheckTotalCountEventImpl; + required final String boundaryName, + required final bool isCommunityCreator, + required final bool isDistributor}) = _$DownSyncCheckTotalCountEventImpl; String get projectId; String get boundaryCode; int get pendingSyncCount; int get batchSize; String get boundaryName; + bool get isCommunityCreator; + bool get isDistributor; @JsonKey(ignore: true) _$$DownSyncCheckTotalCountEventImplCopyWith< _$DownSyncCheckTotalCountEventImpl> @@ -722,11 +926,24 @@ class _$DownSyncGetBatchSizeEventImpl implements DownSyncGetBatchSizeEvent { @override @optionalTypeArgs TResult when({ - required TResult Function(String projectId, String boundaryCode, - int batchSize, int initialServerCount, String boundaryName) + required TResult Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor) downSync, - required TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName) + required TResult Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor) checkForData, required TResult Function( List appConfiguration, @@ -745,11 +962,24 @@ class _$DownSyncGetBatchSizeEventImpl implements DownSyncGetBatchSizeEvent { @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? + TResult? Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? downSync, - TResult? Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? + TResult? Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? checkForData, TResult? Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? @@ -764,11 +994,24 @@ class _$DownSyncGetBatchSizeEventImpl implements DownSyncGetBatchSizeEvent { @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? + TResult Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? downSync, - TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? + TResult Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? checkForData, TResult Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? @@ -883,11 +1126,24 @@ class _$DownSyncReportEventImpl implements DownSyncReportEvent { @override @optionalTypeArgs TResult when({ - required TResult Function(String projectId, String boundaryCode, - int batchSize, int initialServerCount, String boundaryName) + required TResult Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor) downSync, - required TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName) + required TResult Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor) checkForData, required TResult Function( List appConfiguration, @@ -905,11 +1161,24 @@ class _$DownSyncReportEventImpl implements DownSyncReportEvent { @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? + TResult? Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? downSync, - TResult? Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? + TResult? Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? checkForData, TResult? Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? @@ -923,11 +1192,24 @@ class _$DownSyncReportEventImpl implements DownSyncReportEvent { @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? + TResult Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? downSync, - TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? + TResult Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? checkForData, TResult Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? @@ -1029,11 +1311,24 @@ class _$DownSyncResetStateEventImpl implements DownSyncResetStateEvent { @override @optionalTypeArgs TResult when({ - required TResult Function(String projectId, String boundaryCode, - int batchSize, int initialServerCount, String boundaryName) + required TResult Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor) downSync, - required TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName) + required TResult Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor) checkForData, required TResult Function( List appConfiguration, @@ -1051,11 +1346,24 @@ class _$DownSyncResetStateEventImpl implements DownSyncResetStateEvent { @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? + TResult? Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? downSync, - TResult? Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? + TResult? Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? checkForData, TResult? Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? @@ -1069,11 +1377,24 @@ class _$DownSyncResetStateEventImpl implements DownSyncResetStateEvent { @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? + TResult Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? downSync, - TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? + TResult Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? checkForData, TResult Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? @@ -1137,14 +1458,18 @@ abstract class DownSyncResetStateEvent implements BeneficiaryDownSyncEvent { mixin _$BeneficiaryDownSyncState { @optionalTypeArgs TResult when({ - required TResult Function(int syncedCount, int totalCount) inProgress, + required TResult Function( + int syncedCount, int totalCount, int clfTotalCount) + inProgress, required TResult Function(DownsyncModel downSyncResult) success, required TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName) getBatchSize, required TResult Function(bool isPop) loading, required TResult Function() insufficientStorage, - required TResult Function(int initialServerCount, int batchSize) dataFound, + required TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize) + dataFound, required TResult Function() resetState, required TResult Function() totalCountCheckFailed, required TResult Function() failed, @@ -1154,14 +1479,17 @@ mixin _$BeneficiaryDownSyncState { throw _privateConstructorUsedError; @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(int syncedCount, int totalCount)? inProgress, + TResult? Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult? Function(DownsyncModel downSyncResult)? success, TResult? Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult? Function(bool isPop)? loading, TResult? Function()? insufficientStorage, - TResult? Function(int initialServerCount, int batchSize)? dataFound, + TResult? Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult? Function()? resetState, TResult? Function()? totalCountCheckFailed, TResult? Function()? failed, @@ -1171,14 +1499,17 @@ mixin _$BeneficiaryDownSyncState { throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeWhen({ - TResult Function(int syncedCount, int totalCount)? inProgress, + TResult Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult Function(DownsyncModel downSyncResult)? success, TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult Function(bool isPop)? loading, TResult Function()? insufficientStorage, - TResult Function(int initialServerCount, int batchSize)? dataFound, + TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult Function()? resetState, TResult Function()? totalCountCheckFailed, TResult Function()? failed, @@ -1267,7 +1598,7 @@ abstract class _$$DownSyncInProgressStateImplCopyWith<$Res> { $Res Function(_$DownSyncInProgressStateImpl) then) = __$$DownSyncInProgressStateImplCopyWithImpl<$Res>; @useResult - $Res call({int syncedCount, int totalCount}); + $Res call({int syncedCount, int totalCount, int clfTotalCount}); } /// @nodoc @@ -1285,6 +1616,7 @@ class __$$DownSyncInProgressStateImplCopyWithImpl<$Res> $Res call({ Object? syncedCount = null, Object? totalCount = null, + Object? clfTotalCount = null, }) { return _then(_$DownSyncInProgressStateImpl( null == syncedCount @@ -1295,6 +1627,10 @@ class __$$DownSyncInProgressStateImplCopyWithImpl<$Res> ? _value.totalCount : totalCount // ignore: cast_nullable_to_non_nullable as int, + null == clfTotalCount + ? _value.clfTotalCount + : clfTotalCount // ignore: cast_nullable_to_non_nullable + as int, )); } } @@ -1302,17 +1638,20 @@ class __$$DownSyncInProgressStateImplCopyWithImpl<$Res> /// @nodoc class _$DownSyncInProgressStateImpl extends _DownSyncInProgressState { - const _$DownSyncInProgressStateImpl(this.syncedCount, this.totalCount) + const _$DownSyncInProgressStateImpl( + this.syncedCount, this.totalCount, this.clfTotalCount) : super._(); @override final int syncedCount; @override final int totalCount; + @override + final int clfTotalCount; @override String toString() { - return 'BeneficiaryDownSyncState.inProgress(syncedCount: $syncedCount, totalCount: $totalCount)'; + return 'BeneficiaryDownSyncState.inProgress(syncedCount: $syncedCount, totalCount: $totalCount, clfTotalCount: $clfTotalCount)'; } @override @@ -1323,11 +1662,14 @@ class _$DownSyncInProgressStateImpl extends _DownSyncInProgressState { (identical(other.syncedCount, syncedCount) || other.syncedCount == syncedCount) && (identical(other.totalCount, totalCount) || - other.totalCount == totalCount)); + other.totalCount == totalCount) && + (identical(other.clfTotalCount, clfTotalCount) || + other.clfTotalCount == clfTotalCount)); } @override - int get hashCode => Object.hash(runtimeType, syncedCount, totalCount); + int get hashCode => + Object.hash(runtimeType, syncedCount, totalCount, clfTotalCount); @JsonKey(ignore: true) @override @@ -1339,54 +1681,64 @@ class _$DownSyncInProgressStateImpl extends _DownSyncInProgressState { @override @optionalTypeArgs TResult when({ - required TResult Function(int syncedCount, int totalCount) inProgress, + required TResult Function( + int syncedCount, int totalCount, int clfTotalCount) + inProgress, required TResult Function(DownsyncModel downSyncResult) success, required TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName) getBatchSize, required TResult Function(bool isPop) loading, required TResult Function() insufficientStorage, - required TResult Function(int initialServerCount, int batchSize) dataFound, + required TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize) + dataFound, required TResult Function() resetState, required TResult Function() totalCountCheckFailed, required TResult Function() failed, required TResult Function(List downsyncCriteriaList) report, required TResult Function() pendingSync, }) { - return inProgress(syncedCount, totalCount); + return inProgress(syncedCount, totalCount, clfTotalCount); } @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(int syncedCount, int totalCount)? inProgress, + TResult? Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult? Function(DownsyncModel downSyncResult)? success, TResult? Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult? Function(bool isPop)? loading, TResult? Function()? insufficientStorage, - TResult? Function(int initialServerCount, int batchSize)? dataFound, + TResult? Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult? Function()? resetState, TResult? Function()? totalCountCheckFailed, TResult? Function()? failed, TResult? Function(List downsyncCriteriaList)? report, TResult? Function()? pendingSync, }) { - return inProgress?.call(syncedCount, totalCount); + return inProgress?.call(syncedCount, totalCount, clfTotalCount); } @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(int syncedCount, int totalCount)? inProgress, + TResult Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult Function(DownsyncModel downSyncResult)? success, TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult Function(bool isPop)? loading, TResult Function()? insufficientStorage, - TResult Function(int initialServerCount, int batchSize)? dataFound, + TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult Function()? resetState, TResult Function()? totalCountCheckFailed, TResult Function()? failed, @@ -1395,7 +1747,7 @@ class _$DownSyncInProgressStateImpl extends _DownSyncInProgressState { required TResult orElse(), }) { if (inProgress != null) { - return inProgress(syncedCount, totalCount); + return inProgress(syncedCount, totalCount, clfTotalCount); } return orElse(); } @@ -1467,12 +1819,14 @@ class _$DownSyncInProgressStateImpl extends _DownSyncInProgressState { abstract class _DownSyncInProgressState extends BeneficiaryDownSyncState { const factory _DownSyncInProgressState( - final int syncedCount, final int totalCount) = - _$DownSyncInProgressStateImpl; + final int syncedCount, + final int totalCount, + final int clfTotalCount) = _$DownSyncInProgressStateImpl; const _DownSyncInProgressState._() : super._(); int get syncedCount; int get totalCount; + int get clfTotalCount; @JsonKey(ignore: true) _$$DownSyncInProgressStateImplCopyWith<_$DownSyncInProgressStateImpl> get copyWith => throw _privateConstructorUsedError; @@ -1546,14 +1900,18 @@ class _$DownSyncSuccessStateImpl extends _DownSyncSuccessState { @override @optionalTypeArgs TResult when({ - required TResult Function(int syncedCount, int totalCount) inProgress, + required TResult Function( + int syncedCount, int totalCount, int clfTotalCount) + inProgress, required TResult Function(DownsyncModel downSyncResult) success, required TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName) getBatchSize, required TResult Function(bool isPop) loading, required TResult Function() insufficientStorage, - required TResult Function(int initialServerCount, int batchSize) dataFound, + required TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize) + dataFound, required TResult Function() resetState, required TResult Function() totalCountCheckFailed, required TResult Function() failed, @@ -1566,14 +1924,17 @@ class _$DownSyncSuccessStateImpl extends _DownSyncSuccessState { @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(int syncedCount, int totalCount)? inProgress, + TResult? Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult? Function(DownsyncModel downSyncResult)? success, TResult? Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult? Function(bool isPop)? loading, TResult? Function()? insufficientStorage, - TResult? Function(int initialServerCount, int batchSize)? dataFound, + TResult? Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult? Function()? resetState, TResult? Function()? totalCountCheckFailed, TResult? Function()? failed, @@ -1586,14 +1947,17 @@ class _$DownSyncSuccessStateImpl extends _DownSyncSuccessState { @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(int syncedCount, int totalCount)? inProgress, + TResult Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult Function(DownsyncModel downSyncResult)? success, TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult Function(bool isPop)? loading, TResult Function()? insufficientStorage, - TResult Function(int initialServerCount, int batchSize)? dataFound, + TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult Function()? resetState, TResult Function()? totalCountCheckFailed, TResult Function()? failed, @@ -1796,14 +2160,18 @@ class _$DownSyncGetBatchSizeStateImpl extends _DownSyncGetBatchSizeState { @override @optionalTypeArgs TResult when({ - required TResult Function(int syncedCount, int totalCount) inProgress, + required TResult Function( + int syncedCount, int totalCount, int clfTotalCount) + inProgress, required TResult Function(DownsyncModel downSyncResult) success, required TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName) getBatchSize, required TResult Function(bool isPop) loading, required TResult Function() insufficientStorage, - required TResult Function(int initialServerCount, int batchSize) dataFound, + required TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize) + dataFound, required TResult Function() resetState, required TResult Function() totalCountCheckFailed, required TResult Function() failed, @@ -1817,14 +2185,17 @@ class _$DownSyncGetBatchSizeStateImpl extends _DownSyncGetBatchSizeState { @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(int syncedCount, int totalCount)? inProgress, + TResult? Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult? Function(DownsyncModel downSyncResult)? success, TResult? Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult? Function(bool isPop)? loading, TResult? Function()? insufficientStorage, - TResult? Function(int initialServerCount, int batchSize)? dataFound, + TResult? Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult? Function()? resetState, TResult? Function()? totalCountCheckFailed, TResult? Function()? failed, @@ -1838,14 +2209,17 @@ class _$DownSyncGetBatchSizeStateImpl extends _DownSyncGetBatchSizeState { @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(int syncedCount, int totalCount)? inProgress, + TResult Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult Function(DownsyncModel downSyncResult)? success, TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult Function(bool isPop)? loading, TResult Function()? insufficientStorage, - TResult Function(int initialServerCount, int batchSize)? dataFound, + TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult Function()? resetState, TResult Function()? totalCountCheckFailed, TResult Function()? failed, @@ -2011,14 +2385,18 @@ class _$DownSyncLoadingStateImpl extends _DownSyncLoadingState { @override @optionalTypeArgs TResult when({ - required TResult Function(int syncedCount, int totalCount) inProgress, + required TResult Function( + int syncedCount, int totalCount, int clfTotalCount) + inProgress, required TResult Function(DownsyncModel downSyncResult) success, required TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName) getBatchSize, required TResult Function(bool isPop) loading, required TResult Function() insufficientStorage, - required TResult Function(int initialServerCount, int batchSize) dataFound, + required TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize) + dataFound, required TResult Function() resetState, required TResult Function() totalCountCheckFailed, required TResult Function() failed, @@ -2031,14 +2409,17 @@ class _$DownSyncLoadingStateImpl extends _DownSyncLoadingState { @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(int syncedCount, int totalCount)? inProgress, + TResult? Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult? Function(DownsyncModel downSyncResult)? success, TResult? Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult? Function(bool isPop)? loading, TResult? Function()? insufficientStorage, - TResult? Function(int initialServerCount, int batchSize)? dataFound, + TResult? Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult? Function()? resetState, TResult? Function()? totalCountCheckFailed, TResult? Function()? failed, @@ -2051,14 +2432,17 @@ class _$DownSyncLoadingStateImpl extends _DownSyncLoadingState { @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(int syncedCount, int totalCount)? inProgress, + TResult Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult Function(DownsyncModel downSyncResult)? success, TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult Function(bool isPop)? loading, TResult Function()? insufficientStorage, - TResult Function(int initialServerCount, int batchSize)? dataFound, + TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult Function()? resetState, TResult Function()? totalCountCheckFailed, TResult Function()? failed, @@ -2191,14 +2575,18 @@ class _$DownSyncInsufficientStorageStateImpl @override @optionalTypeArgs TResult when({ - required TResult Function(int syncedCount, int totalCount) inProgress, + required TResult Function( + int syncedCount, int totalCount, int clfTotalCount) + inProgress, required TResult Function(DownsyncModel downSyncResult) success, required TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName) getBatchSize, required TResult Function(bool isPop) loading, required TResult Function() insufficientStorage, - required TResult Function(int initialServerCount, int batchSize) dataFound, + required TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize) + dataFound, required TResult Function() resetState, required TResult Function() totalCountCheckFailed, required TResult Function() failed, @@ -2211,14 +2599,17 @@ class _$DownSyncInsufficientStorageStateImpl @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(int syncedCount, int totalCount)? inProgress, + TResult? Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult? Function(DownsyncModel downSyncResult)? success, TResult? Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult? Function(bool isPop)? loading, TResult? Function()? insufficientStorage, - TResult? Function(int initialServerCount, int batchSize)? dataFound, + TResult? Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult? Function()? resetState, TResult? Function()? totalCountCheckFailed, TResult? Function()? failed, @@ -2231,14 +2622,17 @@ class _$DownSyncInsufficientStorageStateImpl @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(int syncedCount, int totalCount)? inProgress, + TResult Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult Function(DownsyncModel downSyncResult)? success, TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult Function(bool isPop)? loading, TResult Function()? insufficientStorage, - TResult Function(int initialServerCount, int batchSize)? dataFound, + TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult Function()? resetState, TResult Function()? totalCountCheckFailed, TResult Function()? failed, @@ -2331,7 +2725,7 @@ abstract class _$$DownSyncDataFoundStateImplCopyWith<$Res> { $Res Function(_$DownSyncDataFoundStateImpl) then) = __$$DownSyncDataFoundStateImplCopyWithImpl<$Res>; @useResult - $Res call({int initialServerCount, int batchSize}); + $Res call({int initialServerCount, int initialClfServerCount, int batchSize}); } /// @nodoc @@ -2348,6 +2742,7 @@ class __$$DownSyncDataFoundStateImplCopyWithImpl<$Res> @override $Res call({ Object? initialServerCount = null, + Object? initialClfServerCount = null, Object? batchSize = null, }) { return _then(_$DownSyncDataFoundStateImpl( @@ -2355,6 +2750,10 @@ class __$$DownSyncDataFoundStateImplCopyWithImpl<$Res> ? _value.initialServerCount : initialServerCount // ignore: cast_nullable_to_non_nullable as int, + null == initialClfServerCount + ? _value.initialClfServerCount + : initialClfServerCount // ignore: cast_nullable_to_non_nullable + as int, null == batchSize ? _value.batchSize : batchSize // ignore: cast_nullable_to_non_nullable @@ -2366,17 +2765,20 @@ class __$$DownSyncDataFoundStateImplCopyWithImpl<$Res> /// @nodoc class _$DownSyncDataFoundStateImpl extends _DownSyncDataFoundState { - const _$DownSyncDataFoundStateImpl(this.initialServerCount, this.batchSize) + const _$DownSyncDataFoundStateImpl( + this.initialServerCount, this.initialClfServerCount, this.batchSize) : super._(); @override final int initialServerCount; @override + final int initialClfServerCount; + @override final int batchSize; @override String toString() { - return 'BeneficiaryDownSyncState.dataFound(initialServerCount: $initialServerCount, batchSize: $batchSize)'; + return 'BeneficiaryDownSyncState.dataFound(initialServerCount: $initialServerCount, initialClfServerCount: $initialClfServerCount, batchSize: $batchSize)'; } @override @@ -2386,12 +2788,15 @@ class _$DownSyncDataFoundStateImpl extends _DownSyncDataFoundState { other is _$DownSyncDataFoundStateImpl && (identical(other.initialServerCount, initialServerCount) || other.initialServerCount == initialServerCount) && + (identical(other.initialClfServerCount, initialClfServerCount) || + other.initialClfServerCount == initialClfServerCount) && (identical(other.batchSize, batchSize) || other.batchSize == batchSize)); } @override - int get hashCode => Object.hash(runtimeType, initialServerCount, batchSize); + int get hashCode => Object.hash( + runtimeType, initialServerCount, initialClfServerCount, batchSize); @JsonKey(ignore: true) @override @@ -2403,54 +2808,65 @@ class _$DownSyncDataFoundStateImpl extends _DownSyncDataFoundState { @override @optionalTypeArgs TResult when({ - required TResult Function(int syncedCount, int totalCount) inProgress, + required TResult Function( + int syncedCount, int totalCount, int clfTotalCount) + inProgress, required TResult Function(DownsyncModel downSyncResult) success, required TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName) getBatchSize, required TResult Function(bool isPop) loading, required TResult Function() insufficientStorage, - required TResult Function(int initialServerCount, int batchSize) dataFound, + required TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize) + dataFound, required TResult Function() resetState, required TResult Function() totalCountCheckFailed, required TResult Function() failed, required TResult Function(List downsyncCriteriaList) report, required TResult Function() pendingSync, }) { - return dataFound(initialServerCount, batchSize); + return dataFound(initialServerCount, initialClfServerCount, batchSize); } @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(int syncedCount, int totalCount)? inProgress, + TResult? Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult? Function(DownsyncModel downSyncResult)? success, TResult? Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult? Function(bool isPop)? loading, TResult? Function()? insufficientStorage, - TResult? Function(int initialServerCount, int batchSize)? dataFound, + TResult? Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult? Function()? resetState, TResult? Function()? totalCountCheckFailed, TResult? Function()? failed, TResult? Function(List downsyncCriteriaList)? report, TResult? Function()? pendingSync, }) { - return dataFound?.call(initialServerCount, batchSize); + return dataFound?.call( + initialServerCount, initialClfServerCount, batchSize); } @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(int syncedCount, int totalCount)? inProgress, + TResult Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult Function(DownsyncModel downSyncResult)? success, TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult Function(bool isPop)? loading, TResult Function()? insufficientStorage, - TResult Function(int initialServerCount, int batchSize)? dataFound, + TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult Function()? resetState, TResult Function()? totalCountCheckFailed, TResult Function()? failed, @@ -2459,7 +2875,7 @@ class _$DownSyncDataFoundStateImpl extends _DownSyncDataFoundState { required TResult orElse(), }) { if (dataFound != null) { - return dataFound(initialServerCount, batchSize); + return dataFound(initialServerCount, initialClfServerCount, batchSize); } return orElse(); } @@ -2531,11 +2947,13 @@ class _$DownSyncDataFoundStateImpl extends _DownSyncDataFoundState { abstract class _DownSyncDataFoundState extends BeneficiaryDownSyncState { const factory _DownSyncDataFoundState( - final int initialServerCount, final int batchSize) = - _$DownSyncDataFoundStateImpl; + final int initialServerCount, + final int initialClfServerCount, + final int batchSize) = _$DownSyncDataFoundStateImpl; const _DownSyncDataFoundState._() : super._(); int get initialServerCount; + int get initialClfServerCount; int get batchSize; @JsonKey(ignore: true) _$$DownSyncDataFoundStateImplCopyWith<_$DownSyncDataFoundStateImpl> @@ -2581,14 +2999,18 @@ class _$DownSyncResetStateImpl extends _DownSyncResetState { @override @optionalTypeArgs TResult when({ - required TResult Function(int syncedCount, int totalCount) inProgress, + required TResult Function( + int syncedCount, int totalCount, int clfTotalCount) + inProgress, required TResult Function(DownsyncModel downSyncResult) success, required TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName) getBatchSize, required TResult Function(bool isPop) loading, required TResult Function() insufficientStorage, - required TResult Function(int initialServerCount, int batchSize) dataFound, + required TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize) + dataFound, required TResult Function() resetState, required TResult Function() totalCountCheckFailed, required TResult Function() failed, @@ -2601,14 +3023,17 @@ class _$DownSyncResetStateImpl extends _DownSyncResetState { @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(int syncedCount, int totalCount)? inProgress, + TResult? Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult? Function(DownsyncModel downSyncResult)? success, TResult? Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult? Function(bool isPop)? loading, TResult? Function()? insufficientStorage, - TResult? Function(int initialServerCount, int batchSize)? dataFound, + TResult? Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult? Function()? resetState, TResult? Function()? totalCountCheckFailed, TResult? Function()? failed, @@ -2621,14 +3046,17 @@ class _$DownSyncResetStateImpl extends _DownSyncResetState { @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(int syncedCount, int totalCount)? inProgress, + TResult Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult Function(DownsyncModel downSyncResult)? success, TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult Function(bool isPop)? loading, TResult Function()? insufficientStorage, - TResult Function(int initialServerCount, int batchSize)? dataFound, + TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult Function()? resetState, TResult Function()? totalCountCheckFailed, TResult Function()? failed, @@ -2755,14 +3183,18 @@ class _$DownSynnCountCheckFailedStateImpl @override @optionalTypeArgs TResult when({ - required TResult Function(int syncedCount, int totalCount) inProgress, + required TResult Function( + int syncedCount, int totalCount, int clfTotalCount) + inProgress, required TResult Function(DownsyncModel downSyncResult) success, required TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName) getBatchSize, required TResult Function(bool isPop) loading, required TResult Function() insufficientStorage, - required TResult Function(int initialServerCount, int batchSize) dataFound, + required TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize) + dataFound, required TResult Function() resetState, required TResult Function() totalCountCheckFailed, required TResult Function() failed, @@ -2775,14 +3207,17 @@ class _$DownSynnCountCheckFailedStateImpl @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(int syncedCount, int totalCount)? inProgress, + TResult? Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult? Function(DownsyncModel downSyncResult)? success, TResult? Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult? Function(bool isPop)? loading, TResult? Function()? insufficientStorage, - TResult? Function(int initialServerCount, int batchSize)? dataFound, + TResult? Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult? Function()? resetState, TResult? Function()? totalCountCheckFailed, TResult? Function()? failed, @@ -2795,14 +3230,17 @@ class _$DownSynnCountCheckFailedStateImpl @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(int syncedCount, int totalCount)? inProgress, + TResult Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult Function(DownsyncModel downSyncResult)? success, TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult Function(bool isPop)? loading, TResult Function()? insufficientStorage, - TResult Function(int initialServerCount, int batchSize)? dataFound, + TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult Function()? resetState, TResult Function()? totalCountCheckFailed, TResult Function()? failed, @@ -2927,14 +3365,18 @@ class _$DownSyncFailureStateImpl extends _DownSyncFailureState { @override @optionalTypeArgs TResult when({ - required TResult Function(int syncedCount, int totalCount) inProgress, + required TResult Function( + int syncedCount, int totalCount, int clfTotalCount) + inProgress, required TResult Function(DownsyncModel downSyncResult) success, required TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName) getBatchSize, required TResult Function(bool isPop) loading, required TResult Function() insufficientStorage, - required TResult Function(int initialServerCount, int batchSize) dataFound, + required TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize) + dataFound, required TResult Function() resetState, required TResult Function() totalCountCheckFailed, required TResult Function() failed, @@ -2947,14 +3389,17 @@ class _$DownSyncFailureStateImpl extends _DownSyncFailureState { @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(int syncedCount, int totalCount)? inProgress, + TResult? Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult? Function(DownsyncModel downSyncResult)? success, TResult? Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult? Function(bool isPop)? loading, TResult? Function()? insufficientStorage, - TResult? Function(int initialServerCount, int batchSize)? dataFound, + TResult? Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult? Function()? resetState, TResult? Function()? totalCountCheckFailed, TResult? Function()? failed, @@ -2967,14 +3412,17 @@ class _$DownSyncFailureStateImpl extends _DownSyncFailureState { @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(int syncedCount, int totalCount)? inProgress, + TResult Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult Function(DownsyncModel downSyncResult)? success, TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult Function(bool isPop)? loading, TResult Function()? insufficientStorage, - TResult Function(int initialServerCount, int batchSize)? dataFound, + TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult Function()? resetState, TResult Function()? totalCountCheckFailed, TResult Function()? failed, @@ -3135,14 +3583,18 @@ class _$DownSyncReportStateImpl extends _DownSyncReportState { @override @optionalTypeArgs TResult when({ - required TResult Function(int syncedCount, int totalCount) inProgress, + required TResult Function( + int syncedCount, int totalCount, int clfTotalCount) + inProgress, required TResult Function(DownsyncModel downSyncResult) success, required TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName) getBatchSize, required TResult Function(bool isPop) loading, required TResult Function() insufficientStorage, - required TResult Function(int initialServerCount, int batchSize) dataFound, + required TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize) + dataFound, required TResult Function() resetState, required TResult Function() totalCountCheckFailed, required TResult Function() failed, @@ -3155,14 +3607,17 @@ class _$DownSyncReportStateImpl extends _DownSyncReportState { @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(int syncedCount, int totalCount)? inProgress, + TResult? Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult? Function(DownsyncModel downSyncResult)? success, TResult? Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult? Function(bool isPop)? loading, TResult? Function()? insufficientStorage, - TResult? Function(int initialServerCount, int batchSize)? dataFound, + TResult? Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult? Function()? resetState, TResult? Function()? totalCountCheckFailed, TResult? Function()? failed, @@ -3175,14 +3630,17 @@ class _$DownSyncReportStateImpl extends _DownSyncReportState { @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(int syncedCount, int totalCount)? inProgress, + TResult Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult Function(DownsyncModel downSyncResult)? success, TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult Function(bool isPop)? loading, TResult Function()? insufficientStorage, - TResult Function(int initialServerCount, int batchSize)? dataFound, + TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult Function()? resetState, TResult Function()? totalCountCheckFailed, TResult Function()? failed, @@ -3315,14 +3773,18 @@ class _$DownSyncPendingSyncStateImpl extends _DownSyncPendingSyncState { @override @optionalTypeArgs TResult when({ - required TResult Function(int syncedCount, int totalCount) inProgress, + required TResult Function( + int syncedCount, int totalCount, int clfTotalCount) + inProgress, required TResult Function(DownsyncModel downSyncResult) success, required TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName) getBatchSize, required TResult Function(bool isPop) loading, required TResult Function() insufficientStorage, - required TResult Function(int initialServerCount, int batchSize) dataFound, + required TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize) + dataFound, required TResult Function() resetState, required TResult Function() totalCountCheckFailed, required TResult Function() failed, @@ -3335,14 +3797,17 @@ class _$DownSyncPendingSyncStateImpl extends _DownSyncPendingSyncState { @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(int syncedCount, int totalCount)? inProgress, + TResult? Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult? Function(DownsyncModel downSyncResult)? success, TResult? Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult? Function(bool isPop)? loading, TResult? Function()? insufficientStorage, - TResult? Function(int initialServerCount, int batchSize)? dataFound, + TResult? Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult? Function()? resetState, TResult? Function()? totalCountCheckFailed, TResult? Function()? failed, @@ -3355,14 +3820,17 @@ class _$DownSyncPendingSyncStateImpl extends _DownSyncPendingSyncState { @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(int syncedCount, int totalCount)? inProgress, + TResult Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult Function(DownsyncModel downSyncResult)? success, TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult Function(bool isPop)? loading, TResult Function()? insufficientStorage, - TResult Function(int initialServerCount, int batchSize)? dataFound, + TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult Function()? resetState, TResult Function()? totalCountCheckFailed, TResult Function()? failed, diff --git a/apps/health_campaign_field_worker_app/lib/data/local_store/downsync/downsync.dart b/apps/health_campaign_field_worker_app/lib/data/local_store/downsync/downsync.dart index 9960641539..c0f7a95f1d 100644 --- a/apps/health_campaign_field_worker_app/lib/data/local_store/downsync/downsync.dart +++ b/apps/health_campaign_field_worker_app/lib/data/local_store/downsync/downsync.dart @@ -4,7 +4,6 @@ import 'package:digit_data_model/data_model.dart'; import 'package:drift/drift.dart'; import '../../../models/downsync/downsync.dart'; - class DownsyncLocalRepository extends LocalRepository { DownsyncLocalRepository(super.sql, super.opLogManager); @@ -69,6 +68,8 @@ class DownsyncLocalRepository return DownsyncModel( locality: data.locality, offset: data.offset, + clfOffset: data.clfOffset, + clfTotalCount: data.clfTotalCount, limit: data.offset, boundaryName: data.boundaryName, lastSyncedTime: data.lastSyncedTime, diff --git a/apps/health_campaign_field_worker_app/lib/data/repositories/remote/downsync.dart b/apps/health_campaign_field_worker_app/lib/data/repositories/remote/downsync.dart index d80ac81451..f791c87429 100644 --- a/apps/health_campaign_field_worker_app/lib/data/repositories/remote/downsync.dart +++ b/apps/health_campaign_field_worker_app/lib/data/repositories/remote/downsync.dart @@ -1,6 +1,8 @@ // Generated using mason. Do not modify by hand +import 'dart:async'; import 'package:digit_data_model/data_model.dart'; +import 'package:dio/dio.dart'; import '../../../models/downsync/downsync.dart'; class DownsyncRemoteRepository @@ -11,6 +13,124 @@ class DownsyncRemoteRepository super.entityName = 'Downsync', }); + String get searchClfPath => actionMap[ApiOperation.clfSearch] ?? ''; + + String get searchClfMemberData => + actionMap[ApiOperation.clfMemberSearch] ?? ''; + @override DataModelType get type => DataModelType.downsync; + + //DownSync CLF household + FutureOr> searchClfDownSync(DownsyncSearchModel query, + {int? offSet, int? limit}) async { + int defaultBatchSize = limit ?? 100; + int currentOffset = offSet ?? 0; + + Map finalResult = { + "Households": [], + "DownsyncCriteria": {}, + "numberOfMembers": [] + }; + + Response response; + response = await executeFuture(future: () async { + return await dio.post( + searchClfPath, + queryParameters: { + 'offset': currentOffset, + 'limit': defaultBatchSize, + 'tenantId': DigitDataModelSingleton().tenantId, + if (query.isDeleted ?? false) 'includeDeleted': query.isDeleted + }, + data: { + isPlural ? entityNamePlural : 'DownsyncCriteria': + isPlural ? [query.toMap()] : query.toMap(), + }, + ); + }); + + //Execute the request + try {} catch (error) {} + + final responseMap = response.data; + + if (responseMap is! Map) { + throw InvalidApiResponseException( + data: query.toMap(), + path: searchClfPath, + response: responseMap, + ); + } + + //Check whether the response contains valid key + if (!responseMap.containsKey('Households')) { + throw InvalidApiResponseException( + data: query.toMap(), + path: searchPath, + response: responseMap, + ); + } + + final entityResponse = responseMap['Households']; + + final householdMap = entityResponse['HouseholdCountMap'] as List; + + try { + for (var item in householdMap) { + if (item is Map && item.containsKey('household')) { + finalResult["Households"].add(item['household']); + finalResult["numberOfMembers"].add(item['numberOfMembers']); + } + } + } catch (e) { + rethrow; + } + + finalResult["DownsyncCriteria"] = entityResponse['DownsyncCriteria']; + + return finalResult; + } + + //DownSync MemberData for each household + FutureOr> getMemberData(DownsyncSearchModel query, + {int? offSet, int? limit}) async { + Response response; + + try { + response = await executeFuture( + future: () async { + return await dio.post( + searchClfMemberData, + queryParameters: { + 'offset': offSet ?? 0, + 'limit': limit ?? 100, + 'tenantId': DigitDataModelSingleton().tenantId, + if (query.isDeleted ?? false) 'includeDeleted': query.isDeleted, + }, + data: { + entityName == 'Downsync' ? 'DownsyncCriteria' : entityName: + query.toMap(), + }, + ); + }, + ); + } catch (error) { + return {}; + } + + final responseMap = response.data; + + if (!responseMap.containsKey( + entityName, + )) { + throw InvalidApiResponseException( + data: query.toMap(), + path: searchPath, + response: responseMap, + ); + } + + return responseMap[entityName]; + } } diff --git a/apps/health_campaign_field_worker_app/lib/models/downsync/downsync.dart b/apps/health_campaign_field_worker_app/lib/models/downsync/downsync.dart index 7aa6ca5c2e..22ddf74129 100644 --- a/apps/health_campaign_field_worker_app/lib/models/downsync/downsync.dart +++ b/apps/health_campaign_field_worker_app/lib/models/downsync/downsync.dart @@ -7,7 +7,8 @@ import 'package:digit_data_model/data_model.dart'; part 'downsync.mapper.dart'; @MappableClass(ignoreNull: true, discriminatorValue: MappableClass.useAsDefault) -class DownsyncSearchModel extends EntitySearchModel with DownsyncSearchModelMappable { +class DownsyncSearchModel extends EntitySearchModel + with DownsyncSearchModelMappable { final String? locality; final String? projectId; final int? offset; @@ -16,7 +17,8 @@ class DownsyncSearchModel extends EntitySearchModel with DownsyncSearchModelMapp final int? totalCount; final String? boundaryName; final String? tenantId; - + final String? householdId; + DownsyncSearchModel({ this.locality, this.projectId, @@ -26,9 +28,10 @@ class DownsyncSearchModel extends EntitySearchModel with DownsyncSearchModelMapp this.totalCount, this.boundaryName, this.tenantId, + this.householdId, super.boundaryCode, super.isDeleted, - }): super(); + }) : super(); @MappableConstructor() DownsyncSearchModel.ignoreDeleted({ @@ -40,25 +43,28 @@ class DownsyncSearchModel extends EntitySearchModel with DownsyncSearchModelMapp this.totalCount, this.boundaryName, this.tenantId, + this.householdId, super.boundaryCode, - }): super(isDeleted: false); + }) : super(isDeleted: false); } @MappableClass(ignoreNull: true, discriminatorValue: MappableClass.useAsDefault) class DownsyncModel extends EntityModel with DownsyncModelMappable { - static const schemaName = 'Downsync'; final String? locality; final String? projectId; final int? offset; + final int? clfOffset; final int? limit; final int? lastSyncedTime; final int? totalCount; + final int? clfTotalCount; final String? boundaryName; final bool? nonRecoverableError; final String? tenantId; final int? rowVersion; + final String? householdId; final DownsyncAdditionalFields? additionalFields; DownsyncModel({ @@ -66,6 +72,8 @@ class DownsyncModel extends EntityModel with DownsyncModelMappable { this.locality, this.projectId, this.offset, + this.clfOffset, + this.clfTotalCount, this.limit, this.lastSyncedTime, this.totalCount, @@ -73,9 +81,11 @@ class DownsyncModel extends EntityModel with DownsyncModelMappable { this.nonRecoverableError = false, this.tenantId, this.rowVersion, - super.auditDetails,super.clientAuditDetails, + this.householdId, + super.auditDetails, + super.clientAuditDetails, super.isDeleted = false, - }): super(); + }) : super(); DownsyncCompanion get companion { return DownsyncCompanion( @@ -92,6 +102,8 @@ class DownsyncModel extends EntityModel with DownsyncModelMappable { locality: Value(locality), projectId: Value(projectId), offset: Value(offset), + clfOffset: Value(clfOffset), + clfTotalCount: Value(clfTotalCount), limit: Value(limit), lastSyncedTime: Value(lastSyncedTime), totalCount: Value(totalCount), @@ -99,16 +111,16 @@ class DownsyncModel extends EntityModel with DownsyncModelMappable { nonRecoverableError: Value(nonRecoverableError), tenantId: Value(tenantId), rowVersion: Value(rowVersion), - ); + ); } } @MappableClass(ignoreNull: true, discriminatorValue: MappableClass.useAsDefault) -class DownsyncAdditionalFields extends AdditionalFields with DownsyncAdditionalFieldsMappable { +class DownsyncAdditionalFields extends AdditionalFields + with DownsyncAdditionalFieldsMappable { DownsyncAdditionalFields({ super.schema = 'Downsync', required super.version, super.fields, }); } - diff --git a/apps/health_campaign_field_worker_app/lib/models/downsync/downsync.mapper.dart b/apps/health_campaign_field_worker_app/lib/models/downsync/downsync.mapper.dart index 41a7184bee..81426fb457 100644 --- a/apps/health_campaign_field_worker_app/lib/models/downsync/downsync.mapper.dart +++ b/apps/health_campaign_field_worker_app/lib/models/downsync/downsync.mapper.dart @@ -45,6 +45,9 @@ class DownsyncSearchModelMapper static String? _$tenantId(DownsyncSearchModel v) => v.tenantId; static const Field _f$tenantId = Field('tenantId', _$tenantId, opt: true); + static String? _$householdId(DownsyncSearchModel v) => v.householdId; + static const Field _f$householdId = + Field('householdId', _$householdId, opt: true); static String? _$boundaryCode(DownsyncSearchModel v) => v.boundaryCode; static const Field _f$boundaryCode = Field('boundaryCode', _$boundaryCode, opt: true); @@ -67,6 +70,7 @@ class DownsyncSearchModelMapper #totalCount: _f$totalCount, #boundaryName: _f$boundaryName, #tenantId: _f$tenantId, + #householdId: _f$householdId, #boundaryCode: _f$boundaryCode, #auditDetails: _f$auditDetails, #additionalFields: _f$additionalFields, @@ -92,6 +96,7 @@ class DownsyncSearchModelMapper totalCount: data.dec(_f$totalCount), boundaryName: data.dec(_f$boundaryName), tenantId: data.dec(_f$tenantId), + householdId: data.dec(_f$householdId), boundaryCode: data.dec(_f$boundaryCode)); } @@ -160,6 +165,7 @@ abstract class DownsyncSearchModelCopyWith<$R, $In extends DownsyncSearchModel, int? totalCount, String? boundaryName, String? tenantId, + String? householdId, String? boundaryCode}); DownsyncSearchModelCopyWith<$R2, $In, $Out2> $chain<$R2, $Out2>( Then<$Out2, $R2> t); @@ -183,6 +189,7 @@ class _DownsyncSearchModelCopyWithImpl<$R, $Out> Object? totalCount = $none, Object? boundaryName = $none, Object? tenantId = $none, + Object? householdId = $none, Object? boundaryCode = $none}) => $apply(FieldCopyWithData({ if (locality != $none) #locality: locality, @@ -193,6 +200,7 @@ class _DownsyncSearchModelCopyWithImpl<$R, $Out> if (totalCount != $none) #totalCount: totalCount, if (boundaryName != $none) #boundaryName: boundaryName, if (tenantId != $none) #tenantId: tenantId, + if (householdId != $none) #householdId: householdId, if (boundaryCode != $none) #boundaryCode: boundaryCode })); @override @@ -206,6 +214,7 @@ class _DownsyncSearchModelCopyWithImpl<$R, $Out> totalCount: data.get(#totalCount, or: $value.totalCount), boundaryName: data.get(#boundaryName, or: $value.boundaryName), tenantId: data.get(#tenantId, or: $value.tenantId), + householdId: data.get(#householdId, or: $value.householdId), boundaryCode: data.get(#boundaryCode, or: $value.boundaryCode)); @override @@ -242,6 +251,12 @@ class DownsyncModelMapper extends SubClassMapperBase { static int? _$offset(DownsyncModel v) => v.offset; static const Field _f$offset = Field('offset', _$offset, opt: true); + static int? _$clfOffset(DownsyncModel v) => v.clfOffset; + static const Field _f$clfOffset = + Field('clfOffset', _$clfOffset, opt: true); + static int? _$clfTotalCount(DownsyncModel v) => v.clfTotalCount; + static const Field _f$clfTotalCount = + Field('clfTotalCount', _$clfTotalCount, opt: true); static int? _$limit(DownsyncModel v) => v.limit; static const Field _f$limit = Field('limit', _$limit, opt: true); @@ -264,6 +279,9 @@ class DownsyncModelMapper extends SubClassMapperBase { static int? _$rowVersion(DownsyncModel v) => v.rowVersion; static const Field _f$rowVersion = Field('rowVersion', _$rowVersion, opt: true); + static String? _$householdId(DownsyncModel v) => v.householdId; + static const Field _f$householdId = + Field('householdId', _$householdId, opt: true); static AuditDetails? _$auditDetails(DownsyncModel v) => v.auditDetails; static const Field _f$auditDetails = Field('auditDetails', _$auditDetails, opt: true); @@ -281,6 +299,8 @@ class DownsyncModelMapper extends SubClassMapperBase { #locality: _f$locality, #projectId: _f$projectId, #offset: _f$offset, + #clfOffset: _f$clfOffset, + #clfTotalCount: _f$clfTotalCount, #limit: _f$limit, #lastSyncedTime: _f$lastSyncedTime, #totalCount: _f$totalCount, @@ -288,6 +308,7 @@ class DownsyncModelMapper extends SubClassMapperBase { #nonRecoverableError: _f$nonRecoverableError, #tenantId: _f$tenantId, #rowVersion: _f$rowVersion, + #householdId: _f$householdId, #auditDetails: _f$auditDetails, #clientAuditDetails: _f$clientAuditDetails, #isDeleted: _f$isDeleted, @@ -309,6 +330,8 @@ class DownsyncModelMapper extends SubClassMapperBase { locality: data.dec(_f$locality), projectId: data.dec(_f$projectId), offset: data.dec(_f$offset), + clfOffset: data.dec(_f$clfOffset), + clfTotalCount: data.dec(_f$clfTotalCount), limit: data.dec(_f$limit), lastSyncedTime: data.dec(_f$lastSyncedTime), totalCount: data.dec(_f$totalCount), @@ -316,6 +339,7 @@ class DownsyncModelMapper extends SubClassMapperBase { nonRecoverableError: data.dec(_f$nonRecoverableError), tenantId: data.dec(_f$tenantId), rowVersion: data.dec(_f$rowVersion), + householdId: data.dec(_f$householdId), auditDetails: data.dec(_f$auditDetails), clientAuditDetails: data.dec(_f$clientAuditDetails), isDeleted: data.dec(_f$isDeleted)); @@ -387,6 +411,8 @@ abstract class DownsyncModelCopyWith<$R, $In extends DownsyncModel, $Out> String? locality, String? projectId, int? offset, + int? clfOffset, + int? clfTotalCount, int? limit, int? lastSyncedTime, int? totalCount, @@ -394,6 +420,7 @@ abstract class DownsyncModelCopyWith<$R, $In extends DownsyncModel, $Out> bool? nonRecoverableError, String? tenantId, int? rowVersion, + String? householdId, AuditDetails? auditDetails, ClientAuditDetails? clientAuditDetails, bool? isDeleted}); @@ -426,6 +453,8 @@ class _DownsyncModelCopyWithImpl<$R, $Out> Object? locality = $none, Object? projectId = $none, Object? offset = $none, + Object? clfOffset = $none, + Object? clfTotalCount = $none, Object? limit = $none, Object? lastSyncedTime = $none, Object? totalCount = $none, @@ -433,6 +462,7 @@ class _DownsyncModelCopyWithImpl<$R, $Out> Object? nonRecoverableError = $none, Object? tenantId = $none, Object? rowVersion = $none, + Object? householdId = $none, Object? auditDetails = $none, Object? clientAuditDetails = $none, Object? isDeleted = $none}) => @@ -441,6 +471,8 @@ class _DownsyncModelCopyWithImpl<$R, $Out> if (locality != $none) #locality: locality, if (projectId != $none) #projectId: projectId, if (offset != $none) #offset: offset, + if (clfOffset != $none) #clfOffset: clfOffset, + if (clfTotalCount != $none) #clfTotalCount: clfTotalCount, if (limit != $none) #limit: limit, if (lastSyncedTime != $none) #lastSyncedTime: lastSyncedTime, if (totalCount != $none) #totalCount: totalCount, @@ -449,6 +481,7 @@ class _DownsyncModelCopyWithImpl<$R, $Out> #nonRecoverableError: nonRecoverableError, if (tenantId != $none) #tenantId: tenantId, if (rowVersion != $none) #rowVersion: rowVersion, + if (householdId != $none) #householdId: householdId, if (auditDetails != $none) #auditDetails: auditDetails, if (clientAuditDetails != $none) #clientAuditDetails: clientAuditDetails, @@ -461,6 +494,8 @@ class _DownsyncModelCopyWithImpl<$R, $Out> locality: data.get(#locality, or: $value.locality), projectId: data.get(#projectId, or: $value.projectId), offset: data.get(#offset, or: $value.offset), + clfOffset: data.get(#clfOffset, or: $value.clfOffset), + clfTotalCount: data.get(#clfTotalCount, or: $value.clfTotalCount), limit: data.get(#limit, or: $value.limit), lastSyncedTime: data.get(#lastSyncedTime, or: $value.lastSyncedTime), totalCount: data.get(#totalCount, or: $value.totalCount), @@ -469,6 +504,7 @@ class _DownsyncModelCopyWithImpl<$R, $Out> data.get(#nonRecoverableError, or: $value.nonRecoverableError), tenantId: data.get(#tenantId, or: $value.tenantId), rowVersion: data.get(#rowVersion, or: $value.rowVersion), + householdId: data.get(#householdId, or: $value.householdId), auditDetails: data.get(#auditDetails, or: $value.auditDetails), clientAuditDetails: data.get(#clientAuditDetails, or: $value.clientAuditDetails), diff --git a/apps/health_campaign_field_worker_app/lib/models/entities/roles_type.dart b/apps/health_campaign_field_worker_app/lib/models/entities/roles_type.dart index 3488b2e6a7..337cec5be8 100644 --- a/apps/health_campaign_field_worker_app/lib/models/entities/roles_type.dart +++ b/apps/health_campaign_field_worker_app/lib/models/entities/roles_type.dart @@ -2,15 +2,26 @@ import 'package:dart_mappable/dart_mappable.dart'; part 'roles_type.mapper.dart'; + @MappableEnum(caseStyle: CaseStyle.upperCase) enum RolesType { - @MappableValue("WAREHOUSE_MANAGER") warehouseManager, - @MappableValue("DISTRIBUTOR") distributor, - @MappableValue("HEALTH_FACILITY_WORKER") healthFacilityWorker, - @MappableValue("DISTRICT_SUPERVISOR") districtSupervisor, - @MappableValue("FIELD_SUPERVISOR") fieldSupervisor, - @MappableValue("SUPERUSER") superuser, - @MappableValue("REGISTRAR") registrar, - @MappableValue("TEAM_SUPERVISOR") teamSupervisor, + @MappableValue("WAREHOUSE_MANAGER") + warehouseManager, + @MappableValue("DISTRIBUTOR") + distributor, + @MappableValue("HEALTH_FACILITY_WORKER") + healthFacilityWorker, + @MappableValue("DISTRICT_SUPERVISOR") + districtSupervisor, + @MappableValue("FIELD_SUPERVISOR") + fieldSupervisor, + @MappableValue("SUPERUSER") + superuser, + @MappableValue("REGISTRAR") + registrar, + @MappableValue("COMMUNITY_CREATOR") + communityCreator, + @MappableValue("TEAM_SUPERVISOR") + teamSupervisor, ; -} \ No newline at end of file +} diff --git a/apps/health_campaign_field_worker_app/lib/models/entities/roles_type.mapper.dart b/apps/health_campaign_field_worker_app/lib/models/entities/roles_type.mapper.dart index b37f62ef62..0542bef8dc 100644 --- a/apps/health_campaign_field_worker_app/lib/models/entities/roles_type.mapper.dart +++ b/apps/health_campaign_field_worker_app/lib/models/entities/roles_type.mapper.dart @@ -39,6 +39,8 @@ class RolesTypeMapper extends EnumMapper { return RolesType.superuser; case "REGISTRAR": return RolesType.registrar; + case "COMMUNITY_CREATOR": + return RolesType.communityCreator; case "TEAM_SUPERVISOR": return RolesType.teamSupervisor; default: @@ -63,6 +65,8 @@ class RolesTypeMapper extends EnumMapper { return "SUPERUSER"; case RolesType.registrar: return "REGISTRAR"; + case RolesType.communityCreator: + return "COMMUNITY_CREATOR"; case RolesType.teamSupervisor: return "TEAM_SUPERVISOR"; } 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 d2fdfbc21e..77e94b28cb 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/authenticated.dart +++ b/apps/health_campaign_field_worker_app/lib/pages/authenticated.dart @@ -28,6 +28,7 @@ import '../blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.da import '../data/local_store/no_sql/schema/app_configuration.dart'; import '../data/remote_client.dart'; import '../data/repositories/remote/bandwidth_check.dart'; +import '../data/repositories/remote/downsync.dart'; import '../models/downsync/downsync.dart'; import '../models/entities/roles_type.dart'; import '../router/app_router.dart'; @@ -186,9 +187,8 @@ class AuthenticatedPageWrapper extends StatelessWidget { individualLocalRepository: ctx.read< LocalRepository>(), - downSyncRemoteRepository: ctx.read< - RemoteRepository>(), + downSyncRemoteRepository: + ctx.read(), downSyncLocalRepository: ctx.read< LocalRepository>(), diff --git a/apps/health_campaign_field_worker_app/lib/pages/boundary_selection.dart b/apps/health_campaign_field_worker_app/lib/pages/boundary_selection.dart index 6e55d117ff..f216008ddb 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/boundary_selection.dart +++ b/apps/health_campaign_field_worker_app/lib/pages/boundary_selection.dart @@ -83,6 +83,12 @@ class _BoundarySelectionPageState ) .toList() .isNotEmpty; + bool isCommunityCreator = context.loggedInUserRoles + .where( + (role) => role.code == RolesType.communityCreator.toValue(), + ) + .toList() + .isNotEmpty; return PopScope( canPop: shouldPop, @@ -170,11 +176,11 @@ class _BoundarySelectionPageState boundaryCode, pendingSyncCount, boundaryName, - ) => - context - .read() - .add( - DownSyncCheckTotalCountEvent( + ) { + context + .read() + .add( + DownSyncCheckTotalCountEvent( projectId: context.projectId, boundaryCode: selectedBoundary! .value!.code @@ -185,8 +191,11 @@ class _BoundarySelectionPageState .value!.name .toString(), batchSize: batchSize, - ), - ), + isCommunityCreator: + isCommunityCreator, + isDistributor: isDistributor), + ); + }, pendingSync: () => showDownloadDialog( context, model: DownloadBeneficiary( @@ -211,14 +220,18 @@ class _BoundarySelectionPageState dialogType: DigitProgressDialogType.pendingSync, isPop: true, + isCommunityCreator: isCommunityCreator, + isDistributor: isDistributor, ), - dataFound: (initialServerCount, batchSize) { + dataFound: (initialServerCount, + initialClfServerCount, batchSize) { clickedStatus.value = false; showDownloadDialog( context, model: DownloadBeneficiary( title: localizations.translate( - initialServerCount > 0 + (initialServerCount > 0 || + initialClfServerCount > 0) ? i18.beneficiaryDetails .dataFound : i18.beneficiaryDetails @@ -231,8 +244,10 @@ class _BoundarySelectionPageState .toString(), batchSize: batchSize, totalCount: initialServerCount, + clfTotalCount: initialClfServerCount, content: localizations.translate( - initialServerCount > 0 + (initialServerCount > 0 || + initialClfServerCount > 0) ? i18.beneficiaryDetails .dataFoundContent : i18.beneficiaryDetails @@ -240,13 +255,15 @@ class _BoundarySelectionPageState ), primaryButtonLabel: localizations.translate( - initialServerCount > 0 + (initialServerCount > 0 || + initialClfServerCount > 0) ? i18.common.coreCommonDownload : i18.common.coreCommonGoback, ), secondaryButtonLabel: localizations.translate( - initialServerCount > 0 + initialServerCount > 0 || + initialClfServerCount > 0 ? i18.beneficiaryDetails .proceedWithoutDownloading : i18.acknowledgementSuccess @@ -259,12 +276,16 @@ class _BoundarySelectionPageState dialogType: DigitProgressDialogType.dataFound, isPop: true, + isCommunityCreator: isCommunityCreator, + isDistributor: isDistributor, ); }, - inProgress: (syncCount, totalCount) { + inProgress: + (syncCount, totalCount, clfTotalCount) { downloadProgress.add( min( - (syncCount) / (totalCount), + (syncCount) / + (totalCount + clfTotalCount), 1, ), ); @@ -283,8 +304,11 @@ class _BoundarySelectionPageState appConfiguartion: appConfiguration, syncCount: syncCount, totalCount: totalCount, + clfTotalCount: clfTotalCount, prefixLabel: syncCount.toString(), - suffixLabel: totalCount.toString(), + suffixLabel: + (totalCount + clfTotalCount) + .toString(), boundaryName: selectedBoundary .value!.name .toString(), @@ -294,6 +318,9 @@ class _BoundarySelectionPageState isPop: true, downloadProgressController: downloadProgress, + isCommunityCreator: + isCommunityCreator, + isDistributor: isDistributor, ); } }, @@ -316,7 +343,7 @@ class _BoundarySelectionPageState i18.beneficiaryDetails.downloadedon, )} $date\n${localizations.translate( i18.beneficiaryDetails.recordsdownload, - )} ${result.totalCount}/${result.totalCount}"; + )} ${result.totalCount! + result.clfTotalCount!}/${result.totalCount! + result.clfTotalCount!}"; Navigator.of( context, rootNavigator: true, @@ -382,66 +409,73 @@ class _BoundarySelectionPageState dialogType: DigitProgressDialogType.failed, isPop: true, + isCommunityCreator: isCommunityCreator, + isDistributor: isDistributor, ), totalCountCheckFailed: () => - showDownloadDialog( - context, - model: DownloadBeneficiary( - title: localizations.translate( - i18.beneficiaryDetails - .unableToCheckDataInServer, - ), - appConfiguartion: appConfiguration, - projectId: context.projectId, - pendingSyncCount: pendingSyncCount, - boundary: selectedBoundary!.value!.code - .toString(), - primaryButtonLabel: - localizations.translate( - i18.syncDialog.retryButtonLabel, - ), - secondaryButtonLabel: - localizations.translate( - i18.beneficiaryDetails - .proceedWithoutDownloading, - ), - boundaryName: selectedBoundary - .value!.name - .toString(), - ), - dialogType: - DigitProgressDialogType.checkFailed, - isPop: true, - ), + showDownloadDialog(context, + model: DownloadBeneficiary( + title: localizations.translate( + i18.beneficiaryDetails + .unableToCheckDataInServer, + ), + appConfiguartion: + appConfiguration, + projectId: context.projectId, + pendingSyncCount: + pendingSyncCount, + boundary: selectedBoundary! + .value!.code + .toString(), + primaryButtonLabel: + localizations.translate( + i18.syncDialog.retryButtonLabel, + ), + secondaryButtonLabel: + localizations.translate( + i18.beneficiaryDetails + .proceedWithoutDownloading, + ), + boundaryName: selectedBoundary + .value!.name + .toString(), + ), + dialogType: DigitProgressDialogType + .checkFailed, + isPop: true, + isCommunityCreator: + isCommunityCreator, + isDistributor: isDistributor), insufficientStorage: () { clickedStatus.value = false; - showDownloadDialog( - context, - model: DownloadBeneficiary( - title: localizations.translate( - i18.beneficiaryDetails - .insufficientStorage, - ), - content: localizations.translate(i18 - .beneficiaryDetails - .insufficientStorageContent), - projectId: context.projectId, - appConfiguartion: appConfiguration, - boundary: selectedBoundary! - .value!.code - .toString(), - primaryButtonLabel: - localizations.translate( - i18.common.coreCommonOk, + showDownloadDialog(context, + model: DownloadBeneficiary( + title: localizations.translate( + i18.beneficiaryDetails + .insufficientStorage, + ), + content: localizations.translate(i18 + .beneficiaryDetails + .insufficientStorageContent), + projectId: context.projectId, + appConfiguartion: appConfiguration, + boundary: selectedBoundary! + .value!.code + .toString(), + primaryButtonLabel: + localizations.translate( + i18.common.coreCommonOk, + ), + boundaryName: selectedBoundary + .value!.name + .toString(), ), - boundaryName: selectedBoundary - .value!.name - .toString(), - ), - dialogType: DigitProgressDialogType - .insufficientStorage, - isPop: true, - ); + dialogType: DigitProgressDialogType + .insufficientStorage, + isPop: true, + isCommunityCreator: + isCommunityCreator, + isDistributor: isDistributor); }, ); }); @@ -491,7 +525,8 @@ class _BoundarySelectionPageState if (context.mounted) { if (isOnline && - isDistributor) { + (isDistributor || + isCommunityCreator)) { context .read< BeneficiaryDownSyncBloc>() diff --git a/apps/health_campaign_field_worker_app/lib/pages/home.dart b/apps/health_campaign_field_worker_app/lib/pages/home.dart index 391ce163d0..3bbcf369d4 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/home.dart +++ b/apps/health_campaign_field_worker_app/lib/pages/home.dart @@ -605,11 +605,9 @@ class _HomePageState extends LocalizedState { .map((label) => homeItemsShowcaseMap[label]!) .toList(); - - if (envConfig.variables.envType == EnvType.demo && kReleaseMode) { - filteredLabels.remove(i18.home.db); - } - + if (envConfig.variables.envType == EnvType.demo && kReleaseMode) { + filteredLabels.remove(i18.home.db); + } final List widgetList = filteredLabels.map((label) => homeItemsMap[label]!).toList(); diff --git a/apps/health_campaign_field_worker_app/lib/pages/reports/beneficiary/beneficaries_report.dart b/apps/health_campaign_field_worker_app/lib/pages/reports/beneficiary/beneficaries_report.dart index 6ae5040b52..aa2ae3e368 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/reports/beneficiary/beneficaries_report.dart +++ b/apps/health_campaign_field_worker_app/lib/pages/reports/beneficiary/beneficaries_report.dart @@ -15,6 +15,7 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import '../../../blocs/app_initialization/app_initialization.dart'; import '../../../blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.dart'; import '../../../models/downsync/downsync.dart'; +import '../../../models/entities/roles_type.dart'; import '../../../router/app_router.dart'; import '../../../utils/i18_key_constants.dart' as i18; import '../../../utils/utils.dart'; @@ -68,6 +69,18 @@ class BeneficiariesReportState extends LocalizedState { Widget build(BuildContext context) { final theme = Theme.of(context); final textTheme = theme.digitTextTheme(context); + bool isDistributor = context.loggedInUserRoles + .where( + (role) => role.code == RolesType.distributor.toValue(), + ) + .toList() + .isNotEmpty; + bool isCommunityCreator = context.loggedInUserRoles + .where( + (role) => role.code == RolesType.communityCreator.toValue(), + ) + .toList() + .isNotEmpty; return Scaffold( body: BlocBuilder( @@ -128,6 +141,8 @@ class BeneficiariesReportState extends LocalizedState { pendingSyncCount: pendingSyncCount, boundaryName: boundaryName, batchSize: batchSize, + isDistributor: isDistributor, + isCommunityCreator: isCommunityCreator, ), ), report: (downSyncCriteriaList) { @@ -156,8 +171,11 @@ class BeneficiariesReportState extends LocalizedState { ), dialogType: DigitProgressDialogType.pendingSync, isPop: true, + isCommunityCreator: isCommunityCreator, + isDistributor: isDistributor, ), - dataFound: (initialServerCount, batchSize) => + dataFound: (initialServerCount, initialClfServerCount, + batchSize) => showDownloadDialog( context, model: DownloadBeneficiary( @@ -171,6 +189,7 @@ class BeneficiariesReportState extends LocalizedState { boundary: selectedBoundary!.code.toString(), batchSize: 5, totalCount: initialServerCount, + clfTotalCount: initialClfServerCount, content: localizations.translate( initialServerCount > 0 ? i18.beneficiaryDetails.dataFoundContent @@ -191,8 +210,10 @@ class BeneficiariesReportState extends LocalizedState { ), dialogType: DigitProgressDialogType.dataFound, isPop: true, + isCommunityCreator: isCommunityCreator, + isDistributor: isDistributor, ), - inProgress: (syncCount, totalCount) { + inProgress: (syncCount, totalCount, clfCount) { downloadProgress.add( min( (syncCount) / (totalCount), @@ -200,25 +221,26 @@ class BeneficiariesReportState extends LocalizedState { ), ); if (syncCount < 1) { - showDownloadDialog( - context, - model: DownloadBeneficiary( - title: localizations.translate( - i18.beneficiaryDetails.dataDownloadInProgress, + showDownloadDialog(context, + model: DownloadBeneficiary( + title: localizations.translate( + i18.beneficiaryDetails.dataDownloadInProgress, + ), + projectId: context.projectId, + boundary: selectedBoundary!.code.toString(), + appConfiguartion: appConfiguration, + syncCount: syncCount, + totalCount: totalCount, + clfTotalCount: clfCount, + prefixLabel: syncCount.toString(), + suffixLabel: totalCount.toString(), + boundaryName: selectedBoundary!.name.toString(), ), - projectId: context.projectId, - boundary: selectedBoundary!.code.toString(), - appConfiguartion: appConfiguration, - syncCount: syncCount, - totalCount: totalCount, - prefixLabel: syncCount.toString(), - suffixLabel: totalCount.toString(), - boundaryName: selectedBoundary!.name.toString(), - ), - dialogType: DigitProgressDialogType.inProgress, - isPop: true, - downloadProgressController: downloadProgress, - ); + dialogType: DigitProgressDialogType.inProgress, + isPop: true, + downloadProgressController: downloadProgress, + isDistributor: isDistributor, + isCommunityCreator: isCommunityCreator); } }, success: (result) { @@ -287,6 +309,8 @@ class BeneficiariesReportState extends LocalizedState { ), dialogType: DigitProgressDialogType.failed, isPop: true, + isCommunityCreator: isCommunityCreator, + isDistributor: isDistributor, ), totalCountCheckFailed: () => showDownloadDialog( context, @@ -308,26 +332,29 @@ class BeneficiariesReportState extends LocalizedState { ), dialogType: DigitProgressDialogType.checkFailed, isPop: true, + isDistributor: isDistributor, + isCommunityCreator: isCommunityCreator, ), - insufficientStorage: () => showDownloadDialog( - context, - model: DownloadBeneficiary( - title: localizations.translate( - i18.beneficiaryDetails.insufficientStorage, - ), - content: localizations.translate(i18 - .beneficiaryDetails.insufficientStorageContent), - projectId: context.projectId, - appConfiguartion: appConfiguration, - boundary: selectedBoundary!.code.toString(), - primaryButtonLabel: localizations.translate( - i18.common.coreCommonOk, + insufficientStorage: () => showDownloadDialog(context, + model: DownloadBeneficiary( + title: localizations.translate( + i18.beneficiaryDetails.insufficientStorage, + ), + content: localizations.translate(i18 + .beneficiaryDetails.insufficientStorageContent), + projectId: context.projectId, + appConfiguartion: appConfiguration, + boundary: selectedBoundary!.code.toString(), + primaryButtonLabel: localizations.translate( + i18.common.coreCommonOk, + ), + boundaryName: selectedBoundary!.name.toString(), ), - boundaryName: selectedBoundary!.name.toString(), - ), - dialogType: DigitProgressDialogType.insufficientStorage, - isPop: true, - ), + dialogType: + DigitProgressDialogType.insufficientStorage, + isPop: true, + isDistributor: isDistributor, + isCommunityCreator: isCommunityCreator), ); }, child: Column(children: [ 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 010e1f0f91..e2805d00f0 100644 --- a/apps/health_campaign_field_worker_app/lib/utils/constants.dart +++ b/apps/health_campaign_field_worker_app/lib/utils/constants.dart @@ -355,6 +355,7 @@ class DownloadBeneficiary { int? pendingSyncCount; int? syncCount; int? totalCount; + int? clfTotalCount; String? content; int? batchSize; String? primaryButtonLabel; @@ -373,6 +374,7 @@ class DownloadBeneficiary { this.batchSize, this.syncCount, this.totalCount, + this.clfTotalCount, this.content, this.primaryButtonLabel, this.secondaryButtonLabel, 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 30eea8b450..0b370bf743 100644 --- a/apps/health_campaign_field_worker_app/lib/utils/utils.dart +++ b/apps/health_campaign_field_worker_app/lib/utils/utils.dart @@ -7,6 +7,7 @@ import 'package:attendance_management/attendance_management.dart' as attendance_mappers; import 'package:complaints/complaints.init.dart' as complaints_mappers; import 'package:connectivity_plus/connectivity_plus.dart'; +import 'package:digit_data_model/data_model.dart' as data_model; import 'package:digit_data_model/data_model.init.dart' as data_model_mappers; import 'package:digit_dss/digit_dss.dart' as dss_mappers; import 'package:digit_ui_components/digit_components.dart'; @@ -21,7 +22,6 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:inventory_management/inventory_management.init.dart' as inventory_mappers; import 'package:isar/isar.dart'; -import 'package:digit_data_model/data_model.dart' as data_model; import 'package:reactive_forms/reactive_forms.dart'; import 'package:referral_reconciliation/referral_reconciliation.dart' as referral_reconciliation_mappers; @@ -35,9 +35,6 @@ import '../data/local_store/app_shared_preferences.dart'; import '../data/local_store/no_sql/schema/localization.dart'; import '../data/local_store/secure_store/secure_store.dart'; import '../models/app_config/app_config_model.dart'; -import '../models/data_model.init.dart'; -import '../models/tenant_boundary/tenant_boundary_model.dart'; - import '../router/app_router.dart'; import '../widgets/progress_indicator/progress_indicator.dart'; import 'constants.dart'; @@ -228,17 +225,16 @@ Future getIsConnected() async { } } -void showDownloadDialog( - BuildContext context, { - required DownloadBeneficiary model, - required DigitProgressDialogType dialogType, - bool isPop = true, - StreamController? downloadProgressController, -}) { +void showDownloadDialog(BuildContext context, + {required DownloadBeneficiary model, + required DigitProgressDialogType dialogType, + bool isPop = true, + StreamController? downloadProgressController, + required bool isCommunityCreator, + required bool isDistributor}) { if (isPop) { Navigator.of(context, rootNavigator: true).pop(); } - switch (dialogType) { case DigitProgressDialogType.failed: case DigitProgressDialogType.checkFailed: @@ -299,15 +295,18 @@ void showDownloadDialog( Navigator.of(context, rootNavigator: true).pop(); context.router.replaceAll([HomeRoute()]); } else { - if ((model.totalCount ?? 0) > 0) { + if ((model.totalCount ?? 0) > 0 || + (model.clfTotalCount ?? 0) > 0) { context.read().add( DownSyncBeneficiaryEvent( projectId: context.projectId, boundaryCode: model.boundary, - // Batch Size need to be defined based on Internet speed. batchSize: model.batchSize ?? 1, initialServerCount: model.totalCount ?? 0, boundaryName: model.boundaryName, + clfServerCount: model.clfTotalCount ?? 0, + isCommunityCreator: isCommunityCreator, + isDistributor: isDistributor, ), ); } else { @@ -346,7 +345,7 @@ void showDownloadDialog( label: '', prefixLabel: '', suffixLabel: - '${(snapshot.data == null ? 0 : snapshot.data! * model.totalCount!.toDouble()).toInt()}/${model.suffixLabel}', + '${(snapshot.data == null ? 0 : snapshot.data! * ((model.totalCount! + model.clfTotalCount!).toDouble().toInt()))}/${model.suffixLabel}', value: snapshot.data ?? 0, valueColor: AlwaysStoppedAnimation( Theme.of(context).colorTheme.primary.primary1, @@ -362,14 +361,14 @@ void showDownloadDialog( } } - // Existing _findLeastLevelBoundaryCode method remains unchanged String _findLeastLevelBoundaryCode(List boundaries) { data_model.BoundaryModel? highestBoundary; // Find the boundary with the highest boundaryNum for (var boundary in boundaries) { - if (highestBoundary == null || (boundary.boundaryNum ?? 0) > (highestBoundary.boundaryNum ?? 0)) { + if (highestBoundary == null || + (boundary.boundaryNum ?? 0) > (highestBoundary.boundaryNum ?? 0)) { highestBoundary = boundary; } } @@ -381,9 +380,10 @@ String _findLeastLevelBoundaryCode(List boundaries) { } // If the highest boundary has children, recursively search in them - if(highestBoundary?.children != null) { + if (highestBoundary?.children != null) { for (var child in highestBoundary!.children) { - String leastCode = _findLeastLevelBoundaryCode([child]); // Recursively find the least level + String leastCode = _findLeastLevelBoundaryCode( + [child]); // Recursively find the least level if (leastCode.isNotEmpty) { return leastCode; } @@ -395,7 +395,8 @@ String _findLeastLevelBoundaryCode(List boundaries) { } // Recursive function to find the least level boundary codes -List findLeastLevelBoundaries(List boundaries) { +List findLeastLevelBoundaries( + List boundaries) { // Find the least level boundary type String leastLevelType = _findLeastLevelBoundaryCode(boundaries); @@ -403,15 +404,18 @@ List findLeastLevelBoundaries(List boundaries) List leastLevelBoundaryCodes = []; // Iterate through the boundaries to find matching codes - if(leastLevelType.isNotEmpty) { + if (leastLevelType.isNotEmpty) { for (var boundary in boundaries) { // Check if the boundary matches the least-level type and has no children (leaf node) - if ((boundary.boundaryType == leastLevelType || boundary.label == leastLevelType) && boundary.children.isEmpty) { + if ((boundary.boundaryType == leastLevelType || + boundary.label == leastLevelType) && + boundary.children.isEmpty) { // Found a least level boundary with no children (leaf node), add its code leastLevelBoundaryCodes.add(boundary.code!); } else if (boundary.children.isNotEmpty) { // Recursively search in the children - List childVillageCodes = findLeastLevelBoundaries(boundary.children); + List childVillageCodes = + findLeastLevelBoundaries(boundary.children); leastLevelBoundaryCodes.addAll(childVillageCodes); } } @@ -440,10 +444,13 @@ getLocalizationString(Isar isar, String selectedLocale) async { } List filterDashboardConfig( - List? dashboardConfig, String projectTypeCode) { - return dashboardConfig?.where((element) => - element != null && element.projectTypeCode == projectTypeCode) - .toList() ?? []; + List? dashboardConfig, + String projectTypeCode) { + return dashboardConfig + ?.where((element) => + element != null && element.projectTypeCode == projectTypeCode) + .toList() ?? + []; } getSelectedLanguage(AppInitialized state, int index) { 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 2471b8fd1f..b4138a3a19 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 @@ -407,8 +407,7 @@ class NetworkManagerProviderWrapper extends StatelessWidget { ), ), if (value == DataModelType.downsync) - RepositoryProvider< - RemoteRepository>( + RepositoryProvider( create: (_) => DownsyncRemoteRepository( dio, actionMap: actions, diff --git a/apps/health_campaign_field_worker_app/pubspec.lock b/apps/health_campaign_field_worker_app/pubspec.lock index 98c60bd13f..7ebb98985d 100644 --- a/apps/health_campaign_field_worker_app/pubspec.lock +++ b/apps/health_campaign_field_worker_app/pubspec.lock @@ -509,11 +509,10 @@ packages: digit_data_model: dependency: "direct main" description: - name: digit_data_model - sha256: "8e67281c34e030b471a33d8889cb4e96d94d3d9fa6c6cf833e5d6d792ace1471" - url: "https://pub.dev" - source: hosted - version: "1.0.6+2" + path: "../../packages/digit_data_model" + relative: true + source: path + version: "1.0.6+1" digit_dss: dependency: "direct main" description: @@ -1328,10 +1327,9 @@ packages: inventory_management: dependency: "direct main" description: - name: inventory_management - sha256: "68271fd2f99fae4b3f826403b16b6b3568bb74ba96dc92c45c1eff457fdbcd49" - url: "https://pub.dev" - source: hosted + path: "../../packages/inventory_management" + relative: true + source: path version: "1.0.5+1" io: dependency: transitive @@ -1800,10 +1798,9 @@ packages: referral_reconciliation: dependency: "direct main" description: - name: referral_reconciliation - sha256: "5d3ea365246978776c0d247d9dbe35ebc04b7df1b85d7f38db20ec7e4021b977" - url: "https://pub.dev" - source: hosted + path: "../../packages/referral_reconciliation" + relative: true + source: path version: "1.0.4+2" registration_delivery: dependency: "direct main" @@ -1811,7 +1808,7 @@ packages: path: "../../packages/registration_delivery" relative: true source: path - version: "1.0.6+2" + version: "1.0.6+3" rxdart: dependency: transitive description: diff --git a/packages/digit_data_model/lib/data/local_store/sql_store/sql_store.g.dart b/packages/digit_data_model/lib/data/local_store/sql_store/sql_store.g.dart index 0f6e33b380..f446b9536e 100644 --- a/packages/digit_data_model/lib/data/local_store/sql_store/sql_store.g.dart +++ b/packages/digit_data_model/lib/data/local_store/sql_store/sql_store.g.dart @@ -29987,6 +29987,18 @@ class $DownsyncTable extends Downsync late final GeneratedColumn limit = GeneratedColumn( 'limit', aliasedName, true, type: DriftSqlType.int, requiredDuringInsert: false); + static const VerificationMeta _clfOffsetMeta = + const VerificationMeta('clfOffset'); + @override + late final GeneratedColumn clfOffset = GeneratedColumn( + 'clf_offset', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + static const VerificationMeta _clfTotalCountMeta = + const VerificationMeta('clfTotalCount'); + @override + late final GeneratedColumn clfTotalCount = GeneratedColumn( + 'clf_total_count', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); static const VerificationMeta _lastSyncedTimeMeta = const VerificationMeta('lastSyncedTime'); @override @@ -30097,6 +30109,8 @@ class $DownsyncTable extends Downsync projectId, offset, limit, + clfOffset, + clfTotalCount, lastSyncedTime, totalCount, boundaryName, @@ -30140,6 +30154,16 @@ class $DownsyncTable extends Downsync context.handle( _limitMeta, limit.isAcceptableOrUnknown(data['limit']!, _limitMeta)); } + if (data.containsKey('clf_offset')) { + context.handle(_clfOffsetMeta, + clfOffset.isAcceptableOrUnknown(data['clf_offset']!, _clfOffsetMeta)); + } + if (data.containsKey('clf_total_count')) { + context.handle( + _clfTotalCountMeta, + clfTotalCount.isAcceptableOrUnknown( + data['clf_total_count']!, _clfTotalCountMeta)); + } if (data.containsKey('last_synced_time')) { context.handle( _lastSyncedTimeMeta, @@ -30249,6 +30273,10 @@ class $DownsyncTable extends Downsync .read(DriftSqlType.int, data['${effectivePrefix}offset']), limit: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}limit']), + clfOffset: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}clf_offset']), + clfTotalCount: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}clf_total_count']), lastSyncedTime: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}last_synced_time']), totalCount: attachedDatabase.typeMapping @@ -30295,6 +30323,8 @@ class DownsyncData extends DataClass implements Insertable { final String? projectId; final int? offset; final int? limit; + final int? clfOffset; + final int? clfTotalCount; final int? lastSyncedTime; final int? totalCount; final String? boundaryName; @@ -30316,6 +30346,8 @@ class DownsyncData extends DataClass implements Insertable { this.projectId, this.offset, this.limit, + this.clfOffset, + this.clfTotalCount, this.lastSyncedTime, this.totalCount, this.boundaryName, @@ -30347,6 +30379,12 @@ class DownsyncData extends DataClass implements Insertable { if (!nullToAbsent || limit != null) { map['limit'] = Variable(limit); } + if (!nullToAbsent || clfOffset != null) { + map['clf_offset'] = Variable(clfOffset); + } + if (!nullToAbsent || clfTotalCount != null) { + map['clf_total_count'] = Variable(clfTotalCount); + } if (!nullToAbsent || lastSyncedTime != null) { map['last_synced_time'] = Variable(lastSyncedTime); } @@ -30410,6 +30448,12 @@ class DownsyncData extends DataClass implements Insertable { offset == null && nullToAbsent ? const Value.absent() : Value(offset), limit: limit == null && nullToAbsent ? const Value.absent() : Value(limit), + clfOffset: clfOffset == null && nullToAbsent + ? const Value.absent() + : Value(clfOffset), + clfTotalCount: clfTotalCount == null && nullToAbsent + ? const Value.absent() + : Value(clfTotalCount), lastSyncedTime: lastSyncedTime == null && nullToAbsent ? const Value.absent() : Value(lastSyncedTime), @@ -30469,6 +30513,8 @@ class DownsyncData extends DataClass implements Insertable { projectId: serializer.fromJson(json['projectId']), offset: serializer.fromJson(json['offset']), limit: serializer.fromJson(json['limit']), + clfOffset: serializer.fromJson(json['clfOffset']), + clfTotalCount: serializer.fromJson(json['clfTotalCount']), lastSyncedTime: serializer.fromJson(json['lastSyncedTime']), totalCount: serializer.fromJson(json['totalCount']), boundaryName: serializer.fromJson(json['boundaryName']), @@ -30496,6 +30542,8 @@ class DownsyncData extends DataClass implements Insertable { 'projectId': serializer.toJson(projectId), 'offset': serializer.toJson(offset), 'limit': serializer.toJson(limit), + 'clfOffset': serializer.toJson(clfOffset), + 'clfTotalCount': serializer.toJson(clfTotalCount), 'lastSyncedTime': serializer.toJson(lastSyncedTime), 'totalCount': serializer.toJson(totalCount), 'boundaryName': serializer.toJson(boundaryName), @@ -30520,6 +30568,8 @@ class DownsyncData extends DataClass implements Insertable { Value projectId = const Value.absent(), Value offset = const Value.absent(), Value limit = const Value.absent(), + Value clfOffset = const Value.absent(), + Value clfTotalCount = const Value.absent(), Value lastSyncedTime = const Value.absent(), Value totalCount = const Value.absent(), Value boundaryName = const Value.absent(), @@ -30541,6 +30591,9 @@ class DownsyncData extends DataClass implements Insertable { projectId: projectId.present ? projectId.value : this.projectId, offset: offset.present ? offset.value : this.offset, limit: limit.present ? limit.value : this.limit, + clfOffset: clfOffset.present ? clfOffset.value : this.clfOffset, + clfTotalCount: + clfTotalCount.present ? clfTotalCount.value : this.clfTotalCount, lastSyncedTime: lastSyncedTime.present ? lastSyncedTime.value : this.lastSyncedTime, totalCount: totalCount.present ? totalCount.value : this.totalCount, @@ -30586,6 +30639,8 @@ class DownsyncData extends DataClass implements Insertable { ..write('projectId: $projectId, ') ..write('offset: $offset, ') ..write('limit: $limit, ') + ..write('clfOffset: $clfOffset, ') + ..write('clfTotalCount: $clfTotalCount, ') ..write('lastSyncedTime: $lastSyncedTime, ') ..write('totalCount: $totalCount, ') ..write('boundaryName: $boundaryName, ') @@ -30607,27 +30662,30 @@ class DownsyncData extends DataClass implements Insertable { } @override - int get hashCode => Object.hash( - locality, - projectId, - offset, - limit, - lastSyncedTime, - totalCount, - boundaryName, - auditCreatedBy, - nonRecoverableError, - auditCreatedTime, - clientCreatedTime, - clientModifiedBy, - clientCreatedBy, - clientModifiedTime, - auditModifiedBy, - auditModifiedTime, - tenantId, - isDeleted, - rowVersion, - additionalFields); + int get hashCode => Object.hashAll([ + locality, + projectId, + offset, + limit, + clfOffset, + clfTotalCount, + lastSyncedTime, + totalCount, + boundaryName, + auditCreatedBy, + nonRecoverableError, + auditCreatedTime, + clientCreatedTime, + clientModifiedBy, + clientCreatedBy, + clientModifiedTime, + auditModifiedBy, + auditModifiedTime, + tenantId, + isDeleted, + rowVersion, + additionalFields + ]); @override bool operator ==(Object other) => identical(this, other) || @@ -30636,6 +30694,8 @@ class DownsyncData extends DataClass implements Insertable { other.projectId == this.projectId && other.offset == this.offset && other.limit == this.limit && + other.clfOffset == this.clfOffset && + other.clfTotalCount == this.clfTotalCount && other.lastSyncedTime == this.lastSyncedTime && other.totalCount == this.totalCount && other.boundaryName == this.boundaryName && @@ -30659,6 +30719,8 @@ class DownsyncCompanion extends UpdateCompanion { final Value projectId; final Value offset; final Value limit; + final Value clfOffset; + final Value clfTotalCount; final Value lastSyncedTime; final Value totalCount; final Value boundaryName; @@ -30681,6 +30743,8 @@ class DownsyncCompanion extends UpdateCompanion { this.projectId = const Value.absent(), this.offset = const Value.absent(), this.limit = const Value.absent(), + this.clfOffset = const Value.absent(), + this.clfTotalCount = const Value.absent(), this.lastSyncedTime = const Value.absent(), this.totalCount = const Value.absent(), this.boundaryName = const Value.absent(), @@ -30704,6 +30768,8 @@ class DownsyncCompanion extends UpdateCompanion { this.projectId = const Value.absent(), this.offset = const Value.absent(), this.limit = const Value.absent(), + this.clfOffset = const Value.absent(), + this.clfTotalCount = const Value.absent(), this.lastSyncedTime = const Value.absent(), this.totalCount = const Value.absent(), this.boundaryName = const Value.absent(), @@ -30727,6 +30793,8 @@ class DownsyncCompanion extends UpdateCompanion { Expression? projectId, Expression? offset, Expression? limit, + Expression? clfOffset, + Expression? clfTotalCount, Expression? lastSyncedTime, Expression? totalCount, Expression? boundaryName, @@ -30750,6 +30818,8 @@ class DownsyncCompanion extends UpdateCompanion { if (projectId != null) 'project_id': projectId, if (offset != null) 'offset': offset, if (limit != null) 'limit': limit, + if (clfOffset != null) 'clf_offset': clfOffset, + if (clfTotalCount != null) 'clf_total_count': clfTotalCount, if (lastSyncedTime != null) 'last_synced_time': lastSyncedTime, if (totalCount != null) 'total_count': totalCount, if (boundaryName != null) 'boundary_name': boundaryName, @@ -30777,6 +30847,8 @@ class DownsyncCompanion extends UpdateCompanion { Value? projectId, Value? offset, Value? limit, + Value? clfOffset, + Value? clfTotalCount, Value? lastSyncedTime, Value? totalCount, Value? boundaryName, @@ -30799,6 +30871,8 @@ class DownsyncCompanion extends UpdateCompanion { projectId: projectId ?? this.projectId, offset: offset ?? this.offset, limit: limit ?? this.limit, + clfOffset: clfOffset ?? this.clfOffset, + clfTotalCount: clfTotalCount ?? this.clfTotalCount, lastSyncedTime: lastSyncedTime ?? this.lastSyncedTime, totalCount: totalCount ?? this.totalCount, boundaryName: boundaryName ?? this.boundaryName, @@ -30834,6 +30908,12 @@ class DownsyncCompanion extends UpdateCompanion { if (limit.present) { map['limit'] = Variable(limit.value); } + if (clfOffset.present) { + map['clf_offset'] = Variable(clfOffset.value); + } + if (clfTotalCount.present) { + map['clf_total_count'] = Variable(clfTotalCount.value); + } if (lastSyncedTime.present) { map['last_synced_time'] = Variable(lastSyncedTime.value); } @@ -30895,6 +30975,8 @@ class DownsyncCompanion extends UpdateCompanion { ..write('projectId: $projectId, ') ..write('offset: $offset, ') ..write('limit: $limit, ') + ..write('clfOffset: $clfOffset, ') + ..write('clfTotalCount: $clfTotalCount, ') ..write('lastSyncedTime: $lastSyncedTime, ') ..write('totalCount: $totalCount, ') ..write('boundaryName: $boundaryName, ') @@ -51551,6 +51633,8 @@ typedef $$DownsyncTableInsertCompanionBuilder = DownsyncCompanion Function({ Value projectId, Value offset, Value limit, + Value clfOffset, + Value clfTotalCount, Value lastSyncedTime, Value totalCount, Value boundaryName, @@ -51574,6 +51658,8 @@ typedef $$DownsyncTableUpdateCompanionBuilder = DownsyncCompanion Function({ Value projectId, Value offset, Value limit, + Value clfOffset, + Value clfTotalCount, Value lastSyncedTime, Value totalCount, Value boundaryName, @@ -51617,6 +51703,8 @@ class $$DownsyncTableTableManager extends RootTableManager< Value projectId = const Value.absent(), Value offset = const Value.absent(), Value limit = const Value.absent(), + Value clfOffset = const Value.absent(), + Value clfTotalCount = const Value.absent(), Value lastSyncedTime = const Value.absent(), Value totalCount = const Value.absent(), Value boundaryName = const Value.absent(), @@ -51640,6 +51728,8 @@ class $$DownsyncTableTableManager extends RootTableManager< projectId: projectId, offset: offset, limit: limit, + clfOffset: clfOffset, + clfTotalCount: clfTotalCount, lastSyncedTime: lastSyncedTime, totalCount: totalCount, boundaryName: boundaryName, @@ -51663,6 +51753,8 @@ class $$DownsyncTableTableManager extends RootTableManager< Value projectId = const Value.absent(), Value offset = const Value.absent(), Value limit = const Value.absent(), + Value clfOffset = const Value.absent(), + Value clfTotalCount = const Value.absent(), Value lastSyncedTime = const Value.absent(), Value totalCount = const Value.absent(), Value boundaryName = const Value.absent(), @@ -51686,6 +51778,8 @@ class $$DownsyncTableTableManager extends RootTableManager< projectId: projectId, offset: offset, limit: limit, + clfOffset: clfOffset, + clfTotalCount: clfTotalCount, lastSyncedTime: lastSyncedTime, totalCount: totalCount, boundaryName: boundaryName, @@ -51742,6 +51836,16 @@ class $$DownsyncTableFilterComposer builder: (column, joinBuilders) => ColumnFilters(column, joinBuilders: joinBuilders)); + ColumnFilters get clfOffset => $state.composableBuilder( + column: $state.table.clfOffset, + builder: (column, joinBuilders) => + ColumnFilters(column, joinBuilders: joinBuilders)); + + ColumnFilters get clfTotalCount => $state.composableBuilder( + column: $state.table.clfTotalCount, + builder: (column, joinBuilders) => + ColumnFilters(column, joinBuilders: joinBuilders)); + ColumnFilters get lastSyncedTime => $state.composableBuilder( column: $state.table.lastSyncedTime, builder: (column, joinBuilders) => @@ -51846,6 +51950,16 @@ class $$DownsyncTableOrderingComposer builder: (column, joinBuilders) => ColumnOrderings(column, joinBuilders: joinBuilders)); + ColumnOrderings get clfOffset => $state.composableBuilder( + column: $state.table.clfOffset, + builder: (column, joinBuilders) => + ColumnOrderings(column, joinBuilders: joinBuilders)); + + ColumnOrderings get clfTotalCount => $state.composableBuilder( + column: $state.table.clfTotalCount, + builder: (column, joinBuilders) => + ColumnOrderings(column, joinBuilders: joinBuilders)); + ColumnOrderings get lastSyncedTime => $state.composableBuilder( column: $state.table.lastSyncedTime, builder: (column, joinBuilders) => diff --git a/packages/digit_data_model/lib/data/local_store/sql_store/tables/downsync.dart b/packages/digit_data_model/lib/data/local_store/sql_store/tables/downsync.dart index d3638698c4..b0a18f0728 100644 --- a/packages/digit_data_model/lib/data/local_store/sql_store/tables/downsync.dart +++ b/packages/digit_data_model/lib/data/local_store/sql_store/tables/downsync.dart @@ -2,17 +2,19 @@ import 'package:drift/drift.dart'; - class Downsync extends Table { TextColumn get locality => text().nullable()(); TextColumn get projectId => text().nullable()(); IntColumn get offset => integer().nullable()(); IntColumn get limit => integer().nullable()(); + IntColumn get clfOffset => integer().nullable()(); + IntColumn get clfTotalCount => integer().nullable()(); IntColumn get lastSyncedTime => integer().nullable()(); IntColumn get totalCount => integer().nullable()(); TextColumn get boundaryName => text().nullable()(); TextColumn get auditCreatedBy => text().nullable()(); - BoolColumn get nonRecoverableError => boolean().nullable().withDefault(const Constant(false))(); + BoolColumn get nonRecoverableError => + boolean().nullable().withDefault(const Constant(false))(); IntColumn get auditCreatedTime => integer().nullable()(); IntColumn get clientCreatedTime => integer().nullable()(); TextColumn get clientModifiedBy => text().nullable()(); @@ -21,11 +23,15 @@ class Downsync extends Table { TextColumn get auditModifiedBy => text().nullable()(); IntColumn get auditModifiedTime => integer().nullable()(); TextColumn get tenantId => text().nullable()(); - BoolColumn get isDeleted => boolean().nullable().withDefault(const Constant(false))(); + BoolColumn get isDeleted => + boolean().nullable().withDefault(const Constant(false))(); IntColumn get rowVersion => integer().nullable()(); - + TextColumn get additionalFields => text().nullable()(); @override - Set get primaryKey => { locality, auditCreatedBy, }; -} \ No newline at end of file + Set get primaryKey => { + locality, + auditCreatedBy, + }; +} diff --git a/packages/digit_data_model/lib/models/oplog/oplog_entry.dart b/packages/digit_data_model/lib/models/oplog/oplog_entry.dart index 26be51e96b..6f52df2f54 100644 --- a/packages/digit_data_model/lib/models/oplog/oplog_entry.dart +++ b/packages/digit_data_model/lib/models/oplog/oplog_entry.dart @@ -126,5 +126,7 @@ enum ApiOperation { bulkCreate, bulkUpdate, bulkDelete, - singleCreate + singleCreate, + clfSearch, + clfMemberSearch } diff --git a/packages/digit_data_model/lib/models/oplog/oplog_entry.mapper.dart b/packages/digit_data_model/lib/models/oplog/oplog_entry.mapper.dart index 79d1bb093c..a61eaf8d36 100644 --- a/packages/digit_data_model/lib/models/oplog/oplog_entry.mapper.dart +++ b/packages/digit_data_model/lib/models/oplog/oplog_entry.mapper.dart @@ -101,6 +101,10 @@ class ApiOperationMapper extends EnumMapper { return ApiOperation.bulkDelete; case 'single_create': return ApiOperation.singleCreate; + case 'clf_search': + return ApiOperation.clfSearch; + case 'clf_member_search': + return ApiOperation.clfMemberSearch; default: throw MapperException.unknownEnumValue(value); } @@ -127,6 +131,10 @@ class ApiOperationMapper extends EnumMapper { return 'bulk_delete'; case ApiOperation.singleCreate: return 'single_create'; + case ApiOperation.clfSearch: + return 'clf_search'; + case ApiOperation.clfMemberSearch: + return 'clf_member_search'; } } } diff --git a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart index 5fe7ccb553..541f2fdc3d 100644 --- a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart +++ b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart @@ -149,6 +149,10 @@ class _HouseholdOverviewPageState (value, model) { if (value .where((element) => + element.code + .toString() + .contains( + '${RegistrationDeliverySingleton().selectedProject?.name}.${RegistrationDeliveryEnums.iec.toValue()}') || element.code .toString() .contains( @@ -445,8 +449,8 @@ class _HouseholdOverviewPageState .householdOverView .householdOverViewLabel), style: textTheme.headingXl.copyWith( - color: theme.colorTheme.primary.primary2 - ), + color: theme + .colorTheme.primary.primary2), ), ), ), diff --git a/packages/registration_delivery/lib/pages/beneficiary_registration/beneficiary_acknowledgement.dart b/packages/registration_delivery/lib/pages/beneficiary_registration/beneficiary_acknowledgement.dart index ec7b4c6317..2b80ac098f 100644 --- a/packages/registration_delivery/lib/pages/beneficiary_registration/beneficiary_acknowledgement.dart +++ b/packages/registration_delivery/lib/pages/beneficiary_registration/beneficiary_acknowledgement.dart @@ -1,4 +1,5 @@ import 'package:auto_route/auto_route.dart'; +import 'package:digit_data_model/models/entities/household_type.dart'; import 'package:digit_ui_components/digit_components.dart'; import 'package:digit_ui_components/widgets/molecules/panel_cards.dart'; import 'package:flutter/material.dart'; @@ -8,6 +9,7 @@ import '../../../utils/i18_key_constants.dart' as i18; import '../../../widgets/localized.dart'; import '../../blocs/search_households/search_bloc_common_wrapper.dart'; import '../../router/registration_delivery_router.gm.dart'; +import '../../utils/utils.dart'; @RoutePage() class BeneficiaryAcknowledgementPage extends LocalizedStatefulWidget { @@ -37,8 +39,12 @@ class BeneficiaryAcknowledgementPageState .translate(i18.acknowledgementSuccess.acknowledgementLabelText), actions: [ DigitButton( + capitalizeLetters: false, label: localizations.translate( - i18.householdDetails.viewHouseHoldDetailsAction, + RegistrationDeliverySingleton().householdType == + HouseholdType.community + ? i18.householdDetails.viewInstitutionDetailsAction + : i18.householdDetails.viewHouseHoldDetailsAction, ), onPressed: () { final bloc = context.read(); diff --git a/packages/registration_delivery/lib/pages/beneficiary_registration/house_details.dart b/packages/registration_delivery/lib/pages/beneficiary_registration/house_details.dart index 78769c254d..a62e24c8ce 100644 --- a/packages/registration_delivery/lib/pages/beneficiary_registration/house_details.dart +++ b/packages/registration_delivery/lib/pages/beneficiary_registration/house_details.dart @@ -17,7 +17,6 @@ import '../../utils/i18_key_constants.dart' as i18; import '../../widgets/back_navigation_help_header.dart'; import '../../widgets/localized.dart'; import '../../widgets/showcase/config/showcase_constants.dart'; -import '../../widgets/showcase/showcase_button.dart'; @RoutePage() class HouseDetailsPage extends LocalizedStatefulWidget { @@ -243,8 +242,7 @@ class HouseDetailsPageState extends LocalizedState { .houseDetailsLabel, ), style: textTheme.headingXl.copyWith( - color: theme.colorTheme.primary.primary2 - ), + color: theme.colorTheme.primary.primary2), ), ), houseShowcaseData.typeOfStructure.buildWith( diff --git a/packages/registration_delivery/lib/pages/beneficiary_registration/household_details.dart b/packages/registration_delivery/lib/pages/beneficiary_registration/household_details.dart index 60def72752..37368c5f96 100644 --- a/packages/registration_delivery/lib/pages/beneficiary_registration/household_details.dart +++ b/packages/registration_delivery/lib/pages/beneficiary_registration/household_details.dart @@ -124,6 +124,7 @@ class HouseHoldDetailsPageState extends LocalizedState { enableFixedDigitButton: true, footer: DigitCard( margin: const EdgeInsets.only(top: spacer2), + padding: const EdgeInsets.all(spacer2), children: [ DigitButton( label: registrationState.mapOrNull( diff --git a/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart b/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart index 63f33087f7..ee1b505803 100644 --- a/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart +++ b/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart @@ -299,8 +299,7 @@ class HouseholdLocationPageState extends LocalizedState { .householdLocationLabelText, ), headingStyle: textTheme.headingXl.copyWith( - color: theme.colorTheme.primary.primary2 - ), + color: theme.colorTheme.primary.primary2), description: (RegistrationDeliverySingleton() .householdType == HouseholdType.community) diff --git a/packages/registration_delivery/lib/pages/beneficiary_registration/individual_details.dart b/packages/registration_delivery/lib/pages/beneficiary_registration/individual_details.dart index 6b9a4bb165..4821131a15 100644 --- a/packages/registration_delivery/lib/pages/beneficiary_registration/individual_details.dart +++ b/packages/registration_delivery/lib/pages/beneficiary_registration/individual_details.dart @@ -27,7 +27,6 @@ import '../../utils/utils.dart'; import '../../widgets/back_navigation_help_header.dart'; import '../../widgets/localized.dart'; import '../../widgets/showcase/config/showcase_constants.dart'; -import '../../widgets/showcase/showcase_button.dart'; @RoutePage() class IndividualDetailsPage extends LocalizedStatefulWidget { @@ -336,7 +335,8 @@ class IndividualDetailsPageState extends LocalizedState { localizations.translate( i18.individualDetails.individualsDetailsLabelText, ), - style: textTheme.headingXl.copyWith(color: theme.colorTheme.primary.primary2), + style: textTheme.headingXl.copyWith( + color: theme.colorTheme.primary.primary2), ), Column( children: [ @@ -345,9 +345,10 @@ class IndividualDetailsPageState extends LocalizedState { child: ReactiveWrapperField( formControlName: _individualNameKey, validationMessages: { - 'required': (object) => localizations.translate( - '${i18.individualDetails.nameLabelText}_IS_REQUIRED', - ), + 'required': (object) => + localizations.translate( + '${i18.individualDetails.nameLabelText}_IS_REQUIRED', + ), 'maxLength': (object) => localizations .translate(i18.common.maxCharsRequired) .replaceAll('{}', maxLength.toString()), @@ -359,7 +360,7 @@ class IndividualDetailsPageState extends LocalizedState { isRequired: true, child: DigitTextFormInput( initialValue: - form.control(_individualNameKey).value, + form.control(_individualNameKey).value, onChange: (value) { form.control(_individualNameKey).value = value; @@ -369,20 +370,22 @@ class IndividualDetailsPageState extends LocalizedState { ), ), ), - if(widget.isHeadOfHousehold) - const SizedBox(height: spacer2,), + if (widget.isHeadOfHousehold) + const SizedBox( + height: spacer2, + ), Offstage( offstage: !widget.isHeadOfHousehold, child: DigitCheckbox( capitalizeFirstLetter: false, label: (RegistrationDeliverySingleton() - .householdType == - HouseholdType.community) - ? localizations.translate( - i18.individualDetails.clfCheckboxLabelText) + .householdType == + HouseholdType.community) + ? localizations.translate(i18 + .individualDetails.clfCheckboxLabelText) : localizations.translate( - i18.individualDetails.checkboxLabelText, - ), + i18.individualDetails.checkboxLabelText, + ), value: widget.isHeadOfHousehold, readOnly: widget.isHeadOfHousehold, onChanged: (_) {}, @@ -508,7 +511,8 @@ class IndividualDetailsPageState extends LocalizedState { yearsAndMonthsErrMsg: localizations.translate( i18.individualDetails.yearsAndMonthsErrorText, ), - errorMessage: _getDobErrorMessage(form.control(_dobKey)), + errorMessage: + _getDobErrorMessage(form.control(_dobKey)), initialDate: before150Years, initialValue: getInitialDateValue(form), onChangeOfFormControl: (value) { @@ -805,9 +809,7 @@ class IndividualDetailsPageState extends LocalizedState { if (!control.hasErrors) return null; final dobValue = control.value; - final age = dobValue != null - ? DigitDateUtils.calculateAge(dobValue) - : null; + final age = dobValue != null ? DigitDateUtils.calculateAge(dobValue) : null; if (dobValue == null) { return localizations.translate(i18.common.corecommonRequired); diff --git a/packages/registration_delivery/lib/pages/summary_page.dart b/packages/registration_delivery/lib/pages/summary_page.dart index d1189e9bae..5054592604 100644 --- a/packages/registration_delivery/lib/pages/summary_page.dart +++ b/packages/registration_delivery/lib/pages/summary_page.dart @@ -11,7 +11,6 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:registration_delivery/models/entities/additional_fields_type.dart'; import 'package:registration_delivery/router/registration_delivery_router.gm.dart'; import 'package:registration_delivery/widgets/back_navigation_help_header.dart'; -import 'package:registration_delivery/widgets/showcase/showcase_button.dart'; import '../../../widgets/localized.dart'; import '../../utils/i18_key_constants.dart' as i18; @@ -99,7 +98,8 @@ class SummaryPageState extends LocalizedState { localizations.translate( i18.common.coreCommonSummaryDetails, ), - style: textTheme.headingXl.copyWith(color: theme.colorTheme.primary.primary2), + style: textTheme.headingXl + .copyWith(color: theme.colorTheme.primary.primary2), ), ), ), @@ -218,16 +218,16 @@ class SummaryPageState extends LocalizedState { ), items: [ LabelValueItem( - label: localizations.translate( - i18.householdLocation.villageLabel), - value: localizations.translate( - householdState.householdModel?.address - ?.locality?.code ?? - i18.common.coreCommonNA), - isInline: true, - labelFlex: 5, - padding: const EdgeInsets.only(bottom: spacer2) - ), + label: localizations.translate( + i18.householdLocation.villageLabel), + value: localizations.translate( + householdState.householdModel?.address + ?.locality?.code ?? + i18.common.coreCommonNA), + isInline: true, + labelFlex: 5, + padding: const EdgeInsets.only( + bottom: spacer2)), LabelValueItem( label: localizations.translate(i18 .householdLocation.landmarkFormLabel), @@ -237,7 +237,8 @@ class SummaryPageState extends LocalizedState { .translate(i18.common.coreCommonNA), isInline: true, labelFlex: 5, - padding: const EdgeInsets.only(top: spacer2), + padding: + const EdgeInsets.only(top: spacer2), ), ]), ]), @@ -253,16 +254,16 @@ class SummaryPageState extends LocalizedState { ), items: [ LabelValueItem( - label: localizations.translate( - i18.beneficiaryDetails.totalMembers), - value: householdState - .householdModel?.memberCount - .toString() ?? - '0', - isInline: true, - labelFlex: 5, - padding: const EdgeInsets.only(bottom: spacer2) - ), + label: localizations.translate( + i18.beneficiaryDetails.totalMembers), + value: householdState + .householdModel?.memberCount + .toString() ?? + '0', + isInline: true, + labelFlex: 5, + padding: const EdgeInsets.only( + bottom: spacer2)), LabelValueItem( label: localizations.translate(i18 .householdDetails @@ -282,23 +283,23 @@ class SummaryPageState extends LocalizedState { labelFlex: 5, ), LabelValueItem( - label: localizations.translate(i18 - .householdDetails - .noOfChildrenBelow5YearsLabel), - value: householdState.householdModel - ?.additionalFields?.fields - .where((h) => - h.key == - AdditionalFieldsType.children - .toValue()) - .firstOrNull - ?.value - .toString() ?? - '0', - isInline: true, - labelFlex: 5, - padding: const EdgeInsets.only(top: spacer2) - ), + label: localizations.translate(i18 + .householdDetails + .noOfChildrenBelow5YearsLabel), + value: householdState.householdModel + ?.additionalFields?.fields + .where((h) => + h.key == + AdditionalFieldsType.children + .toValue()) + .firstOrNull + ?.value + .toString() ?? + '0', + isInline: true, + labelFlex: 5, + padding: + const EdgeInsets.only(top: spacer2)), ]), ]), DigitCard( @@ -313,45 +314,45 @@ class SummaryPageState extends LocalizedState { ), items: [ LabelValueItem( - label: localizations.translate( - i18.householdDetails.noOfRoomsLabel), - value: householdState.householdModel - ?.additionalFields?.fields - .where((h) => - h.key == - AdditionalFieldsType.noOfRooms - .toValue()) - .firstOrNull - ?.value - .toString() ?? - '0', - isInline: true, - labelFlex: 5, - padding: const EdgeInsets.only(bottom: spacer2) - ), + label: localizations.translate( + i18.householdDetails.noOfRoomsLabel), + value: householdState.householdModel + ?.additionalFields?.fields + .where((h) => + h.key == + AdditionalFieldsType.noOfRooms + .toValue()) + .firstOrNull + ?.value + .toString() ?? + '0', + isInline: true, + labelFlex: 5, + padding: const EdgeInsets.only( + bottom: spacer2)), LabelValueItem( - label: localizations.translate( - i18.householdDetails.typeOfStructure), - value: (householdState.householdModel - ?.additionalFields?.fields - .where((h) => - h.key == - AdditionalFieldsType - .houseStructureTypes - .toValue()) - .firstOrNull - ?.value ?? - []) - .toString() - .split('|') - .map( - (item) => getLocalizedMessage(item)) - .toList() - .join(', '), - isInline: true, - labelFlex: 5, - padding: const EdgeInsets.only(top: spacer2) - ), + label: localizations.translate( + i18.householdDetails.typeOfStructure), + value: (householdState.householdModel + ?.additionalFields?.fields + .where((h) => + h.key == + AdditionalFieldsType + .houseStructureTypes + .toValue()) + .firstOrNull + ?.value ?? + []) + .toString() + .split('|') + .map((item) => + getLocalizedMessage(item)) + .toList() + .join(', '), + isInline: true, + labelFlex: 5, + padding: + const EdgeInsets.only(top: spacer2)), ]), ]), DigitCard( @@ -367,27 +368,28 @@ class SummaryPageState extends LocalizedState { ), items: [ LabelValueItem( - label: localizations.translate( - i18.individualDetails.nameLabelText), - value: householdState.maybeWhen( - orElse: () => localizations - .translate(i18.common.coreCommonNA), - summary: ( - navigateToRoot, - householdModel, - individualModel, - projectBeneficiaryModel, - registrationDate, - addressModel, - loading, - isHeadOfHousehold, - ) => - individualModel?.name?.givenName ?? - localizations.translate( - i18.common.coreCommonNA)), - labelFlex: 5, - padding: const EdgeInsets.only(bottom: spacer2) - ), + label: localizations.translate( + i18.individualDetails.nameLabelText), + value: householdState.maybeWhen( + orElse: () => localizations.translate( + i18.common.coreCommonNA), + summary: ( + navigateToRoot, + householdModel, + individualModel, + projectBeneficiaryModel, + registrationDate, + addressModel, + loading, + isHeadOfHousehold, + ) => + individualModel + ?.name?.givenName ?? + localizations.translate( + i18.common.coreCommonNA)), + labelFlex: 5, + padding: const EdgeInsets.only( + bottom: spacer2)), LabelValueItem( label: localizations.translate( i18.individualDetails.dobLabelText), @@ -419,32 +421,32 @@ class SummaryPageState extends LocalizedState { labelFlex: 5, ), LabelValueItem( - label: localizations.translate( - i18.individualDetails.genderLabelText), - value: householdState.maybeWhen( - orElse: () => localizations - .translate(i18.common.coreCommonNA), - summary: ( - navigateToRoot, - householdModel, - individualModel, - projectBeneficiaryModel, - registrationDate, - addressModel, - loading, - isHeadOfHousehold, - ) => - individualModel?.gender != null - ? localizations.translate( - individualModel - ?.gender?.name - .toUpperCase() ?? - '') - : localizations.translate( - i18.common.coreCommonNA)), - labelFlex: 5, - padding: const EdgeInsets.only(top: spacer2) - ), + label: localizations.translate(i18 + .individualDetails.genderLabelText), + value: householdState.maybeWhen( + orElse: () => localizations.translate( + i18.common.coreCommonNA), + summary: ( + navigateToRoot, + householdModel, + individualModel, + projectBeneficiaryModel, + registrationDate, + addressModel, + loading, + isHeadOfHousehold, + ) => + individualModel?.gender != null + ? localizations.translate( + individualModel + ?.gender?.name + .toUpperCase() ?? + '') + : localizations.translate( + i18.common.coreCommonNA)), + labelFlex: 5, + padding: + const EdgeInsets.only(top: spacer2)), ]), ]), ], diff --git a/packages/registration_delivery/lib/utils/i18_key_constants.dart b/packages/registration_delivery/lib/utils/i18_key_constants.dart index 167a3e306f..8c61829213 100644 --- a/packages/registration_delivery/lib/utils/i18_key_constants.dart +++ b/packages/registration_delivery/lib/utils/i18_key_constants.dart @@ -485,6 +485,9 @@ class HouseholdDetails { String get viewHouseHoldDetailsAction => 'VIEW_HOUSEHOLD_DETAILS_ACTION_LABEL'; + String get viewInstitutionDetailsAction => + 'VIEW_INSTITUTION_DETAILS_ACTION_LABEL'; + String get noOfRoomsLabel => 'NO_OF_ROOMS_LABEL'; String get noOfRoomsCLFLabel => 'NO_OF_ROOMS_CLF_LABEL'; diff --git a/packages/registration_delivery/pubspec.lock b/packages/registration_delivery/pubspec.lock index ed4f1b0214..af76befd67 100644 --- a/packages/registration_delivery/pubspec.lock +++ b/packages/registration_delivery/pubspec.lock @@ -397,10 +397,9 @@ packages: digit_data_model: dependency: "direct main" description: - name: digit_data_model - sha256: "4cdde28c79632a8aa4a8eb95c6567c96f0449b88e815c42896eeb1a41e0c2b00" - url: "https://pub.dev" - source: hosted + path: "../digit_data_model" + relative: true + source: path version: "1.0.6+1" digit_scanner: dependency: "direct main"