From 5f9b046b860a76ee53c49950ddbe5eb07e4640dc Mon Sep 17 00:00:00 2001 From: G S Prakash Naidu <146939767+GSPrakashNaidu2662@users.noreply.github.com> Date: Fri, 10 May 2024 10:01:19 +0530 Subject: [PATCH] [RCF-454] (#338) * Added JPEG compression for face image in the acknowledgement screen Signed-off-by: G S Prakash * Updated the code for gender code in template Signed-off-by: G S Prakash --------- Signed-off-by: G S Prakash --- .../api_services/DemographicsDetailsApi.java | 4 ++-- .../clientmanager/dto/registration/RegistrationDto.java | 4 ++-- .../clientmanager/service/TemplateService.java | 2 +- .../mosip/registration/packetmanager/dto/SimpleType.java | 1 + lib/platform_android/demographic_service_impl.dart | 4 ++-- lib/platform_spi/demographic_service.dart | 2 +- lib/provider/registration_task_provider.dart | 4 ++-- lib/ui/process_ui/widgets/document_upload_control.dart | 2 +- lib/ui/process_ui/widgets/dropdown_control.dart | 2 +- lib/ui/process_ui/widgets/dynamic_dropdown_control.dart | 2 +- lib/ui/process_ui/widgets/gender_control.dart | 8 ++++---- lib/ui/process_ui/widgets/html_box_control.dart | 1 + lib/ui/process_ui/widgets/radio_button_control.dart | 6 +++--- lib/ui/process_ui/widgets/textbox_control.dart | 2 +- pigeon/demographics_data.dart | 2 +- 15 files changed, 24 insertions(+), 22 deletions(-) diff --git a/android/app/src/main/java/io/mosip/registration_client/api_services/DemographicsDetailsApi.java b/android/app/src/main/java/io/mosip/registration_client/api_services/DemographicsDetailsApi.java index 090459942..26812d846 100644 --- a/android/app/src/main/java/io/mosip/registration_client/api_services/DemographicsDetailsApi.java +++ b/android/app/src/main/java/io/mosip/registration_client/api_services/DemographicsDetailsApi.java @@ -75,9 +75,9 @@ public void getHashValue(@NonNull byte[] bytes, @NonNull DemographicsDataPigeon. @Override - public void addSimpleTypeDemographicField(@NonNull String fieldId, @NonNull String value, @NonNull String language, @NonNull DemographicsDataPigeon.Result result) { + public void addSimpleTypeDemographicField(@NonNull String fieldId, @NonNull String value, @NonNull String name, @NonNull String language, @NonNull DemographicsDataPigeon.Result result) { try { - this.registrationService.getRegistrationDto().addDemographicField(fieldId, value, language); + this.registrationService.getRegistrationDto().addDemographicField(fieldId, value, name, language); } catch (Exception e) { Log.e(getClass().getSimpleName(), "Add simple type field failed!" + Arrays.toString(e.getStackTrace())); } diff --git a/android/clientmanager/src/main/java/io/mosip/registration/clientmanager/dto/registration/RegistrationDto.java b/android/clientmanager/src/main/java/io/mosip/registration/clientmanager/dto/registration/RegistrationDto.java index 41687d022..5dd9c0e45 100644 --- a/android/clientmanager/src/main/java/io/mosip/registration/clientmanager/dto/registration/RegistrationDto.java +++ b/android/clientmanager/src/main/java/io/mosip/registration/clientmanager/dto/registration/RegistrationDto.java @@ -163,12 +163,12 @@ public void clearAttemptsHashmap(){ public void clearExceptionsHashmap(){ this.EXCEPTIONS.clear(); } - public void addDemographicField(String fieldId, String value, String language) { + public void addDemographicField(String fieldId, String value, String name, String language) { this.demographics.compute(fieldId, (k, v) -> { v = v != null ? v : new ArrayList(); ((List)v).removeIf( e -> e.getLanguage().equalsIgnoreCase(language)); if(isValidValue(value)) - ((List)v).add(new SimpleType(language, value)); + ((List)v).add(new SimpleType(language, value, name)); return v; }); clearAndNotifyAllObservers(); diff --git a/android/clientmanager/src/main/java/io/mosip/registration/clientmanager/service/TemplateService.java b/android/clientmanager/src/main/java/io/mosip/registration/clientmanager/service/TemplateService.java index b07faa8b7..31ceb69fd 100644 --- a/android/clientmanager/src/main/java/io/mosip/registration/clientmanager/service/TemplateService.java +++ b/android/clientmanager/src/main/java/io/mosip/registration/clientmanager/service/TemplateService.java @@ -455,7 +455,7 @@ private String getValue(Object fieldValue, String lang) { .filter(valueDTO -> valueDTO.getLanguage().equals(lang)).findFirst(); if (demoValueInRequiredLang.isPresent() && demoValueInRequiredLang.get().getValue() != null) { - value = demoValueInRequiredLang.get().getValue(); + value = demoValueInRequiredLang.get().getName(); } } else if (fieldValue instanceof String || fieldValue instanceof Integer || fieldValue instanceof BigInteger || fieldValue instanceof Double) { diff --git a/android/packetmanager/src/main/java/io/mosip/registration/packetmanager/dto/SimpleType.java b/android/packetmanager/src/main/java/io/mosip/registration/packetmanager/dto/SimpleType.java index 5c873b51e..116e640da 100644 --- a/android/packetmanager/src/main/java/io/mosip/registration/packetmanager/dto/SimpleType.java +++ b/android/packetmanager/src/main/java/io/mosip/registration/packetmanager/dto/SimpleType.java @@ -12,4 +12,5 @@ public class SimpleType { private String language; private String value; + private String name; } diff --git a/lib/platform_android/demographic_service_impl.dart b/lib/platform_android/demographic_service_impl.dart index 9208c9597..5accdab83 100644 --- a/lib/platform_android/demographic_service_impl.dart +++ b/lib/platform_android/demographic_service_impl.dart @@ -24,10 +24,10 @@ class DemographicServiceImpl implements DemographicService { @override Future addSimpleTypeDemographicField( - String fieldId, String value, String language) async { + String fieldId, String value, String name, String language) async { try { await DemographicsApi() - .addSimpleTypeDemographicField(fieldId, value, language); + .addSimpleTypeDemographicField(fieldId, value, name, language); } on PlatformException { debugPrint('DemographicsApi call failed'); } catch (e) { diff --git a/lib/platform_spi/demographic_service.dart b/lib/platform_spi/demographic_service.dart index 4fb99e4ae..798096c5a 100644 --- a/lib/platform_spi/demographic_service.dart +++ b/lib/platform_spi/demographic_service.dart @@ -12,7 +12,7 @@ abstract class DemographicService { Future getDemographicField(String fieldId); Future addSimpleTypeDemographicField( - String fieldId, String value, String language); + String fieldId, String value, String name, String language); Future getSimpleTypeDemographicField(String fieldId, String language); diff --git a/lib/provider/registration_task_provider.dart b/lib/provider/registration_task_provider.dart index 9aec12eb7..d78ac1a13 100644 --- a/lib/provider/registration_task_provider.dart +++ b/lib/provider/registration_task_provider.dart @@ -143,8 +143,8 @@ class RegistrationTaskProvider with ChangeNotifier { } addSimpleTypeDemographicField( - String fieldId, String value, String language) async { - await demographics.addSimpleTypeDemographicField(fieldId, value, language); + String fieldId, String value, String name, String language) async { + await demographics.addSimpleTypeDemographicField(fieldId, value, name, language); } getSimpleTypeDemographicField(String fieldId, String language) async { diff --git a/lib/ui/process_ui/widgets/document_upload_control.dart b/lib/ui/process_ui/widgets/document_upload_control.dart index c8a1e79ad..672e26657 100644 --- a/lib/ui/process_ui/widgets/document_upload_control.dart +++ b/lib/ui/process_ui/widgets/document_upload_control.dart @@ -212,7 +212,7 @@ class _DocumentUploadControlState extends State { if (widget.field.type == 'simpleType') { context .read() - .addSimpleTypeDemographicField(widget.field.id ?? "", value, "eng"); + .addSimpleTypeDemographicField(widget.field.id ?? "", value, value, "eng"); } else { context .read() diff --git a/lib/ui/process_ui/widgets/dropdown_control.dart b/lib/ui/process_ui/widgets/dropdown_control.dart index 4a42759d2..6dfd3b942 100644 --- a/lib/ui/process_ui/widgets/dropdown_control.dart +++ b/lib/ui/process_ui/widgets/dropdown_control.dart @@ -76,7 +76,7 @@ class _CustomDropDownState extends State { globalProvider.languageToCodeMapper[element]!; registrationTaskProvider .addSimpleTypeDemographicField( - widget.field.id ?? "", value, code); + widget.field.id ?? "", value, value, code); } } else { registrationTaskProvider diff --git a/lib/ui/process_ui/widgets/dynamic_dropdown_control.dart b/lib/ui/process_ui/widgets/dynamic_dropdown_control.dart index 58ba50822..2c4c70ff9 100644 --- a/lib/ui/process_ui/widgets/dynamic_dropdown_control.dart +++ b/lib/ui/process_ui/widgets/dynamic_dropdown_control.dart @@ -57,7 +57,7 @@ class _CustomDynamicDropDownState extends State { String code = globalProvider.languageToCodeMapper[element]!; registrationTaskProvider .addSimpleTypeDemographicField( - widget.field.id ?? "", value, code); + widget.field.id ?? "", value, value, code); } } else { registrationTaskProvider diff --git a/lib/ui/process_ui/widgets/gender_control.dart b/lib/ui/process_ui/widgets/gender_control.dart index b5ed5010d..0e5078103 100644 --- a/lib/ui/process_ui/widgets/gender_control.dart +++ b/lib/ui/process_ui/widgets/gender_control.dart @@ -53,7 +53,7 @@ class _CustomDynamicDropDownState extends State { setState(() { selected = fieldValueData[0]!.name; }); - saveData(fieldValueData[0]!.code); + saveData(fieldValueData[0]!.code,fieldValueData[0]!.name); _saveDataToMap(selected); } }); @@ -61,13 +61,13 @@ class _CustomDynamicDropDownState extends State { super.initState(); } - void saveData(value) { + void saveData(value,name) { if (widget.field.type == 'simpleType') { for (var element in globalProvider.chosenLang) { String code = globalProvider.languageToCodeMapper[element]!; registrationTaskProvider - .addSimpleTypeDemographicField(widget.field.id ?? "", value, code); + .addSimpleTypeDemographicField(widget.field.id ?? "", value, name, code); } } else { registrationTaskProvider @@ -213,7 +213,7 @@ class _CustomDynamicDropDownState extends State { }); for (var e in fieldValueData) { if(e!.name == selected){ - saveData(e.code); + saveData(e.code,e.name); } } _saveDataToMap(e[mandatoryLang]); diff --git a/lib/ui/process_ui/widgets/html_box_control.dart b/lib/ui/process_ui/widgets/html_box_control.dart index c71da7f28..4293453b5 100644 --- a/lib/ui/process_ui/widgets/html_box_control.dart +++ b/lib/ui/process_ui/widgets/html_box_control.dart @@ -168,6 +168,7 @@ class _HtmlRendererState extends State { DemographicsApi().addSimpleTypeDemographicField( widget.field.id!, value, + value, globalProvider .langToCode(globalProvider.chosenLang[i])); }); diff --git a/lib/ui/process_ui/widgets/radio_button_control.dart b/lib/ui/process_ui/widgets/radio_button_control.dart index f0d9e1b99..bd3b1c5aa 100644 --- a/lib/ui/process_ui/widgets/radio_button_control.dart +++ b/lib/ui/process_ui/widgets/radio_button_control.dart @@ -71,12 +71,12 @@ class _RadioFormFieldState extends State { String? selectedOption; - void handleOptionChange(String? value) { + void handleOptionChange(String? value, String? name) { for (var element in globalProvider.chosenLang) { String code = globalProvider.languageToCodeMapper[element]!; registrationTaskProvider - .addSimpleTypeDemographicField(widget.field.id ?? "", value!, code); + .addSimpleTypeDemographicField(widget.field.id ?? "", value!, name!, code); globalProvider.fieldInputValue[widget.field.id!] = value; } setState(() { @@ -141,7 +141,7 @@ class _RadioFormFieldState extends State { setState(() { selectedOption = value; }); - handleOptionChange(e.code); + handleOptionChange(e.code,e.name); } //handleOptionChange, ), diff --git a/lib/ui/process_ui/widgets/textbox_control.dart b/lib/ui/process_ui/widgets/textbox_control.dart index 938a62fa7..91f5f26b5 100644 --- a/lib/ui/process_ui/widgets/textbox_control.dart +++ b/lib/ui/process_ui/widgets/textbox_control.dart @@ -81,7 +81,7 @@ class _TextBoxControlState extends State void saveData(value, lang) { if (widget.e.type == 'simpleType') { registrationTaskProvider - .addSimpleTypeDemographicField(widget.e.id!, value!, lang); + .addSimpleTypeDemographicField(widget.e.id!, value!, value!, lang); } else { registrationTaskProvider .addDemographicField(widget.e.id!, value!); diff --git a/pigeon/demographics_data.dart b/pigeon/demographics_data.dart index 48336f497..a9abe8cd9 100644 --- a/pigeon/demographics_data.dart +++ b/pigeon/demographics_data.dart @@ -13,7 +13,7 @@ abstract class DemographicsApi { @async void addSimpleTypeDemographicField( - String fieldId, String value, String language); + String fieldId, String value, String name, String language); @async String getSimpleTypeDemographicField(String fieldId, String language);