Skip to content

Commit

Permalink
[RCF-454] (#338)
Browse files Browse the repository at this point in the history
* Added JPEG compression for face image in the acknowledgement screen

Signed-off-by: G S Prakash <[email protected]>

* Updated the code for gender code in template

Signed-off-by: G S Prakash <[email protected]>

---------

Signed-off-by: G S Prakash <[email protected]>
  • Loading branch information
GSPrakashNaidu2662 authored May 10, 2024
1 parent f00a598 commit 5f9b046
Show file tree
Hide file tree
Showing 15 changed files with 24 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<Void> result) {
public void addSimpleTypeDemographicField(@NonNull String fieldId, @NonNull String value, @NonNull String name, @NonNull String language, @NonNull DemographicsDataPigeon.Result<Void> 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()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<SimpleType>();
((List<SimpleType>)v).removeIf( e -> e.getLanguage().equalsIgnoreCase(language));
if(isValidValue(value))
((List<SimpleType>)v).add(new SimpleType(language, value));
((List<SimpleType>)v).add(new SimpleType(language, value, name));
return v;
});
clearAndNotifyAllObservers();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ public class SimpleType {

private String language;
private String value;
private String name;
}
4 changes: 2 additions & 2 deletions lib/platform_android/demographic_service_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ class DemographicServiceImpl implements DemographicService {

@override
Future<void> 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) {
Expand Down
2 changes: 1 addition & 1 deletion lib/platform_spi/demographic_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ abstract class DemographicService {
Future<String> getDemographicField(String fieldId);

Future<void> addSimpleTypeDemographicField(
String fieldId, String value, String language);
String fieldId, String value, String name, String language);

Future<String> getSimpleTypeDemographicField(String fieldId, String language);

Expand Down
4 changes: 2 additions & 2 deletions lib/provider/registration_task_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/process_ui/widgets/document_upload_control.dart
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ class _DocumentUploadControlState extends State<DocumentUploadControl> {
if (widget.field.type == 'simpleType') {
context
.read<RegistrationTaskProvider>()
.addSimpleTypeDemographicField(widget.field.id ?? "", value, "eng");
.addSimpleTypeDemographicField(widget.field.id ?? "", value, value, "eng");
} else {
context
.read<RegistrationTaskProvider>()
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/process_ui/widgets/dropdown_control.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class _CustomDropDownState extends State<DropDownControl> {
globalProvider.languageToCodeMapper[element]!;
registrationTaskProvider
.addSimpleTypeDemographicField(
widget.field.id ?? "", value, code);
widget.field.id ?? "", value, value, code);
}
} else {
registrationTaskProvider
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/process_ui/widgets/dynamic_dropdown_control.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class _CustomDynamicDropDownState extends State<DynamicDropDownControl> {
String code = globalProvider.languageToCodeMapper[element]!;
registrationTaskProvider
.addSimpleTypeDemographicField(
widget.field.id ?? "", value, code);
widget.field.id ?? "", value, value, code);
}
} else {
registrationTaskProvider
Expand Down
8 changes: 4 additions & 4 deletions lib/ui/process_ui/widgets/gender_control.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,21 @@ class _CustomDynamicDropDownState extends State<GenderControl> {
setState(() {
selected = fieldValueData[0]!.name;
});
saveData(fieldValueData[0]!.code);
saveData(fieldValueData[0]!.code,fieldValueData[0]!.name);
_saveDataToMap(selected);
}
});

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
Expand Down Expand Up @@ -213,7 +213,7 @@ class _CustomDynamicDropDownState extends State<GenderControl> {
});
for (var e in fieldValueData) {
if(e!.name == selected){
saveData(e.code);
saveData(e.code,e.name);
}
}
_saveDataToMap(e[mandatoryLang]);
Expand Down
1 change: 1 addition & 0 deletions lib/ui/process_ui/widgets/html_box_control.dart
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ class _HtmlRendererState extends State<HtmlRenderer> {
DemographicsApi().addSimpleTypeDemographicField(
widget.field.id!,
value,
value,
globalProvider
.langToCode(globalProvider.chosenLang[i]));
});
Expand Down
6 changes: 3 additions & 3 deletions lib/ui/process_ui/widgets/radio_button_control.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ class _RadioFormFieldState extends State<RadioButtonControl> {

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(() {
Expand Down Expand Up @@ -141,7 +141,7 @@ class _RadioFormFieldState extends State<RadioButtonControl> {
setState(() {
selectedOption = value;
});
handleOptionChange(e.code);
handleOptionChange(e.code,e.name);
}
//handleOptionChange,
),
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/process_ui/widgets/textbox_control.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class _TextBoxControlState extends State<TextBoxControl>
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!);
Expand Down
2 changes: 1 addition & 1 deletion pigeon/demographics_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 5f9b046

Please sign in to comment.